How to Optimize Apache Server Performance
General performance improvement guidelines along with helpful tips and tricks to help your apache server perform at its best.
Personal Hosting Get more information today on Personal Web Hosting with 99.9% uptime guarantees
Host 1: 00:00 Podcasting from southern California, this is On The Net, your go-to for everything you need to know about how to get your business online and keep it there—brought to you by Lunarpages. We’ll help you navigate the mystifying ins and outs of doing business in today’s digital era. From web hosting to ecommerce to security and protection, if it has to do with your online presence, we’ve got it covered. Let’s get started.
Host 2: 00:30 Hello everyone. Welcome to “On the Net”, where it’s all about your online presence. Thanks for joining us! This podcast is designed to make doing business online easy for web designers, developers, bloggers and online business of every shape and size. Whether you are new to buying web hosting or running a web site, this podcast show will be able to answer your most burning questions. This edition of “On the Net” is all about improving Apache performance. We will offer general performance improvement guidelines along with helpful tips and tricks to help your web server “Be all it can be!” Have you ever gone to a web site or utilized a web-based tool and thought to yourself, “Man, this is so slow I want to scream!”? Well you are not alone. Thankfully, for the diligent web professional, there are some easy tricks you can use to keep your web server from being one of these time-wasting annoyances.
Host 2: 01:18 First let’s talk about some basics. Ultimately, great performance comes down to efficiently using the hardware provided. The single biggest hardware issue affecting webserver performance, as one might guess, is having enough RAM. Of course, you can always buy more RAM, but if not, there are some ways you can take better advantage of the RAM you have. A webserver should never have to exchange live data currently in your RAM with stored data on your hard drive as swapping dramatically increases the latency of each request. As the web server processes web requests, it spawns individual process “children” to handle each request. Each of these children is known as a “Request Worker”, and each child is given its own section of memory to handle the work. In your httpd.conf file, you will find a “MaxRequestWorkers” setting. Here is an easy trick to determine the how many max request workers you should have.
Host 2: 02:11 You want to use as much of the RAM as possible without swapping. To determine the optimal amount, use the task manager of your choice to determine the average size of each webserver process. Divide this in to your total memory. Be sure to leave room for other processes! You can also increase your write buffer size. If you have never heard of a write buffer, a write buffer is a type of data buffer used by your server when the CPU is processing information to be written to memory. A write buffer can hold data written from cache to main memory or from cache to the next cache in the memory hierarchy. If your pages fit within your extended write buffer size, apache can complete an entire process with a single call to the tcp/ip buffer. Amazingly, the way that you write to logs also affects apache performance.
Host 2: 02:58 The webserver application can write logs directly to a log file, however, you can also configure the application to write to and from log files with a separate process. This is known as “Piped Logs”. When you write directly to a log file from the web server process, it causes log rotation issues. Many people are not aware that you must restart the apache service to rotate to a new log file. This causes significant delay. Always use piped logging. Logs should also be on a separate physical disk from web files when possible. When tweaking any webserver, you must set up accurate benchmarks. This way you can use graphs to identify if your performance has increased, and if the load has decreased. You will want to monitor throughput and latency, resource utilization and activity, host level resource metrics, and errors. Other hardware is also key. Make sure you have a fast-enough CPU, network card, and hard disk.
Host 2: 03:53 Unfortunately, only experience will help you make this determination, so feel free to play around with different configurations to figure out the optimal setup for you project. Also, be sure to take advantage of the following nifty tricks to optimize your performance: Be sure to run the latest release and patch level of the operating system as newer versions of the operating system often utilize hardware and memory more effectively. Remove any unused modules as extra modules will bog your system down. Zip or archive any files that will be downloaded Turn off hostname lookups. Use IP Addresses instead of hostnames in all configuration files. Use persistent connections so the web server does not have to reconnect between requests, but don’t set your KeepAliveTimeout too high or you will starve your pool of available clients. Disable .htaccess by setting AllowOverride to none. Allowing symlinks is also key.
Host 2: 04:48 If you do not allow symlinks, apache will make a separate call on each file request to ensure it is not a symlink. When you refer to files or use a directory index, do not use wildcards. For example, refer to your index file as index.html or index.php, not index. These are just a few tips and tricks for improving apache performance. That’s all the time we have. Thank you for listening to the latest edition of Lunarpages podcast “On the Net”. You can listen online, but you can also subscribe to the podcast on iTunes to get future episodes delivered to you automatically. Until next time, here’s to wishing you all the best with your website endeavors. Thanks for listening and take care.
Host 1: 05:36 Thank you for listening to the latest edition of Lunarpages podcast On the Net. Remember, it’s all about your online presence. If you like what you heard, please share our podcast. Join us next week as we take on another
Host 1: 05:50 need to know topic around doing business in the digital era.
Stay up to date on relevant tech topics and read our Uptime Blog!
Contact us below to leave comments and suggestions for Lunarpages On The Net Podcasts.