Client benchmark tests have seen large reductions in request and response times by following these tips:
Set up the request early and asynchronously, using a few requests as possible.
Receive only the data you need.
Allow compressed responses.
Setting Up Your Request
When and how you call the RichRelevance server will have a large impact on performance.
For API calls, follow these rules of thumb:
Make your request as early as possible, and do it asynchronously. (This is the most common mistake we see in customer integrations.)
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:
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.
True/false. If set to true, removes the item attributes from the recommended products data. Default=false.
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.
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.
True/false. If set to false, omits category data in the response. If true, categoryIds and categories are returned in the response. Default state: true.
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.)
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: