the cost of optimization

So between using MTOptimizeHTML and mod_gzip, my server is taking a beating.

red-load-day

last pid: 17424; load averages: 3.96, 2.94, 1.84 up 9+08:17:32 21:19:44
93 processes: 5 running, 88 sleeping
CPU states: 99.2% user, 0.0% nice, 0.0% system, 0.8% interrupt, 0.0% idle
Mem: 168M Active, 17M Inact, 41M Wired, 10M Cache, 35M Buf, 12M Free
Swap: 1027M Total, 440M Used, 587M Free, 42% Inuse

PID USERNAME PRI NICE SIZE RES STATE TIME WCPU CPU COMMAND
11208 www 62 0 301M 44564K RUN 13:08 24.07% 24.07% httpd
11134 www 62 0 85152K 12724K RUN 5:57 24.07% 24.07% httpd
16618 www 63 0 83352K 49232K RUN 1:13 23.78% 23.78% httpd
17038 www 62 0 82584K 44184K RUN 1:55 23.63% 23.63% httpd
335 mysql 2 0 29320K 376K poll 28:02 0.00% 0.00% mysqld

The top 5 processes are chewing all my CPU time and for long periods of time (see the graphic: the red line is at 100% of CPU and ideally, utilization doesn’t exceed that).

The load average, as displayed by uptime(1), is over 5 now: that’s 4 too many. As you can see, it’s all httpd processes (Apache with an embedded mod_perl interpreter). The mysql process is dormant, for all intents and purposes.

I have to make the call here on how much I want to pay for optimization and what kind makes the most sense. mod_gzip seems like a very elegant solution and the load is distributed over the full day, while the MTOptimizeHTML hit takes place at every rebuild, ie, every post or comment.