Reverse proxy resource usage – httpd 2.2.15

Recently I had reason to find out what happens when your httpd config includes a LOT of ProxyPass statements. The particular use case involved an application farm with one VirtualHost per domain for hundreds of domains, each very similar (though not identical) with dozens of ProxyPass statements to shared backend apps. But just a few dozen domains resulted in very high memory and CPU use.

I set up a simple test rig (CentOS 5 VM,1GB RAM, single x86 CPU, ERS 4.0.2 httpd 2.2.15) and ran some unscientific tests where the config included 20,000 ProxyPass statements with these variables:

  1. Unique vs. repeated – unique statements each proxied to a unique destination, while repeated ones proxied different locations to the same destination.
  2. Balancer – the statements either proxy directly to the URL, or use a pre-defined balancer:// address.
  3. Vhost – the ProxyPass statements were either all in the main_server definition or inside vhosts, one per.
  4. MPM – either prefork or worker MPM is used.

No actual load was applied to the server – I just wanted to see what it took to read the config and start up. Settings were defaults per MPM (5 children for prefork, 3 children for  worker) – obviously you’d tune these depending on usage. I tried to wait for things to settle down a bit after startup before reading “top” sorted by memory usage.

I also tried some other methods for accomplishing this task to see what the memory footprint would be.

Continue reading

VMware KVM madness

A couple weeks ago I set up two KVMs so that my work machine and personal machine could share my keyboard, mice (yes, I have one for each hand), audio, and monitors (I have three, but only two are shared). I bought two TrendNet KVMs, a TK-209 (for audio) and a TK-207 (for second mouse and monitor). Shortly I started experiencing problems where at random times, both KVMs would switch away from my work computer at the same time. To make it worse, sometimes when I tried to switch back (always using the buttons on the KVMs), the monitors would switch back but the mouse and keyboard would not work and the KVM lights would blink.

At first I just chalked this up to my bizarre setup. I figured 64-bit Windows XP might be to blame (who besides me uses that?) or the dual use of KVMs (but dual-monitor KVMs are crazy expensive!). But after a while I started to notice that there was a relationship with my use of VMware virtualization. So I finally did a search and found this forum entry which explained what’s going on.

It seems that in order to handle virtualization of the keyboard “lock” keys (caps lock, num lock, scroll lock), if there are any differences between how these keys are locked on the host and VM, VMware software resets all of them by virtually clicking them once or twice. Typically it’s the num lock that’s different, but the software just does all of them; in particular, switching between host and VM typically results in two scroll lock presses, which is the key combination that tells the KVM to switch hosts. Nasty! The simplest way to avoid it is just to make sure the settings match up between host and VMs.

Now that still doesn’t explain why both KVMs sometimes fail to switch back correctly; that perhaps is due to my unusual (and probably unsupported) setup. Rebooting the host does fix it, but I hate doing that. However I did have an episode today where eventually the KVMs righted themselves after waiting a while. So perhaps I will not send them back as I was starting to think I’d have to.