Optimizing Server-Side Actions

You can achieve optimal product performance by consolidating server-side actions. If you combine multiple tasks into a single, larger server-side action, server requests are reduced and performance improved. In a well-optimized product, each user action, such as a click or selection, launches a minimal number of server-side action requests, ideally one. This approach prevents server response delays caused by multiple requests for a single action. To view examples of optimized server-side actions, see Code Examples. For more information about verifying server-side actions performance, see Verifying Server-Side Actions Performance.

As an alternative optimization method for server-side actions, you can apply the lightweight mode, which loads product data only when required. You can use this mode to enhance the performance of non-optimized server-side actions that do not interact with product data. Examples of functions that require product data are setAnswer(), getTable(), and getQTable().

When applying the lightweight mode, use the scratchpad variable to transfer data from the server to the client. Avoid using questions and answers, QTables, and tables for this purpose. Additionally, excluding functions that load product data can further improve server-side action performance. These functions are best reserved for client-side actions whenever possible.

The list of functions that load product data—even in lightweight mode—includes:

To enable the lightweight mode:

  1. Go to CPQ > Configurator > Settings.

  2. Check the Enable lightweight mode box.

  3. Click Save.

Verifying Server-Side Actions Performance

You can verify the performance of server-side actions by launching a product and appending the "&debug=T" string to the product URL. Then, open the console and analyze the detailed logs for each server-side action. The following image shows an example of logs that can help you identify potential performance issues.

An example of server-side action logs in the console.

In the tasks section of the logs, you can view performance metrics in seconds for each server-side action:

  • auth – Represents the time spent on authentication when a server-side action is initiated. The server needs to verify the user's authorization to access server-side functions. A high value may indicate that a large amount of data (megabytes) is being sent. You should minimize the number of server-side actions for large data transfers and consolidate multiple actions into a single action. Consolidating actions ensures a faster authentication and improves performance.

  • http-data-send and http-data-receive – Show the time required to send data to and from the server. High values could suggest that temporary data is not being cleared when sending a request to the server. To optimize performance, remove large amounts of data from the scratchpad variable and answers after use.

  • ssa-load-product – Indicates the time required for loading a product. If this key is present, the product has been loaded. If the product should not be loaded, remove any functions that loads the product from the server-side action.

  • other – Corresponds to the time required to perform internal tasks related to the request and prepare the response for the client. A high value may indicate performance issues.

Alternatively, you can view the same the same metrics presented as percentages in the stats section. The http-data-send and http-data-receive keys are combined under the http_request key.

General Notices