Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a very heavy site in my server. The load of the server is always about 30-50 and sometimes it become even 150 and server work really hard. I'm looking for a caching solution that can increase performance of server and decrease the server load.

But I do not know which caching solution I should use? By the way I'm using Drupal CMS and I have WHM/CPanel

Here are options which I found: 1- Memcached 2- Varnish 3- Apache mod_cache

Can someone please give me some comparison or guidance about these platforms? Does mod_cache of Apache work as good as say Varnish? Because installing and configuring Varnish is not a bit complicated in cPanel / WHM. Although I read very good reviews about Varnish.

I'm looking for the best cache solution which can configured straightforward and not complicated. I would appreciate any help or comment.

share|improve this question

1 Answer 1

up vote 10 down vote accepted

Here are options which I found: 1- Memcached 2- Varnish 3- Apache mod_cache

Caveats: Do you know why your load is so high? If the load is caused by high CPU load required to generate dynamic content, and you're able to serve that content from a cache, than a caching solution may help you. But if the load is caused by i/o contention, or if you're serving personalized content that isn't amendable to caching, then a caching solution may not help much.

In general, a cache will need a big chunk of memory in order to be effective. If your system is already memory constrained, then putting caching software on it could conceivably exacerbate your problem.

  • Memcached

    Memcached by itself won't help you. That is, unlike Varnish and Apache's mod_cache, Memcached is not something you can simply stand up in front of an existing application.

    Memcached is a very fast key/value datastore that can be used by applications to speed up a variety of operations. A common example is a database that needs to make database queries: if it's okay to cache the results for some amount of time, the results may be served much faster by memcached than by the backend datbase.

    If you're server load is largely the result of custom code, then modifying your code to take advantage of memcached can yield a substantial benefit.

  • Varnish and Apache's mod_cache

    Both of these can be used to accelerate the delivery of dynamic content.

    Of the two, Varnish is a specialized tool designed only as a content accelerator. It only does one thing, but by reputation it does it very well. The configuration language is a C-subset that gets compiled and loaded into the running Varnish process; this isn't good or bad by itself but I prefer more declarative languages.

    Apache's mod_cache can also be used as a content accelerator. There are two advantages to mod_cache:

    • If you're already running Apache, you'll be familiar with the configuration used by mod_cache.
    • You can combine mod_cache with other Apache modules (e.g., mod_rewrite and mod_header) to create a very flexible configuration.

    On the other hand, your performance may not be as good as that provided by Varnish. I don't actually have any numbers to back this up, but they're probably out there (look for them -- don't take my word for it!).

    Both products work best if you tune your backend application to provide cache-friendly content. This means appropriate caching headers, no cookies on cacheable content, appropriate max-age or expiration headers, etc.

Make sure you understand your problem first: figure out what's causing the high load. Then try one or more of these solutions and see what happens.

share|improve this answer
    
Thanks for detailed answer and great information you provided. –  Dane Sep 25 '11 at 5:57
    
In the particular case of Drupal though, memcache itself will help. Just enable the memcache module, and Drupal can utilize it as a drop-in solution. –  user50849 Jul 30 '12 at 6:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.