Optimizing Web Server with New Relic APM

People frequently like to use the word optimization in our industry. We optimize our content for search, we optimize our design for mobile, we optimize our funnel for conversions, and the list goes on. However, unless you are an enterprise customer you probably haven’t put a lot of thought into optimizing your web server. Many small business owners use whichever hosting provider their web developer recommends, or worse; they use whichever hosting service is the cheapest. Choosing the right hosting partner is only the beginning, because once you have your website hosting setup and deployed, you need to take appropriate steps to optimize your website and the environment serving it up to the world.

When it comes to optimizing websites, there are a lot of “off-the-shelf” tools that people use, such as W3 Total Cache for WordPress or JotCache for Joomla. These tools, when configured correctly, can be very powerful and mask a lot of underlying flaws with a web server. There are also fantastic content delivery networks (CDN) and reverse caching proxies like Varnish or CloudFlare that can help improve your site performance (and often even the security) in many ways.

So what is web server optimization?

Sometimes this can be referred to as performance tuning, similar to how one might tune an engine on a racecar. We believe it’s important because this is the foundation upon which all of the other optimizations build. While there are many scripts that you can run for free to check for slow database queries, and you can manually review error logs for issues, we prefer to use New Relic, a professional service to tune and monitor web servers and websites. In the example below, we show a three-day span which gives us a good indication of the performance (or lack thereof) before and after optimization.

Web Transaction Time

Web Transaction Time Before and After Optimization

In the above image, we can see that PHP and MySQL are taking between 500ms and 1sec on average to serve pages. This is an internal time requirement, which means you need to add your latency, network time, and rendering time on top of this before the end user sees a page. With proper web server tuning, we were able to reduce this time to around 270ms, and you can also see that it is a lot smoother without the spikes in performance we were seeing before.

Apdex Score

Server Tuning Apdex Score

Here we see the Apdex score, which is a score provided by New Relic. Their explanation is as follows: Apdex is a measure of response time based against a set threshold. It measures the ratio of satisfactory response times to unsatisfactory response times. The response time is measured from an asset request to completed delivery back to the requestor. As you can see in the graph, the Apdex rating has improved by nearly 50% to almost a perfect score.

Throughput

webserver throughput

The importance of this image is to show that our throughput (the requests per minute or RPM that the webserver is handling) during the sample period was relatively consistent. It would be unfair to manage the performance of a server during an off-peak hour and only compare it to peak usage time, as the server may exhibit a weakness under heavy load and seem perfectly fine during a light load.

Error Rate

Website error rate

These errors may not always be visible to the end-user, but they are present and often logged. Sometimes they are caused by missing plugins, outdated scripts, configuration errors, or maybe just bad programming. Whatever they are, New Relic helps us determine the source of the errors with excellent error tracing capabilities. In this instance we were able to solve all of the recurring errors, leaving only a smattering of 404 errors remaining from your typical hacker/spammer probing techniques (i.e., a hacker looking for a wp-admin on a non-WordPress website that results in a 404 page). Removing errors improves reliability and security, and relevant to this article, performance.

We can now rest assured that this website is optimized and Google, Bing, Yahoo, and your users will appreciate that. It is important to remember that this is an ongoing process. Any updates to the website CMS or changes to the environment need to be monitored to keep the website operating at peak performance.

Disclosures: We have our own hosting solution, we offer these services to our clients, and we are a paying customer of New Relic and have not been incentivized by them in any way to write this blog. 

Scroll to Top