We're having an issue with slow fetches from a particular data source. We turned on the timing data and have seen multiple seconds is spent in the "DSResponse serialization" step.
The data source is a HibernateDataSource, it has a ton of joins and includes from other data sources. This data source is feeding a primary ListGrid that is central to our application. The actual query time is slow as well, we've been looking into the actual SQL that is generated and we're working on improving that. I'm wondering if there's something that can be done about the slowness that we're encountering in the serialization step.
Here's the data source:
There are 74 fields in the data source, however because of the joins to other entities, the SQL has 550 columns in the select. This causes the query to be slow, I'm not sure if this affects serialization.
In our operation binding, we're doing 2 separate fetches and joining the results. This is done to eliminate a 1+n fetch to get records from a man-to-many relationship. Instead of returning the hibernate entity, we're returning a List<Map<String, Object>>, maybe that's the cause of serialization slowness?
Here's what our fetch method does (pseudo code for brevity):
Is there something obvious we're missing that would be making the serialization so slow?
We're using GWT 2.8.2 and SmartClient Version: v12.0p_2019-11-02/Enterprise Deployment (built 2019-11-02)
The data source is a HibernateDataSource, it has a ton of joins and includes from other data sources. This data source is feeding a primary ListGrid that is central to our application. The actual query time is slow as well, we've been looking into the actual SQL that is generated and we're working on improving that. I'm wondering if there's something that can be done about the slowness that we're encountering in the serialization step.
Here's the data source:
Code:
<DataSource ID="OpeningTest" serverType="hibernate" beanClassName="com.assaabloy.protech.domain.Opening" configBean="protechSessionFactory" autoDeriveSchema="false" dropExtraFields="true"> <fields> <!-- ... omitted for brevity ... --> </fields> <operationBindings> <operationBinding operationType="fetch"> <!-- Function executes standard fetch to opening, then subsequent fetch to opening_door using regular ds.xml and joins results --> <serverObject lookupStyle="spring" bean="openingService" className="com.assaabloy.protech.server.services.impl.OpeningServiceImpl"/> <criteria fieldName="deleted" value="false"/> </operationBinding> </DataSource>
In our operation binding, we're doing 2 separate fetches and joining the results. This is done to eliminate a 1+n fetch to get records from a man-to-many relationship. Instead of returning the hibernate entity, we're returning a List<Map<String, Object>>, maybe that's the cause of serialization slowness?
Here's what our fetch method does (pseudo code for brevity):
Code:
public DSResponse fetch(final DSRequest dsRequest, final RPCManager rpcManager) throws Exception { // Execute standard fetch final DSResponse dsResponse = dsRequest.execute(); // Fetch the related data from other data source DSRequest openingDoorRequest = ... (other fetch) DSResponse openingDoorResponse = openingDoorRequest.execute(); // Join data together final List<Map> data = dsResonse.getRecords(); data.forEach(o -> { // add data from openingDoorResponse } // Update the response data dsResponse.setData(data); return dsResponse; }
We're using GWT 2.8.2 and SmartClient Version: v12.0p_2019-11-02/Enterprise Deployment (built 2019-11-02)
Comment