Check and analyze memcached usage
What should I do if the traffic volume increases and the database pressure is high? A good way is to block a layer of cache in the center! This cache requirement is efficient and cannot be slower than the database; otherwise, the service quality will be affected; if data can be hashed and stored to the hard disk, it will also be possible, but in today's increasingly inexpensive memory, use the memory!
MySQL also has its own cache, which is also stored in the memory, but there is a saying:
The following is a quote:
Only one instance can be created.
This means that the upper limit of the content you can store is the available memory of your server. How much memory does one server have? How much can you store?
MySQL query cache becomes invalid with only write operations
You only need to make slight changes to the database content. If you want to modify other rows, the query cache of MySQL will also become invalid.
Besides, if MySQL cannot resist it, how can we still look forward to the cache it provides?
So I can use memcached! His advantages and usage can be found:
The following is a quote:
1: operational principles of the interaction process between memcache and MySQL
2: excellent jobs for memcached and MySQL
It is a headache for developers to face their needs, and maintenance is a longer task. Therefore, I am more concerned with the running status of memcached. Fortunately, the author of memcached gave us instructions to check the running status. It is mainly "stats". The method is "Telnet IP port number", and the "stats" command is used after logon.
Then you can see a lot of content. For details, see memcacche stats.
The following is a quote:
PID = process ID
Uptime = number of seconds since the process was started
Time = Current Time
Version = memcached version
Rusage_user = seconds the CPU has assigned Ted to the process as the user http://www.haomad.com
Rusage_system = seconds the CPU has assigned Ted to the process as the system http://www.metabase.cn
Curr_items = Total number of items currently in memcache
Total_items = Total number of items that have passed through the cache
Bytes = Total number of bytes currently in use by curr_items
Curr_connections = Total number of open connections to memcached
Connection_structures = ???
Pai_get = total get commands issued to the server
Performance_set = total set commands issued to the server
Get_hits = Total number of times a GET command was able to retrieve and
Return data
Get_misses = Total number of times a GET command was unable to retrieve and
Return data
Bytes_read = Total number of bytes input into the server
Bytes_written = Total number of bytes written by the server
Limit_maxbytes = total storage bytes available to the server.
Focus on several items that are useful for observation.