Here’s my notes from trimming a little off the top of an apache server. This was just a quick chop at the default install. I haven’t looked at how the webapps are used or how many connections or the length of time per connection or anything… I’ll go back later and tweak how many threads and processes are started and used. I’m sure i’ll regain a lot more resources out of that.
Removed unused modules from apache configuration, restarted apache
Removed modules: status_module, info_module, proxy_balancer, proxy_ftp, proxy_http, and proxy_connect, restarted apache again
[httpd footprint reduced from 255m to 239m per instance (9+ instances running at all times)]
Removed module: userdir, restarted apache again
[httpd footprint reduced from 239m to 237m]
[Memory usage dropped from 2.295gb to 2.133gb (lighttpd would use less but probably not worth the hassle with all the webapps running on here]
Linux, ooo! Shiny... apache, easy, memory, modules, processes, resources, tweak
Got a process that you want to restart in a script but it doesn’t respond nicely? Use the sleep command in your script and check its status after you start, stop, or kill it. After incrementally backing off a few times, waiting longer and longer, I give up and exit with an error. But you could come back later, or basically raise an exception by saving the value of “$?”. You can do this as you start a process and want to make sure it’s fully up and running before moving on because it dies sometimes unexpectedly. There’s a ton of uses for sleep.
DAEMON=myapp
sudo /etc/rc.d/init.d/$DAEMON start
sleep 1
if [ `sudo ps -ef | grep -c $DAEMON` == "1" ]; then
sleep 2
if [ `sudo ps -ef | grep -c $DAEMON` == "1" ]; then
sleep 3
if [ `sudo ps -ef | grep -c $DAEMON` == "1" ]; then
sleep 3
if [ `sudo ps -ef | grep -c $DAEMON` == "1" ]; then
echo
echo “ERROR: $DAEMON did not restart.”
echo “Quitting Early!…”
exit 1
fi
fi
fi
fi
Linux, Solaris howto, processes, scripting, shell, sleep
Recent Comments