Benchmarking web page is totally different stuff and is in another post. This is for small single server setup. Multiple server with load balancers and other extras are not covered.
There are different aspects of benchmarking- total speed, handshake, PHP (and/or additional) scripts, DB access, etc.
Benchmarking is usually related to optimization, but sometimes it is just to check if the things look ok and not necessarily intend some optimizations.
AB (Apache Bench) is easy to use tool that offers some basic but usefull testing methods.
The most advertised metric is the connection speed (mega bytes per second or mega bits per second). It is tempting to use just the speed, but there is some overhead when encryption is on, when scripts are executed, when multiple small files are requested, if there is blocking somewhere in the middle, etc.
There are multiple web pages for speed tests and they are usually advertised by the internet service providers.
Next metric is connect and fetch. Usually most impactful is HTTP vs HTTPS for small files, because there is additional overhead.
In order not to confuse the conection speed (MB/s or Mb/s) with the connection rate (requests per second) two different words are used in this article.
Static vs dynamic file also has big impact.
Simplified network connectivity is shown on the Home Lab post. There are some additional tricks for the network, but the network is another topic, and as the tests are performed locally, the network will be ignored.
The following table shows some basic tests of the current web server.
Oli (10k – no S) | Olimex using 10kB files without HTTPS |
Oli (10k – S) | Olimex using 10kB files with HTTPS encryption |
Oli (10M) | Olimex 10MB with HTTPS encryption |
dy (10k – no S) | old HP laptop with 10kB files without encryption |
dy (10k – S) | old HP laptop with 10kB files with HTTPS encryption |
dy (10M) | old HP laptop with 10MB files with HTTPS encryption |
oVM (10k) | virtual machine on same hypervisor with 10kB files no HTTPS encryption |
oVM (10M) | virtual machine on same hypervisor with 10MB files no HTTPS encryption |
loop S ext IP | loopback via the external IP with 10kB files with HTTPS encryption |
loop ext IP | loopback via the external IP with 10kB files without encryption |
loop local IP | loopback using the local network IP with 10kB files without encryption |
loop int IP | loopback using the 127 IP with 10kB files without encryption |
____________ | Oli (10k – no S) | Oli (10k – S) | Oli (10M) | dy (10k – no S) | dy (10k – S) | dy (10M) | oVM (10k – no S ext IP) | oVM (10M – no S ext IP) | oVM (10k – S) | oVM (10M – S) | loop (10k – S, ext IP) | loop (10k – no S, ext IP) | loop (10M – S ext IP) | loop 10k-S, int IP | loop 10k – no S int IP |
keep alive on, con 1 | 190 2.2 | 69 0.8 | 0.6 6.6 | 161 1.9 | 120 1.4 | 0.5 5.7 | 166 2 | 0.9 10 | 122 1.4 | 0.9 9.7 | 122 1.4 | 134 1.6 | 0.7 8.3 | ||
keep alive on, con 10 | 520 6.2 | 150 1.8 | 0.5 6.6 | 420 4.9 | 377 4.5 | 0.5 5.7 | 551 6.6 | 0.8 9.5 | 651 7.8 | 0.9 9.4 | 656 8 | 280 3.3 | 0.4 6.6 | ||
keep alive off, con 1 | 120 1.4 | 7 70k/s | 0.6 6.2 | 109 1.3 | 20 247k/s | 0.5 5.5 | 104 1.2 | 0.8 9 | 20 244k/s | 0.8 8.8 | 19 222k/s | 90 1 | 0.6 7.7 | 280 3.3 | |
keep alive off, con 10 | 313 3.7 | 11 130k/s | 0.3 6.6 | 280 3.3 | 205 2.4 | 0.5 5.7 | 390 4.6 | 0.8 8.7 | 191 2.2 | 0.8 8.6 | 163 2 | 258 3.1 | 0.4 7 | 226 2.7 | 1700 20 |
For the 10MB files the total transfer rate is more important and for the 10kB files the transfers per second for small files.
If encryption is used, then the encryption is limiting factor. If no encryption is used, then the client connection is limiting.
.html file | .jpg file | .php file nothing to process | .php file empty <?php ?> structure | php single append to file or write to file several bytes | php simple read from another SQL server using ODBC. SQL is MS SQL on Ubuntu | same SQL read but using just 1 connection with conn closing | single SQL read 1 conn and without closing | single SQL conn to WIN hosted MS SQL | single SQL conn to WIN hosted MS SQL with 5 selects | single SQL conn to WIN hosted MS SQL with 5 selects, but without order in SQL query | 10 connections SQL conn to WIN hosted MS SQL | WordPress plugin cached start page, single connection | WordPress without cache plugin, single connection | WordPress plugin cached page, 10 connections | WordPress without cache plugin, 10 connections | |
speed req/s for 10k without encryption and 10 connections | 1700 | 1800 | 1500 | 1450 | 1100 | 100 | 62 | 43 | 35 | 22 | 30 | 67 | 93 | 3 | 589 | 10 |
So as conclusion:
- the HTTPS connection difference is noticeble when comparing low and high power devices, but at the same time HTTP only is nearly the same;
- the main restriction is the HTTPS handshake;
- the connection speed is limiting factor when bigger files are transfered;
- when using DB on external server the rate drops significantly;
- WordPress cache plugin can help a lot for not overloaded pages (cache filling/overloading and flushing are not yet tested)
- the concurent connections usually increase the request per second rate as the server is not fully utilized.
A small trick was used to check the internal (192.168… and 127.0…) IPs- the IPs were entered in the hosts file, so the HTTPS trafic gets correctly recognized (SNI) but arbitrary IP/subnet can be used.
Used test machines:
- Oli / Olimex – 10 year old single board ARM PC (manufactured 2014)
- dy – probably also 10 year old HP laptop (will check later)
- oVM – another VM on the same “server” as the web server
- the webserver is virtual machine running on mini PC (assembled 4 years ago-2020)
- for the MS SQL connections 2 different VMs were used. Compare is not relevant- the Ubuntu VM is relatively clean and the Windows VM has also AD DC, IIS and other running programs. The 2 VMs have different RAM and CPU settings. But the results are similar.
Network schematic follows. It will be additionally described later, because for example the old laptop coes the following path (internal net) MBE router-> (internal net) GBE router-> (external net) ISP switch->(external net)MBE router-> (internal net) GBE router->(internal net) GBE switch-> (internal net) hypervisor switch. The “ext IP loop” for the web server goes hypervisor switch->GBE switch-> GBE router->ISP switch-> MBE router-> GBE router->GBE switch-> hypervisor switch.
So the old laptop has 2 connections that are over 100MB/s and the “ext IP loop” has only one.