We make a lot of HTTP requests. Recently, we've started thinking about optimizations at the OS level to make more requests from a single machine.
In order to check the performance of our OS, I've created a small benchmark to compare things on different machines.
The benchmark uses curl -w
like that:
#!/bin/bash
for (( ; ; ))
do
curl $URL -o /dev/null -s -w "SIZE: %{size_download} SPEED: %{speed_download} LOOKUP: %{time_namelookup} CONNECT: %{time_connect} START: %{time_starttransfer} TOTAL: %{time_total}\n"
done
Now I ran it for for 1 single URL. The results are as follows: From my local dev machine (connected with Fiber):
SPEED (b/sec) LOOKUP CONNECT START TOTAL
13,331.2481 0.0022 0.0228 0.2163 0.2175
On one of our production servers (with XEN virtualization), the results are slightly different:
SPEED (b/sec) LOOKUP CONNECT START TOTAL
22,764.7700 0.0093 0.0455 0.1318 0.1334
And on another unrelated server, without XEN virtualization (different data center, different continent, further from the resource)
SPEED (b/sec) LOOKUP CONNECT START TOTAL
32,821.3569 0.0004 0.0080 0.1608 0.1672
As you can see the performance on our production server is far from satisfying. The data transfer rate is faster than on my local laptop, but latency is killing us. Since we fetch HTTP resources whose size is rather small, we need to optimize this latency.
Any idea where to start?
UPDATE: this is not about scaling a web server. It's about scaling web requests.