I've written a PHP script that I've scheduled with CRON to run every minute. The goal of the script is to verify that the memcached server is online. My strategy is simply to attempt to connect to the memcached server. If I connect successfully, I close the connection. If I do not successfully connect, I send an email alerting that memcached is offline.
My question: is this a sufficient test that memcached is up and running, or is it common practice to do more than just connect to memcached? Should I also test that I can set and retrieve a key/value pair?
Also, in the future, we may want to do more extensive monitoring of memcached so we can track memory usage, connections, number of requests, etc. Are there open source libraries for doing this from PHP? If so, which ones have performed nicely in your experience?
Using memcstat. Installing the libmemcached-tools package will give you access to the memcstat command, which displays the operating status of a single or group of memcached servers. Usage is very simple.
Memcached is an object caching framework. It is essentially used to cache the database queries, making a difference in dynamic websites like Drupal and WordPress to serve pages quicker. It can moreover significantly decrease resource use on an active web server by reducing calls to the database.
They both have very basic difference while storing value. Memcache mostly considers every value as string whereas Memcached stores it value's original type.
You don't need to build anything. There are a number of PHP scripts intended for monitoring, debugging and displaying stats for a Memchached server.
There are two that I know of and work well:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With