Optimizing for Speed

Overview

Every site is unique, and integration is a system of proven and required steps followed by careful optimization based on your specific site requirements. This page offers some tried and true steps that we have garnered from multiple clients and benchmark tests.

Using the steps outlined in this document can help your site run Algonomy at its most optimum levels. Each site has unique needs and challenges, and optimization is something that should be worked on with your Algonomy team.

Client benchmark tests have seen large reductions in request and response times by following these tips:

  1. Set up the request early and asynchronously, using a few requests as possible.

  2. Receive only the data you need.

  3. Allow compressed responses.

Setting Up Your Request

When and how you call the Omnichannel Personalization server will have a large impact on performance.

For JavaScript integrations, follow the JavaScript integration examples.

For API calls, follow these rules of thumb: 

  1. Make your request as early as possible, and do it asynchronously. (This is the most common mistake we see in customer integrations.)

  2. Make as few requests as possible.

Receive a Smaller Response

You can choose which pieces of information return in the Algonomy response and smaller responses will be faster.

By default, recsForPlacements returns many details for every product, but the information your site needs might be a much smaller subset of this data. For example, if you use only the JSON objects in the response, you can set excludeHtml=true so that you don’t receive formatted HTML for every product.

Eliminate any unneeded information from the Algonomy response with one or more of these recsForPlacements parameters:

Parameter

Description

excludeHtml=true

 

True/false. If set to true, omits the HTML returned in the Omnichannel Personalization server response. If false, the response includes the HTML for the placement, which is set in the layout, in the html field. Default=false. 

Example: excludeHtml=true

excludeItemAttributes=true

 

True/false. If set to true, removes the item attributes from the recommended products data. Default=false. 

Example: excludeItemAttributes=true

excludeRecItems=true

 

True/false. If set to true, removes the recommended items structure completely. This is useful when having HTML is enough in the response. Default=false. 

Example: excludeRecItems=true

returnMinimalRecItemData=true

 

True/false. If set to true, reduces the information about the recommended items down to external ID and click URL (the minimum item payload). Default=false. 

Example: returnMinimalRecItemData=true

categoryData=false

 

True/false. If set to false, o​mits category data in the response. If true, categoryIds and categories are returned in the response. ​Default state: true.

Example: ​categoryData=false

Use Compression

When using server-side API calls, use server-side HTTP clients that support compression to reduce request times. If you use client-side API calls, the customer’s browser will support compression automatically.

Technical Details

Switching to a client that supports compression should be a simple Java code change. For example, if you use Apache Commons, instead of:

Copy
HttpClient client=new DefaultHttpClient(httpParameters);

you would use something like this:

Copy
HttpClient httpClient=new DefaultHttpClient(httpParameters);
HttpClient client=new DecompressingHttpClient(httpClient);

For more on compression, see these articles:

http://en.wikipedia.org/wiki/HTTP_compression

http://www.atetric.com/atetric/javadoc/org.apache.httpcomponents/httpclient/4.3/src-html/org/apache/http/client/protocol/RequestAcceptEncoding.html