Skip to main content
RichRelevance

Optimizing Your Integration for Speed

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 RichRelevance 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 RichRelevance response-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 RichRelevance response with one or more of these recsForPlacements parameters:

 

excludeHtml=true

 

True/false. If set to true, omits the HTML returned in the RichRelevance server response. If false, the response includes the HTML for the placement, which is set in the layout, in thehtml 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

Use server-side HTTP clients that support compression to reduce request times. (This applies to server-side API calls only. If you use client-side API calls, the shopper’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

        HttpClient client=new DefaultHttpClient(httpParameters);

you would use something like this:

        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