Linux CPU usage and montioring using shell memcache and jquery

Recently in a project where the application was deployed across multiple servers, the Client QA as well as Support Team wanted a better monitoring of all the servers in the production. It was too much to provide everybody with shell access and ask them to monitor using top. Well after a lot of digging through the wonderful search index of Google. And with insights from Paul Colby vide his article Calculating CPU Usage from /proc/stat, and various comments of Memcache usage through telnet along with the /dev/tcp socket connections it was just a matter of using some nifty shell processing before I could store each machine cpu values, loadavg, and running tasks as a json encoded string into memcache on one of the hosts with hostname as the key.
Continue reading “Linux CPU usage and montioring using shell memcache and jquery”

PHP Sessions in Memcache – Locking Issues

Actually it is ages since I sat down to scribble something. Well this one could not be avoided. Hence here it is.

In one of our FTE projects, we had faced a complication that Memcached on one node was using 100% cpu and php-cgi was complainging that the same node was not permitting any more memcached connections. The configuration was as what all says, session.save_handler = memcache, session.save_path = “tcp://:11211,tcp://:11211,tcp://:11211″. It was giving jitters to the night support, that this used to happen at the worse time when most of the clients are using the application. And eventually that memcached needed to be restarted, kicking all users out and every one has to login back from the login page. Now during the past weeks it was so horrible that we marked a portion of the ramdisk from one least loaded nodes and used nfs to export this to all the nodes for a file based sessions store.
Continue reading “PHP Sessions in Memcache – Locking Issues”

php memcache simulate using file system

Recently we were facing some difficulties, where we had facilitate implementing a copy of an application on a development environment with our client. The most difficult part was that though we could coax php to load libraries, we could not install any system services. We were supposed to install only a web application to a pre-configured virtual host. Since we had enjoyed the facility of having Memcache at our own development environment, some core part of the application which was required only when users are logged in, was using the Memcache. Also our database abstraction layer was heavily depending on the memcache library. We immediately identified that the requirements were not met and specified that the environment was not as we required. But the support people were so adamant that they insisted us to proceed by commenting out all references to the class. Well I can also be tough.
Continue reading “php memcache simulate using file system”