Kiểm tra Memcached có chạy không:

using Telnet, log in to your server SSH terminal and write below command:

  1. telnet localhost 11211


  1. telnet 11211

P.S: The above command will run if the local server is your Memcached server.

If the above command runs successfully, you will get the below result:

  1. Connected to localhost.
  2. Escape character is ‘^]’.

Otherwise, you will get a connection error.

Kiểm tra các thông số hoạt động của Memcached:

To check some basic stats you can use below command: stats

To check the items, use: stats items

To check current memory statistics write: stats slabs

To quit the connection type quit and press enter.

Top Memcached metrics to monitor

System memory

Make sure that you’re not running out of physical memory on your Memcached machines. If memory pages used by Memcached begin being swapped to disk, requests will be slowed significantly, and you may not benefit from using Memcached at all.

Fill percent and evictions

It’s a good idea to keep track of the amount of free space in your cache. When a full cache is encountered when storing data, the cache will evict an older, unused item from the cache, and replace it with the new item. If your cache is constantly full, you may want to increase the size of your cache, reduce the time-to-live for some records, or store less data. Similarly, if your cache is barely used, you could probably afford to bump up your time-to-lives, or reduce the size of your cache.

At first glance, it appears that memcache.fill_percent tells us everything we need to know about the amount of free space in the cache. However, due to the way that Memcached assigns memory pages into slabs, it is possible for cache evictions to take place even when the cache is not 100% full. This is why it’s also important to keep an eye on the memcache.evictions_rate metric, which is also indicative of the amount of free space in the cache; if the frequency of evictions suddenly increases while fill percent is below 100%, a single slab class may be full.

Hits and misses

memcache.get_hits_rate and memcache.get_misses_rate metrics are useful for checking the general health and usage of your cache. They allow you to see how frequently the cache is being accessed, and the number of requests the result in cache hits and misses. In general, you want to have significantly more cache hits than misses in order for your cache to be effective. Keep an eye on the two metrics, and the ratio between the number of hits and misses; if any of the three start to fall, something is likely wrong.