I search the Internet for answers to computer technical problems that I encounter. When the Internet does not supply me with an answer, I research one on my own. Then, I document the answer here so others can find it.
Also, for your benefit, this stupid blog name makes a great mnemonic.

2011-03-06

Perl one-liner: count Apache connections to local app servers.

I had this one-liner lying around that I meant to drop on here. Looking at it I'm fairly certain the scenario was as follows.

This one box has a single Apache (IBM HTTP Server, really) instance talking to a lot of different application servers (WebSphere), which also run locally. Ignore the wisdom or lack thereof for this configuration. For whatever reason (verify load balance settings?), I had to count the number of connections Apache was making to each application server.

So as we can see, at the time I ran this script, the balance of connections was really lopsided. The application server listening on port 8056 had 305 connections and the one listening at port 8054 had 30 connections, and so on.