Sunday, February 20, 2011

Web caching techniques

Web technology high speed development today, cache technology has become a key technological large-scale web design, the cache direct relation of a website access speed and purchase number of servers, even influenced the user experience.
Web cache according to different storage locations, could be divided into client cache, server cache.
Client cache
The client cache can divide again: the browser cache, gateway or proxy server cache
Gateway or proxy server cache is will web cache gateway, much users access to the same pages, will directly from the gateway page send users.
The browser cache is closest to the user's cache, if enabled cache, users in the access to the same pages, from the server to download page will no longer, but from the cache directory reads pages, and then the browser display this page.
The server cache
The server cache is divided into: page caching, data buffer, database caching
1, page caching
Page caching is dynamic pages directly generating static page on the server, the user obtaining the same pages, static page will directly downloaded to a client, no longer needed by the execution of the program and database access, greatly saves server load.
Early website many use release system to complete the functions, in the background release data and the page template integration into static page, stored in hard disk. But such defects obviously, one is the background of the program writing is very complex, 2 it is only through artificial cache control the way to control, which to some update very frequent website is a nightmare, sites may keep cache deletion and reconstruction. Of course later appeared some automatic update these cache framework, such as PHP SMARTY template technology can be defined, and caching expired time, automatic to update this cache. This for some information release kind website has indeed had used.
In addition to the entire page caching techniques, and a technique called "web segment technology," will be cached page part but not all were cache. ESI inclue cache.
2, data buffer
But when WEB2.0 up today, information release is no longer administrator unified release, but all users in release information, user information released after finish is certainly want to see these information, rather than to wait until after the cache time to refresh only to see these data, and data buffer the relevant technology will emerge as The Times require.
Famouser data cache frame has ehcache and memcached.
There are many ehcache cache branch (including page caching module), but the most core modules or its data cache part, for example, when ehcache and integrate hibernate, can will inquire into the object collection memory, the next time if again this query, directly will query from memory returns the set of data, do not need to undertake again database queries, at the same time, you can configure cache the refresh model, a for campaigns, nonstrict - - - - write, for write several models for campaigns, including for - cache is not refresh said (to be refreshed only restart), nonstrict - for - write said refresh is not timely, you can set overtime time to refresh, write for - says in data changes cache can happen refresh, specific how configuration may be according to specific business. 

No comments:

Post a Comment