Performance degrades when parsing connect-REST JSON response
The Pega application executes database queries multiple times for each Connect-REST call while parsing the JSON Response.
Below is an example of a query which the application executes multiple times,
SELECT pyPropertyName AS "pyPropertyName", pyPageClass AS "pyPageClass", pyPropertyMode AS "pyPropertyMode" FROM PRULEOWN731.pr4_rule_property "property" WHERE (pxObjClass = 'Rule-Obj-Property') AND (pyClassName = :1 ) AND (pyRuleAvailable = 'Yes')
This causes a tremendous load on the database. As a result, performance degrades when parsing the Connect-REST JSON Response
Steps to Reproduce
- Create a Connect-REST Integration using a sample Data model.
- Trace the database queries that are executed by the Connect-REST call while parsing the JSON Response.
An issue in the custom application code or rules.
When the legacy JSON mapping (that is, without Fast Processing option or without using JSON data transform) was used, the Pega application executed queries on the PR4_RULE_PROPERTY table for each unique page or pagelist and the database queries were executed per pxObjClass per REST call.
Perform either of the following local-changes:
- Enable the 'Use Fast Processing' option in the Connect-REST Response tab for a method as applicable. This field is displayed when JSON is selected in the 'Map from' field.
For complex JSON structures, if the Clipboard structure exactly matches the JSON structure, selecting this field improves processing speed. For this option to work, follow the below guidelines when configuring the Data model:
- The JSON property names and the Clipboard property names must match.
- The JSON tree structure and the Clipboard tree structure must be similar.
- The scalar arrays in JSON must be mapped to the Clipboard as page lists.
- Multi-dimensional arrays must be mapped into page lists of page lists with the same embedded property names. Map multi-dimensional arrays in to page lists of page lists with the same embedded property names.
Page groups, value groups, and Java objects are not supported.
When using the 'Use Fast Processing' option, the JSON mapping does not work for a property that leverages the pzExternalName property qualifier to map the value to the Clipboard.
- Use the JSON data tranform as a Response data transform for REST Integration to make serialization and deserialization faster and more efficient.
For more information, refer to: https://community.pega.com/knowledgebase/configuring-json-data-transform-response-data-transform-data-pages
When using JSON data transform feature, use the property with the pzExternalName property qualifier (as needed) to map the value to the Clipboard (unlike the 'Use Fast Processing' option).