How to increase website speed using memcache
Now a days, the speed is one of the most important factor this is with the website is accessed is more important. If your web site is running on MySQL database with number of records in it, can be slow processed as each record needs execution of the SQL query and resulting of the data from the database. So that queries on tables, which are in the process, are locked, this may result in delay of query and reduce the speed.
Memcached is an easy to go, it has a highly-capable which stores data and objects anywhere on dedicated or spare RAM is vacant for fast access by website request. You’ll need to run Memcached on multiple servers and then use their shared cache to store objects. As each server's RAM is storing data, so the server speed will be much quicker than loading from disk. It will result in performance. As the cache is just a storage area for data, cache can be used to store any data, with complex.
Adjust website code so that data is read from the cache provided by Memcached. If the data is not present in Memcached, then the data is need to get from the MySQL database and written into the cache for future requests.
Here in the illustration, various users can get in touch with any of the Memcached servers to demand a given key. When the data is demanded by the user, the key is used for reference the data. It is hashed & this hash can be used to choose one of the Memcached servers. The choice of the Memcached server gets on the user’s side prior to the server is contacted.
This algorithm can be used whenever user demands the same key. The same key will make the same hash, with same Memcached server for serving the data. Cached data is distributed in all of the Memcached servers, and this collected info is accessible from any user. The request is a distributed, much quicker than fetching the data from the database.
The data held within a Memcached server is never stocked up on the HDD (only in RAM), If any of Memcached server stops working, the data can be retrieved from the MySQL database, although at a slower rate than loading the info from the cache.
|