PHP and memcache installation instructions _ PHP Tutorial

Source: Internet
Author: User
PHP and memcache installation instructions. After the website traffic has recently increased, the number of database connections has been high. after analysis, all requests are normal, but the website features are fine. there are too many database queries on a single page, many of the data is that the number of database connections has been high since the recent website traffic was up. after analysis, the requests are normal, but the website features are fine, and there are too many database queries on a single page, A lot of data does not need to be queried in real time, so it can be cached! Memcache must be used for caching to reduce the pressure on mysql!

Project name: Weather forecast 15 days Query website http://15tianqi.cn

Cause: too many mysql connection requests and high database pressure

Solution: Install and enable memcache cache

What is Memcache? Memcache is a free and open source code, high-performance, and allocated memory object cache system. It is used to accelerate dynamic web applications and reduce database load.

It can cope with any number of connections and use non-blocking network I/O. Because its working mechanism is to open up a space in the memory, and then create a HashTable, Memcached self-manages these HashTable. Memcached is simple and powerful. Its simple design promotes rapid deployment and is easy to develop. it solves many large data caches. Its APIs are available in the most popular languages.

In any case, to use the memcache memory cache, you must install memcache in php and then install memecached in linux. In this way, PHP can use memecache to access data in the 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 check for installation

/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 include LiveJournal, Wikipedia, Flickr, Bebo, Twitter, Typepad, Yellowbot, and Youtube.

...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.