📜 ⬆️ ⬇️

PHP: Changing file caching to memcached - impressions

Almost always on large projects, especially communities, you have to cache a lot of data, such as the number of messages, user data, general information ...

On our projects, we have used file caching for several years. That is, the data of each user was recorded in a file, and changed as necessary. The load problem was always, especially on the Mysql database.

Changed file caching to Memcached caching. The results are amazing. The load disappeared, the queue of connections to the database was gone. Sites began to work many times faster.
')
Why is the load on Mysql reduced? My opinion is that the number of requests for reading and writing to the hard disk has decreased, Mysql has been unloaded from this. The speed of the disk, as well as the disk load requests for read-write, as you know, one of the parameters that affect the performance Mysql.

UPD:

What happened:
1. About 250,000 cache files.
2. About 2GB is occupied by cache.
3. About ~ 30 requests / second (at a peak of ~ 50) to read-write the cache from the disk.

What became:
1. 0 cache files
2. 400 MG allocated for memcached (data is stored in the cache - a week)
3. 0 requests for read-write cache.

Source: https://habr.com/ru/post/26957/


All Articles