1 Database cache
Usually databases support caching of query results, and have complex mechanisms to ensure the effectiveness of the cache. For databases such as MySQL and Oracle, the improvement of system performance through reasonable cache configuration is quite significant.
2 Data connection driven cache.
Such as PHP's ADODB, J2EE's connection driver, and even ORMs such as HIbernate are also regarded as connectors. The effective caching mechanism here is not that strong. One of the best advantages of using this step to implement caching is that the way we retrieve data can remain unchanged. For example, I call
The statement of $db->CacheGetAll(“select * from table”); does not need to be changed, and caching can be implemented transparently. This is mainly applied to some data that does not change much. For example, some data dictionaries do not change frequently.
3 System-level cache
You can cache the required data by yourself through the Cache library in the system. For example, generating a tree stump menu consumes a lot of resources, so you can cache the generated tree. The disadvantage of this is that when some parts of the tree are updated, you need to manually update the contents of the cache.
The caching libraries used can have different caching methods. Some put the content on the hard disk, and some put it in the memory. If you simulate the content as a hard disk to cache, the speed can of course be improved a lot.
4 Page-level caching
This is most commonly used in content management systems. That is to generate static pages. The cache control mechanism is the most complex here, and there is generally no cure-all solution, only specific analysis of specific situations.
Usually when generating static leaves, you need to have a mechanism to delete outdated or rarely accessed leaves to ensure the speed of retrieving static leaves.
5 Methods of using precompiled leaves and loading as FastCGI
For PHP, you can use compilation engines such as zend, and for JSP itself it is pre-compiled. The principle of FastCGI is to pre-load the script without having to read it every time it is executed. This is the same as JSP being pre-programmed into a Servlet and then loaded.
6 front cache
You can use Squid as a front-end cache for your web server.
7 Make a cluster
Cluster the database, cluster the web server, and cluster the Squild front-end machine.
For novices, if your program happens to die, you first need to check whether there are errors in the code and whether there are memory leaks. If there are none, then the problem usually lies in the database connection.
By comprehensively applying the above caching methods, it is easy to develop high-load web applications.
http://blog.csdn.net/danny_xcz/archive/2006/10/13/1332555.aspx