MusicGearGeeks.com success story

This is a brief article about the performance optimizations we did for a Drupal site of one of our customers - http://musicgeargeeks.com (update: the site seems to be unavailable now, this article was created in 2012).

Initially, the site had serious performance problems. Sometimes it took up to 30 - 40 seconds to load a page. To find the reason, we profiled the code. Our research showed that more than 90% of the time is taken by HTTP requests to third-party servers. After a more detailed study we found out that these requests were addressed to amazon.com, downloading information about the goods displayed on the site. We performed a small test and learned that the amazon module used for downloading data had its own cache, so the reason for such a large number of requests remained unclear. To find the solution for the problem we made a deeper research and found out the following:

1) To retrieve the goods information, two different modules are used: amazon and amazon_store. Each of these modules had it's own cache, not related to the other. This alone doubled the number of requests.
2) Some of the goods could not be loaded from Amazon because they had been removed from there already. Nevertheless, both modules continued attempting to load these goods on each displaying session, resulting in useless requests.
3) The code and templates for displaying the goods information were written in a non-optimal way. Almost each of the templates was attempting to load a good. There was no sufficient slowdown for the cached goods. However, if the good could not be loaded from Amazon (because of its absence) then 5 - 10 unsuccessful attempts to load the good could happen, which delayed page loading vastly.

The following measures were taken to solve these problems:
1) The goods displaying templates were rewritten to load each good only once per page.
2) The code of the templates was also modified to use only one module - amazon. Thus the number of requests decreased by about half.
3) Additional goods cache was implemented. In ordinary situations it is updated with the goods loaded during the site operation and not used in any other way. But if for some reason a good cannot be loaded from Amazon the data is taken from the above described cache and the good is marked as "removed". The goods marked as "removed" are not requested from amazon.com any more.
4) Also, the APC and memcached caching systems were installed, further reducing the server load.

Overall result:
The main site problem was solved. In addition, a number of minor optimization was made. These optimizations significantly speeded the site up, decreasing the page loading time from 30 - 40 seconds to 1 - 4 seconds.

Add new comment

By submitting this form, you accept the Mollom privacy policy.