Recent website traffic, the number of database connections has been high, the analysis of the next, are normal requests, just the site function points of the fine, a single page database query sentence is more, a lot of data is not necessary real-time query, cache up can! Consider the need to use memcache cache, to relieve the pressure of MySQL!
Project name: Weather forecast 15 days query website http://15tianqi.cn
Problem reason: Too many MySQL connection requests, the database pressure is large
Solution: Install enable Memcache cache
What is Memcache? Memcache is a free and open source, high performance, allocated memory object caching system. Used to accelerate dynamic Web applications and reduce database load.
It can handle any number of connections, using non-blocking network IO. Because it works by opening up a space in memory, it then builds a hashtable,memcached self-managing these hashtable. The memcached is simple and powerful. Its simple design facilitates rapid deployment, easy development of the problems faced, and solves many large data caches. Its API is available for the most popular languages.
Anyway, we're going to use memcache this memory cache, we have to install the memcache into PHP, and then install memecached on the Linux system. In this way, PHP can access the data through Memecache memory.
1, download memcached.
Cd/usr/local/srcwget http://memcached.googlecode.com/files/memcached-1.4.15.tar.gz
2, install memcached.
Tar zxvf memcached-1.4.15.tar.gzcd memcached-1.4.15./configure--prefix=/usr/local/memcached--with-libevent=/usr/ Local/libeventmakemake Install
3, start memcached and detect whether the installation work
/usr/local/memcached/bin/memcached-d-M 128-p 11211-u rootps aux | grep memcached
Memcache is a very useful caching technology,Memcache's well-known users are: LiveJournal, Wikipedia, Flickr, Bebo, Twitter, TypePad, YellowBot, Youtube and so on.
http://www.bkjia.com/PHPjc/738501.html www.bkjia.com true http://www.bkjia.com/PHPjc/738501.html techarticle Recent website traffic up, the number of database connections has been high, analysis of the next, are normal requests, just the site function of the fine, single-page database query sentence more, a lot of data is ...