Optimising Apache

In order to get the best out of Apache HTTP Server, there are several things that you can do to improve the performance of your sailing environment. However, optimization may not be necessary if your site only processes a few hundred or even a few thousand requests a day. In that case, it’s likely that the default configurations are sufficient.

Here are a few Apache optimizations that you can, and probably should, do:

  • Disable or remove unused modules. Apache comes with many, many modules. Be sure to carefully review the ones that are enabled to ensure you are only activating and using the ones that you need. By not loading unneeded modules, you will save memory on your server.
  • Use caching. In order to reduce the overhead on your server and minimize the processor requests, activate and use caching technology within Apache. Use disk caching (mod_disk_cache) over memory caching (mod_mem_cache), especially if you are limited in the amount of RAM available to your server. And, if possible, externalize your disk cache to a different (hopefully fast) external drive. And if you use caching, be sure to set up the appropriate expire times; otherwise, you defeat the purpose of caching. However, if you have frequently used data and sessions, memcaching is optimal and can reduce the load on database queries.
  • Use compression. Wherever possible, try to compress the content prior to sending it out. Using gzip, for example, will reduce the size of the files being transmitted. These files can then be uncompressed, within the browser, when they are received by the end user. Look at mod_gzip or mod_deflate for these options.
  • Turn off host name lookups. In previous versions of Apache, hostname lookups defaulted to “on,” which added latency to requests. That’s because every time a host name was encountered, a DNS lookup was required. Although this setting in Apache 1.3 and later defaults to “off,” be sure to check.
  • Upgrade RAM and storage. While this is not specifically an Apache modification, this optimization is something that will improve the performance of any server. Giving more RAM to Apache means that the number of simultaneous requests can be increased and run faster. Upgrading the hard drive to one that supports faster I/O can also help, especially for database requests and disk cache-based transactions.

Kill a Process in Unix

A computer process is a computer program that is executing and has a unique process identification or PID. On the Unix Operating System (OS), a process may be running in the background, foreground, or be in a suspended state. On Unix, the OS shell will not return the prompt to the end-user until the current process that is executing finishes. As a result, many processes that take a significant amount of time to run and keep you from using the Unix console until it finishes running. A common task that arises for Unix users is to kill or background a process in order to conduct other tasks on the computer. In order to about or kill a process a signal has to be sent via keystroke or the Unix kill command.

Steps to Kill a Unix Process with a Single Keystroke

Step 1 – Enter the following command to get specific information on the running process on your computer:

% ps

Step 2 – Depress the “RUB” or “DEL” key if your computer keyboard does not have the “RUB” key and the “_” key at the same time. This will send the interrupt signal to the executing process.

Step 3 – When using the keystroke method to kill a Unix process, you will want to remove the “core” file saved to the computer’s hard drive as a result of using the command. To do so, enter the following command to remove the file:

rm -f core

Steps to Kill a Unix Process with the “Kill Command”
Step 1 – Enter the “ps” command as outlined above to retrieve the PID for the process that you need to kill on Unix. For example,

ps myProcess

will return something similar to:

PID TTY TIME CMD

1234 dz07 0:45 edit myBook

1235 dz07 0:37 -csh

Step 2- Enter the following command to kill the first process listed in the example in step 1:

kill -1 1234

to kill the second process that is active enter:

kill -1 1235

Step 3 – If the Kill -1 switch does not work, you may need to use the -9 argument to clear the process from your computer:

kill -9 1234
kill -9 1235

Step 4 – You can alternatively kill all instances of a given process by using the killall command. The syntax for this command is:

killall <pname>