Offload Resource Intensive Scripts to Improve Server Performance

Summary: This article shows how offloading resource intensive scripts can significantly improve web server performance. By offloading the Web Page Analyzer script to a separate server, we improved response times by over 98%, improved throughput by a factor of 40, and significantly reduced response time variability.

In a previous speed tweak we showed how upgrading our web server to a solid state drive and faster processors improved response times by 35% to 50%. With the Web Page Analyzer on the same server, the average response time was 11.87 seconds with typical response times after ramp-up ranging from 23 to 36 seconds. While this was an improvement over the old server, there were still response time and availability issues caused by hosting the analyzer script on the same server. This article shows how offloading a resource intensive script can dramatically improve your server response times.

Baseline Server Before Offloading Script

Our upgraded server improved performance measurably, but users still experienced some slowdowns from the load on our free Web Page Analyzer script. The free script, which analyzes web pages for size and download speed, typically gets 2.2 to 3 times the traffic than our home page receives and is resource intensive. By offloading the script to a separate server, we thought we could reduce the delays users were experiencing due to memory and CPU usage. The upgraded server had the following specifications:

Figure 1 shows the results from Pylot load testing the new server by ramping up responses per second and agents. The response time averaged 11.87 seconds, and once ramped up to 2 or more requests per second the response time averaged about 30 seconds (from 23 to 36 seconds), which is about 36% faster than the old server. The 95% decile response time was 36.16 seconds (25.6% faster than the old server) with a maximum response time of 47.86 seconds (the old ATA-based server had 95% decile response time of 48.6 seconds and the maximum response time was 53.4 seconds), Figure 2 shows the corresponding throughput for the benchmark test of the new server.

After Offloading Resource Intensive Script

To reduce response times even further and make them more consistent (and more "attunable") we offloaded the Web Page Analyzer script to a separate dedicated server. The gateway form for the analyzer still resides on the WSO server, but the heavy lifting is done on a separate server referenced at a subdomain. Now the WebsiteOptimization.com server proper hosts mainly content, contact scripts, and some blogs based on Movable Type. After moving the script, the WSO server benchmarked as follows (see Figure 3):

Figure 3: Response Time Graph - After Offloading Script

Response Time (secs)

avg

0.14

stdev

0.08

min

0.03

50th %

0.14

80th %

0.16

90th %

0.19

95th %

0.27

99th %

0.42

max

1.53

Figure 3 shows that the average response time dropped 98.8% from 11.87 seconds to 0.14 seconds. After ramp-up, typical response times ranged from 0.2 to 0.9 seconds with a maximum of 1.53 seconds. The 95% decile dropped from 36.16 seconds to 0.27 seconds, or 99.2% faster.

Improvement in Throughput (Requests per Second)

Figure 4 shows the corresponding throughput for the benchmark test of the new server after offloading the script.

Figure 4: Throughput Graph - After Ofloading Script

Throughput (req/sec)

avg

141.12

stdev

29.99

min

8

50th %

153

80th %

157

90th %

159

95th %

160

99th %

162

max

163

Throughput improved from an average of 0.97 requests per second (95% decile of 4 requests per second) to an average of 141 requests per second (95% decile of 160 requests per second after ramp-up). The new average throughput of 141 requests per second is 145 times the old throughput of 0.97, and after ramp-up the typical throughput jumped by a factor of 40 (160/4).

Conclusion

This article shows how offloading resource intensive scripts can significantly improve web server performance. By offloading the web page analyzer script to a separate server, we were able to improve response times by over 98%, and throughput by a factor of 40. Attunability was improved by reducing the standard deviation of response times from 14.7 seconds to .08 seconds.

Futher Reading

Upgrading to your own server improves performance, reliability, and control over your website. Andy King talks about his experience moving to a dedicated server for WebSiteOptimization.com.
Speed Tweak, Oct. 4, 2004.