I've created ISIS-1590 for this

https://issues.apache.org/jira/browse/ISIS-1590


On Wed, 22 Feb 2017 at 09:02 Willie Loyd Tandingan <[email protected]>
wrote:

> Hi Dan,
>
> Thanks for the prompt reply. I investigated like you suggested, and found
> out that during ContentNegotiationServiceOrgApacheIsisV1#buildResponse
> where most of the time is spent, Clause#getValueOf is only called with obj
> of type ApplicationFeatureId [1] [2]. I peeked around
> ApplicationPermissionValueSet and found out that It is ApplicationFeatureId
> that uses ObjectContracts#compare in its compareTo method. Within
> ContentNegotiationServiceOrgApacheIsisV1, there are three areas that
> indirectly accesses ApplicationFeatureId:
>
> a. AbstractObjectMemberReprRenderer#usability
> b. ContentNegotiationServiceOrgApacheIsisV1#appendPropertiesTo
> c. ObjectPropertyReprRenderer#addMutatorLinksIfEnabled
>
> I commented some lines regarding access control within these methods and
> the response time dropped from 16 seconds to 2 seconds! I think we can
> improve this reimplementing ApplicationFeatureId#compareTo.
>
> [1] http://imgur.com/0CIBJKX
> [2] http://imgur.com/ihl3x6N
>
> Best regards,
> Willie
>
> On Wed, Feb 22, 2017 at 4:23 PM, Dan Haywood <[email protected]
> >
> wrote:
>
> > Hi Willie,
> >
> > The Clause#valueOf is used internally by the ObjectContracts#toString and
> > ObjectContracts#hashCodeOf, make heavy use of reflection.
> >
> > There's a warning about ObjectContract not being used in prod [1] for
> this
> > reason, but - that said - your code doesn't reference either
> > ObjectContracts or Clause.
> >
> > If you want to set a breakpoint in Clause#getValueOf(...), then you
> should
> > be able to see what the framework is attempting to do.
> >
> > My guess is that the stack trace will show that the framework is trying
> to
> > determine a title for this view model, and somewhere in there is where
> the
> > call gets made.  If so, then the fix will be to implement a custom
> title()
> > method.
> >
> > HTH
> >
> > Dan
> >
> > [1]
> > http://isis.apache.org/guides/rgcms.html#_rgcms_classes_util
> > ity_ObjectContracts
> >
> > On Wed, 22 Feb 2017, 07:54 Willie Loyd Tandingan, <
> [email protected]
> > >
> > wrote:
> >
> > Hello!
> >
> > We currently have a performance problem with RO in production environment
> > with one of our actions.
> >
> > This action (SalesOrderRestMenu#filter) returns a list of view models
> > (SalesOrderView) and the client-side, an SPA, invokes this action
> accepting
> > simplified representation (Accept header set to
> > "application/json;profile=urn:org.apache.isis/v1;suppress=true"). When
> > this
> > action returns around 601 items, it takes ~16 seconds on my development
> > machine to process. Profiling shows that Clause#getValueOf consumes 12
> > seconds of this CPU time needed to complete the request [1].
> >
> > Any help on how to improve this is highly appreciated!
> >
> > This is how the view model looks like:
> >
> > @DomainObject(nature = Nature.INMEMORY_ENTITY)
> > public class SalesOrderView {
> >
> >     //region > constructors
> >     public SalesOrderView() {
> >     }
> >
> >     public SalesOrderView(final SalesOrder salesOrder) {
> >         setSalesOrder(salesOrder);
> >     }
> >
> >     public SalesOrderView(
> >             final SalesOrder salesOrder,
> >             final String wholesaler,
> >             final String retailer,
> >             final String courier,
> >             final BigDecimal total) {
> >         setSalesOrder(salesOrder);
> >         setWholesaler(wholesaler);
> >         setRetailer(retailer);
> >         setCourier(courier);
> >         setTotal(total);
> >     }
> >     //endregion
> >
> >     //region > salesOrder (property)
> >     @Property(hidden = Where.EVERYWHERE)
> >     @Getter @Setter
> >     private SalesOrder salesOrder;
> >     //endregion
> >
> >     //region > wholesaler (property)
> >     @Getter @Setter
> >     private String wholesaler;
> >     //endregion
> >
> >     //region > retailer (property)
> >     @Getter @Setter
> >     private String retailer;
> >     //endregion
> >
> >     //region > courier (property)
> >     @Getter @Setter
> >     private String courier;
> >     //endregion
> >
> >     //region > total (property)
> >     @Getter @Setter
> >     private BigDecimal total;
> >     //endregion
> >
> >     //region > derived properties
> >     public String getId() {
> >         return getSalesOrder().getId();
> >     }
> >
> >     public String getSalesOrderNumber() {
> >         return getSalesOrder().getSalesOrderNumber();
> >     }
> >
> >     public LocalDate getOrderDate() {
> >         return getSalesOrder().getOrderDate();
> >     }
> >
> >     public LocalDate getShipmentDate() {
> >         return getSalesOrder().getShipmentDate();
> >     }
> >
> >     public LocalDate getDeliveryDate() {
> >         return getSalesOrder().getDeliveryDate();
> >     }
> >
> >     public Status getStatus() {
> >         return getSalesOrder().getStatus();
> >     }
> >
> >     public String getRemarks() {
> >         return getSalesOrder().getRemarks();
> >     }
> >     //endregion
> >
> > }
> >
> >
> > Best regards,
> > Willie
> >
> >
> > [1] http://imgur.com/a/NlDel
> >
>

Reply via email to