4

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.

bman
  • 219
  • 4
  • 13

1 Answers1

10

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.

larsks
  • 41,276
  • 13
  • 117
  • 170
  • Thanks for detailed answer and great information you provided. – bman Sep 25 '11 at 05:57
  • In the particular case of Drupal though, memcache itself _will_ help. Just enable the [memcache](https://drupal.org/project/memcache) module, and Drupal can utilize it as a drop-in solution. – user50849 Jul 30 '12 at 06:12