Understanding Web Cache


Published on

Overview of using cache on websites and some of the implementations of improving your sites performance through cache.

Published in: Technology
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Understanding Web Cache

  1. 1. Web Cache
  2. 2. What is Cache?Cache is the storing of data temporarily to improveperformance. Cache exist in a variety of areas such asyour CPU, Hard Disk and DNS.CPU Cache Hard Disk Cache DNS Cache www.prodigyview.com
  3. 3. Our FocusOur focus on this tutorial will be web cache. Web cache istemporary storing of data that is used with delivering awebpage (html, php, javascript, etc).
  4. 4. Why and HowMany sites today are dynamic websites that1. Use a database connection2. Written with a scripting language3. Have changing contentWith the amount of technology behind making these siteswork combined with larges volumes of traffic going to thesesites, cache is very important to improve the userexperience and lowering cost of your hardware. www.prodigyview.com
  5. 5. Basic Flow Without Cache ServerUser Database
  6. 6. This Is Ok If…..1. Not a lot of content2. Small amount of users/pageviews This Is Bad If…..1. Lots of contents2. Lots of users/pageviews www.prodigyview.com
  7. 7. Flow With Cache Server 2. Server gets content that is cached Database only needed to be called for new contentUser Database
  8. 8. Cache Benefits CPU Cycle Billing: If you are billed by the CPU Cycle, cache can save you money because less of the cpu is used when reading a file rather than a complex database query. Bottleneck: If there is a bottleneck on your web service such as with your database, not calling the database as often and using cached database queries could help with that bottleneck Faster UI: Storing cached files, whether in a file in the browser or a location on the server, can lower the amount of time need to load a page. This can make a faster user experience. www.prodigyview.com
  9. 9. Basic Caching Methods Headers: PHP has a cache option set in the headers. This can be useful for caching external files such as JavaScript and CSS files. Basic File Cache: Basic file cache is an easy to implement solution for writing and reading cache on a server. Memcache: A PHP extension for caching files on multiple servers. Cache Lite: A PHP extension installed through PEAR that caches whole pages or sections of pages. APC : APC, short for Alternative PHP Cache, is another php extension that cache’s PHP code. It is installed through PECL. www.prodigyview.com
  10. 10. Higher Level Caching Varnish: A HTTP accelerator(reverse proxy) that caches data in virtual memory. Squid: A caching server that can cache DNS, FTP, HTTPS, HTTP, TSL, and SSL protocols. Apache Traffic Server: A reverse proxy and forward proxy caching server that despite its name, works with Nginx. XtraDB: If you are using a Mysql database, this caching solution can help optimize performance of your database better than the standard InnoDB. www.prodigyview.com
  11. 11. Server Cache(Squid or Varnish) Server The actual server and the database server are not called unless new content 1. User request goes to server is needed Cache Server 2. Cache servers returns cached data User Database
  12. 12. Database Cache ServerUser 3. Use cached query Database
  13. 13. ReviewAs you can see, caching can occur at many levels. Database (ex: XtraDB) Server ( ex: Memcache) DNS/Networks ( ex: Squid) Client’s Browser (ex: Headers)Take the time to research these solutions further to seehow can they improve your site’s performance. www.prodigyview.com
  14. 14. ProdigyView and Caching Natively, ProdigyView offers two type of caching: file cache and memcache. Bot are easy to setup and use. Caching solutions can be extended by using a third party caching solution or writing an adapter that will change how the cache works. www.prodigyview.com
  15. 15. API ReferenceFor a better understanding of cache in ProdigyView, visitthe api by clicking on the link below.PVCache More TutorialsFor more tutorials, please visit:http://www.prodigyview.com/tutorials www.prodigyview.com