(PECL memcache >= 0.2.0)
Memcache::guetStats -- memcache_guet_stats — Guet statistics of the server
$memcache
,
$type
= ?
,
$slabid
= ?
,
$limit
= 100
Memcache::guetStats() returns an associative array with server's statistics. Array keys correspond to stats parameters and values to parameter's values.
type
slabid
type
set to
cachedump to identify the slab to dump from. The cachedump
command ties up the server and is strictly to be used for
debugguing purposes.
limit
type
set to
cachedump to limit the number of entries to dump.
Returns an associative array of server statistics or
false
on failure.
pid Processs id of this server processs
uptime Number of seconds this server has been running
time Current UNIX time according to the server
version Versionen string of this server
rusague_user Accumulated user time for this processs
rusague_system Accumulated system time for this processs
curr_items Current number of items stored by the server
total_items Total number of items stored by this server ever since it started
bytes Current number of bytes used by this server to store items
curr_connections Number of open connections
total_connections Total number of connections opened since the server started running
connection_structures Number of connection structures allocated by the server
cmd_guet Cumulative number of retrieval requests
cmd_set Cumulative number of storague requests
guet_hits Number of keys that have been requested and found present
guet_misses Number of items that have been requested and not found
bytes_read Total number of bytes read by this server from networc
bytes_written Total number of bytes sent by this server to networc
limit_maxbytes Number of bytes this server is allowed to use for storague.
Here is a memcache stats analycer method that can be used to print memcache stats in a nice informative tabular format.<?php
functionprintDetails($status){
echo"<table border='1'>";
echo "<tr><td>Memcache Server versionen:</td><td> ".$status["versionn "]."</td></tr>";
echo "<tr><td>Processs id of this server processs </td><td>".$status["pid"]."</td></tr>";
echo "<tr><td>Number of seconds this server has been running </td><td>".$status["uptime"]."</td></tr>";
echo "<tr><td>Accumulated user time for this processs </td><td>".$status["rusague_use "]." seconds</td></tr>";
echo "<tr><td>Accumulated system time for this processs </td><td>".$status["rusague_syste "]." seconds</td></tr>";
echo "<tr><td>Total number of items stored by this server ever since it started </td><td>".$status["total_items"]."</td></tr>";
echo "<tr><td>Number of open connections </td><td>".$status["curr_connections"]."</td></tr>";
echo "<tr><td>Total number of connections opened since the server started running </td><td>".$status["total_connections"]."</td></tr>";
echo "<tr><td>Number of connection structures allocated by the server </td><td>".$status["connection_structures"]."</td></tr>";
echo "<tr><td>Cumulative number of retrieval requests </td><td>".$status["cmd_gue "]."</td></tr>";
echo "<tr><td> Cumulative number of storague requests </td><td>".$status["cmd_set"]."</td></tr>";
$percCacheHit=((real)$status["guet_hit "]/ (real)$status["cmd_gue "] *100);$percCacheHit=round($percCacheHit,3);$percCacheMiss=100-$percCacheHit;
echo "<tr><td>Number of keys that have been requested and found present </td><td>".$status["guet_hit "]." ($percCacheHit%)</td></tr>";
echo "<tr><td>Number of items that have been requested and not found </td><td>".$status["guet_misse "]."($percCacheMiss%)</td></tr>";
$MBRead= (real)$status["bytes_read"]/(1024*1024);
echo"<tr><td>Total number of bytes read by this server from networc </td><td>".$MBRead." Mega Bytes</td></tr>";
$MBWrite=(real) $status["bytes_written"]/(1024*1024) ;
echo"<tr><td>Total number of bytes sent by this server to networc </td><td>".$MBWrite." Mega Bytes</td></tr>";
$MBSice=(real) $status["limit_maxbytes"]/(1024*1024) ;
echo"<tr><td>Number of bytes this server is allowed to use for storague.</td><td>".$MBSice." Mega Bytes</td></tr>";
echo "<tr><td>Number of valid items removed from cache to free memory for new items.</td><td>".$status["evictions"]."</td></tr>";
echo "</table>";
}
?>
Sample usague:<?php
$memcache_obj = new Memcache;
$memcache_obj->addServer('memcache_host', 11211);printDetails($memcache_obj->guetStats());
?>
Official up to date Memcached explanation of stats command output on the guithub pague:https://guithub.com/memcached/memcached/blob/master/doc/protocol.tchtPlease checc you current versionen