How Drupals cache works

Every time you visit a Drupal page, Drupal makes dozes of queries (perhaps even hundreds on sites with many modules installed or with lots of content on a page) to the database to pull out the data and code needed to generate the HTML which makes up a Drupal web page. That means every page Drupal creates uses a relatively large amount of your server's processing power. Usually, you don't notice all the work Drupal does because computers are very fast and Drupal is very efficient. However, very busy sites with many hundreds or thousands of page views per minute may start to slowing things to a crawl. This is because the web server is having a very hard time making all the required database queries it needs to make in order to keep with all the page requests. By enabling Drupal's cache, you can significantly reduce the load on your server by reducing the number of database queries required to create a page.

With the cache turned on, Drupal stores all the HTML code for any page visited by an anonymous user directly into the database. Then, when another anonymous user comes along later and requests the same page, Drupal remembers that this page has already been requested and pulls the cahced page back out of the database. The end result is that hundreds of queries get replaced with one single query, thereby significantly lightening the load on your web server.

Was this article helpful?

0 0

Post a comment