Command Line to view the memcached running status

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 whether it can be used in windows. Later, I found a simple way to do this, that is, using telnet.

1. In Windows, connect to the memcached port. In the CMD command line, type telnet 192.168.1.1 11211 11211 as the port number bound to memcached.
2. After connecting to the port, enter the stats command to obtain the parameters that describe the running status of the memcached server.
Stat PID 4356 server process ID
Stat uptime 56625 server running time, in seconds
Stat time 1225249079 current UNIX time of the server
Stat version 1.1.0 server version
Stat pointer_size 64
Stat rusage_user 151.845489 cumulative user time of the process (seconds: subtle)
Stat rusage_system 121.667603 accumulated system time of the process (seconds: subtle)
Stat ibuffer_size 4096
Stat curr_connections 13 connection count
Stat total_connections 54136 total number of connections received since the server was running
Stat connection_structures 318 Number of connection structures allocated by the server
Stat performance_get 100595 total number of retrieved requests
Stat performance_set 6510 total number of storage requests
Stat get_hits 96543 total number of successful requests
Stat get_misses 4052 total number of failed requests
Stat bytes_read 4427679 total number of bytes the server reads from the network
Stat bytes_written 6585596 total number of bytes the server sends to the network

1> uptime is the number of seconds for memcached to run,
2> pai_get is the number of times the cache is queried.
3> split the two data to get the average number of requests cached per second-the recent niupu traffic is very low, so the average request is more than once per second,
With such great pressure, it is no problem to use the file system cache, and it does not reflect the advantages of using memcached.
4>. The number of times the key => value is set in the cmd_set below. The entire memcached is a large hash, which is not found by using ipv_get.
Then, it will call cmd_set to write it into the cache.
5> followed by get_hits, which is the number of cache hits. Cache hit rate = get_hits/pai_get * 100%.
6> The following get_misses number plus get_hits should be equal to pai_get.
7>, while total_itemscurr_items indicates the number of key-value pairs in the cache.
8> total_items = resource_set = get_misses on the graph. However, when the maximum available memory is used up, memcached deletes some content and the above equation is not true.

Command Line to view the memcached running status

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 whether it can be used in windows. Later I found a simple method.
You can do this by using telnet.
First, log on to the server, and then type
Telnet fig 11211
127.0.0.1 is the server address (here it is the local machine), and 11211 is the port number bound to memcached.
The command line window is black. Only the cursor prompt is displayed. Enter stats to obtain the parameter describing the running status of the memcached server.
Number. 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. The two data can be obtained after division.
Average number of requests cached per second-the recent niupu traffic is very low, so the average number of requests is more than once per second.
It's okay to use the file system cache. it doesn't reflect the advantage of using memcached.
The interval _set below is the number of times key => value is set. The entire memcached is a large hash, which is not found by using ipv_get.
Then, it will call cmd_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 that
Number of key-value pairs in memory, total_items = pai_set = get_misses in the figure, 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_id limit_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]
Memcached 1.2.2 and earlier versions show the access time (timestamp)
1.2.4 or later versions, including 1.2.4 display 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.