Memcached stats command

Source: Internet
Author: User
Tags memcached stats
It is often necessary to monitor the running status of memcached on the server, such as the number of cache queries and hit rate. But the memcached-tool is written in Perl in Linux, and I have never tried to use it in windows. Later, I found a simple way to do this, that is, using telnet.
First, log on to the server, and then type
Telnet
127.0.0.1 11211
127.0.0.1 is the server address (here it is the local machine), and 11211 is the port number bound to memcached. Then the command line window is black, only the cursor prompts, touch the black and enter stats to get the parameter describing the running status of the memcached server. For example:
Here, uptime is the number of seconds for memcached to run, and pai_get is the number of times the cache is queried. When the two data are separated, the average number of requests cached per second can be obtained. Recently, the niupu traffic is very low, so the average number of requests is more than once per second. This is a great deal of pressure, it's okay to use the file system cache. it doesn't reflect the advantages of using memcached.
The interval _set below is the number of times key => value is set. The whole memcached is a large hash. If you use the content not found by using mongo_get, you will call mongo_set to write it into the cache. Followed by get_hits, which is the number of cache hits. Cache hit rate
=
Get_hits/cmd_get *
100%.
The following get_misses number plus get_hits should be equal to pai_get. Total_itemscurr_items indicates the number of key-value pairs in the cache.
= Pai_set =
Get_misses, but when the maximum available memory is used up, memcached will delete some content and the above equation will not be true. In other words, it would be great for memcached to have a complete set of monitoring tools. For more information about installing memcached and configuring PHP, see here.


Memcached stats command

There are many commands available after telnet to the memcached server, except for the well-known value assignment commands such as ADD, get, set, incr, decr, replace, and delete, there are also a series of commands for getting server information, all of which start with stats.
You can also access these commands using PHP memcache: getstats ($ cmd ).

Common commands

Stats
Display Server Information and statistical data

Stats Reset
Clear statistics

Stats malloc
Display memory allocation data

Stats cachedump slab_idLimit_num
Displays the list of the first limit_num keys in an slab. The format is as follows:
Item key_name [value_length B; expire_time | access_time S]
Among them, memcached 1.2.2 and earlier versions display the access time (timestamp) 1.2.4 or later versions, including 1.2.4 display the expiration time (timestamp)
If it is a key that never expires, expire_time is displayed as the start time of the server.

Stats cachedump 7 2
Itemcopy_test1 [250 B; 1207795754 S]
Item copy_test [248 B; 1207793649 S]

Stats Slabs
Displays information about each slab, including the chunk size, quantity, and usage.

Stats items
Display the number of items in each slab and the age of the oldest item (the number of seconds from the last visit)

Stats detail [ON | off | dump]
Set or display detailed operation records

The parameter is on.
The parameter is off. Disable detailed operation records.
The parameter is dump, and detailed operation records are displayed (the number of times each key value is get, set, hit, and del)

stats detail dump
prefix copy_test2 get 1 hit 1 Set 0 del 0
prefix copy_test1
get 1 hit 1 Set 0 del 0
prefix CPY get 1 hit 0 set 0 del 0

turn: http://www.cnblogs.com/eoiioe/archive/2009/06/03/1495338.html
many times you need to monitor the memcached running on the server, such as the number of cache queries, hit rate and so on. But the memcached-tool is written in Perl in Linux, and I have never tried to use it in windows. Later, I found a simple way to do this, that is, using telnet.
first, log on to the server, and then type
Telnet
127.0.0.1 11211
among them, 127.0.0.1 is the server address (here it is the local machine), and 11211 is the port number bound to memcached. Then the command line window is black, only the cursor prompts, touch the black and enter stats to get the parameter describing the running status of the memcached server. For example,
in this example, uptime is the number of seconds for memcached to run, and pai_get is the number of times the cache is queried. When the two data are separated, the average number of requests cached per second can be obtained. Recently, the niupu traffic is very low, so the average number of requests is more than once per second. This is a great deal of pressure, it's okay to use the file system cache. it doesn't reflect the advantages of using memcached.
The following performance_set is the number of times key => value is set. The whole memcached is a large hash. If you use the content not found by using mongo_get, you will call mongo_set to write it into the cache. Followed by get_hits, which is the number of cache hits. Cache hit rate
=
get_hits/cmd_get *
100%.
The following get_misses number plus get_hits should be equal to pai_get. Total_itemscurr_items indicates the number of key-value pairs in the cache. In the figure, total_items
== pai_set =< br> get_misses. However, when the maximum available memory is used up, memcached will delete some content, and the above equation will not be true. In other words, it would be great for memcached to have a complete set of monitoring tools. For more information about installing memcached and configuring PHP, see here.


Memcached stats command

There are many commands available after telnet to the memcached server, except for the well-known value assignment commands such as ADD, get, set, incr, decr, replace, and delete, there are also a series of commands for getting server information, all of which start with stats.
You can also access these commands using PHP memcache: getstats ($ cmd ).

Common commands

Stats
Display Server Information and statistical data

Stats Reset
Clear statistics

Stats malloc
Display memory allocation data

Stats cachedump slab_idLimit_num
Displays the list of the first limit_num keys in an slab. The format is as follows:
Item key_name [value_length B; expire_time | access_time S]
Among them, memcached 1.2.2 and earlier versions display the access time (timestamp) 1.2.4 or later versions, including 1.2.4 display the expiration time (timestamp)
If it is a key that never expires, expire_time is displayed as the start time of the server.

Stats cachedump 7 2
Itemcopy_test1 [250 B; 1207795754 S]
Item copy_test [248 B; 1207793649 S]

Stats Slabs
Displays information about each slab, including the chunk size, quantity, and usage.

Stats items
Display the number of items in each slab and the age of the oldest item (the number of seconds from the last visit)

Stats detail [ON | off | dump]
Set or display detailed operation records

The parameter is on.
The parameter is off. Disable detailed operation records.
The parameter is dump, and detailed operation records are displayed (the number of times each key value is get, set, hit, and del)

Stats detail dump
Prefix copy_test2 get 1 hit 1 Set 0 del 0
Prefix copy_test1
Get 1 hit 1 Set 0 del 0
Prefix CPY get 1 hit 0 set 0 del 0

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.