Performance Zone is brought to you in partnership with:

Sean Hull is a renowned author, speaker and advisor on MySQL & Oracle databases, web performance and scalability, EC2, Linux & Internet Architecture. He is the author of "Oracle & Open Source" O'Reilly, 2001, and speaks widely at conferences and forums. With 20 years of professional experience, he consults with large enterprises and startups in New York City and the San Francisco Bay Area. Sean is a DZone MVB and is not an employee of DZone and has posted 64 posts at DZone. You can read more from them at their website. View Full User Profile

Caching – What is it and why is it important?

07.21.2012
| 5098 views |
  • submit to reddit

Caching keeps frequently accessed objects, images and data closer to where you need them, speeding up access to websites you hit often.

Your browser is the first layer of caching, keeping images and data from websites that you visit often.  Next the webserver itself has a caching layer, typically implemented by something like memcache, caching information that it would normally fetch from the database on the backend.  This avoids the network roundtrip, and also avoids the load and work of running the query to fetch that data again.

Furthermore you can install what’s called a reverse-proxy on the webserver, such as Varnish.  This can bring further speedups and performance benefits to your overall architecture.

On the database server you also do a lot of caching.  With MySQL you may configure the query cache, which caches query result sets inside of MySQL, eliminating the need to rerun those queries on subsequent calls.  And further the database server has various other caches such as the InnoDB buffer cache, to keep blocks of data in memory, reducing slower requests from disk.

On Quora, Sean Hull asks: What is caching and why is it important?

Published at DZone with permission of Sean Hull, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)