mirror of
https://github.com/hyperknot/openfreemap.git
synced 2026-05-21 14:02:15 +00:00
benchmark
This commit is contained in:
37
docs/http_benchmark.md
Normal file
37
docs/http_benchmark.md
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
### wrk localhost
|
||||||
|
|
||||||
|
clean cache after nginx restart
|
||||||
|
|
||||||
|
```
|
||||||
|
service nginx restart
|
||||||
|
wrk -c10 -t4 -d60s -s /data/ofm/benchmark/wrk_custom_list.lua http://localhost
|
||||||
|
Running 1m test @ http://localhost
|
||||||
|
4 threads and 10 connections
|
||||||
|
Thread Stats Avg Stdev Max +/- Stdev
|
||||||
|
Latency 2.02ms 7.04ms 50.43ms 93.23%
|
||||||
|
Req/Sec 8.42k 2.01k 18.52k 69.79%
|
||||||
|
2871265 requests in 1.00m, 230.65GB read
|
||||||
|
Requests/sec: 47811.00
|
||||||
|
Transfer/sec: 3.84GB
|
||||||
|
```
|
||||||
|
|
||||||
|
Super much overkill, we'd only need 125 MB/s for Gigabit connection and this is 3840 MB/s.
|
||||||
|
Also max request time is super nice + no errors.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### wrk over network
|
||||||
|
|
||||||
|
```
|
||||||
|
wrk -c10 -t4 -d60s -s /data/ofm/benchmark/wrk_custom_list.lua http://x.x.x.x
|
||||||
|
Running 1m test @ http://144.76.168.195
|
||||||
|
4 threads and 10 connections
|
||||||
|
Thread Stats Avg Stdev Max +/- Stdev
|
||||||
|
Latency 7.57ms 6.61ms 45.34ms 84.32%
|
||||||
|
Req/Sec 293.85 141.33 1.18k 73.07%
|
||||||
|
71628 requests in 1.00m, 6.05GB read
|
||||||
|
Requests/sec: 1191.88
|
||||||
|
Transfer/sec: 103.01MB
|
||||||
|
```
|
||||||
|
|
||||||
|
Realistically this is the max over Gigabit connection.
|
||||||
@@ -8,11 +8,8 @@ fs.file-max # not needed, recent Ubuntu has it on high by default
|
|||||||
tcp_fin_timeout
|
tcp_fin_timeout
|
||||||
TCP max buffer size
|
TCP max buffer size
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
net.core.netdev_max_backlog = 262144
|
net.core.netdev_max_backlog = 262144
|
||||||
net.core.rmem_max = 16777216
|
net.core.rmem_max = 16777216
|
||||||
net.core.somaxconn = 262144
|
|
||||||
net.core.wmem_max = 16777216
|
net.core.wmem_max = 16777216
|
||||||
net.ipv4.tcp_max_syn_backlog = 262144
|
net.ipv4.tcp_max_syn_backlog = 262144
|
||||||
net.ipv4.tcp_max_tw_buckets = 6000000
|
net.ipv4.tcp_max_tw_buckets = 6000000
|
||||||
|
|||||||
@@ -16,6 +16,9 @@ gzip_proxied any; # no proxying
|
|||||||
types_hash_max_size 2048; # default should be good for the default set
|
types_hash_max_size 2048; # default should be good for the default set
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# not tested
|
# not tested
|
||||||
|
|
||||||
client_body_buffer_size 128k;
|
client_body_buffer_size 128k;
|
||||||
@@ -23,21 +26,5 @@ client_max_body_size 128k;
|
|||||||
client_header_buffer_size 1k;
|
client_header_buffer_size 1k;
|
||||||
large_client_header_buffers 2 1k;
|
large_client_header_buffers 2 1k;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# SSL optimizations
|
|
||||||
SSL Session Cache
|
|
||||||
SSL OCSP Stapling
|
|
||||||
ssl_session_cache shared:SSL:10m;
|
|
||||||
ssl_session_timeout 10m;
|
|
||||||
ssl_prefer_server_ciphers on;
|
|
||||||
|
|
||||||
client_header_timeout 12; # default is 60
|
client_header_timeout 12; # default is 60
|
||||||
|
|
||||||
|
|
||||||
location / {
|
|
||||||
try_files $uri =404;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ from dotenv import dotenv_values
|
|||||||
from fabric import Config, Connection
|
from fabric import Config, Connection
|
||||||
|
|
||||||
from ssh_lib import CONFIG_DIR, HTTP_HOST_BIN, OFM_DIR, REMOTE_CONFIG, SCRIPTS_DIR, TILE_GEN_BIN
|
from ssh_lib import CONFIG_DIR, HTTP_HOST_BIN, OFM_DIR, REMOTE_CONFIG, SCRIPTS_DIR, TILE_GEN_BIN
|
||||||
from ssh_lib.benchmark import c1000k
|
from ssh_lib.benchmark import c1000k, wrk
|
||||||
from ssh_lib.kernel import kernel_tweaks_ofm
|
from ssh_lib.kernel import kernel_tweaks_ofm
|
||||||
from ssh_lib.nginx import certbot, nginx
|
from ssh_lib.nginx import certbot, nginx
|
||||||
from ssh_lib.pkg_base import pkg_base, pkg_upgrade
|
from ssh_lib.pkg_base import pkg_base, pkg_upgrade
|
||||||
@@ -91,7 +91,6 @@ def prepare_tile_gen(c):
|
|||||||
def prepare_http_host(c, skip_cron: bool):
|
def prepare_http_host(c, skip_cron: bool):
|
||||||
nginx(c)
|
nginx(c)
|
||||||
certbot(c)
|
certbot(c)
|
||||||
c1000k(c)
|
|
||||||
|
|
||||||
c.sudo('rm -rf /data/ofm/http_host/logs')
|
c.sudo('rm -rf /data/ofm/http_host/logs')
|
||||||
c.sudo('mkdir -p /data/ofm/http_host/logs')
|
c.sudo('mkdir -p /data/ofm/http_host/logs')
|
||||||
@@ -130,8 +129,14 @@ def upload_certificates(c):
|
|||||||
c.sudo('chown -R nginx:nginx /data/nginx')
|
c.sudo('chown -R nginx:nginx /data/nginx')
|
||||||
|
|
||||||
|
|
||||||
|
def install_benchmark(c):
|
||||||
|
c1000k(c)
|
||||||
|
wrk(c)
|
||||||
|
|
||||||
|
|
||||||
def debug_tmp(c):
|
def debug_tmp(c):
|
||||||
upload_https_host_files(c)
|
install_benchmark(c)
|
||||||
|
# upload_https_host_files(c)
|
||||||
# put(c, SCRIPTS_DIR / 'http_host' / 'cron.d' / 'ofm_http_host', '/etc/cron.d/')
|
# put(c, SCRIPTS_DIR / 'http_host' / 'cron.d' / 'ofm_http_host', '/etc/cron.d/')
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
wrk -c1000 -d10s -t1 -s /data/ofm/benchmark/wrk_custom_list.lua http://localhost
|
|
||||||
|
|
||||||
# -t1 - needs to be single treaded, otherwise the urls would be read not in sequence
|
|
||||||
|
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
local counter = 1
|
local counter = 1
|
||||||
local lines = {}
|
local lines = {}
|
||||||
local base_path = "/planet/20231208_091355/tiles/"
|
local url_base = "/planet/20231221_134737_pt/" -- trailing slash
|
||||||
local file_path = "/data/ofm/benchmark/path_list_100k.txt"
|
local path_list_txt = "/data/ofm/benchmark/path_list_500k.txt"
|
||||||
|
|
||||||
for line in io.lines(file_path) do
|
for line in io.lines(path_list_txt) do
|
||||||
table.insert(lines, base_path .. line)
|
table.insert(lines, url_base .. line)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function getNextUrl()
|
local function getNextUrl()
|
||||||
|
|||||||
8
scripts/http_host/benchmark/wrk_usage.txt
Normal file
8
scripts/http_host/benchmark/wrk_usage.txt
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
wrk -c10 -t4 -d10s -s /data/ofm/benchmark/wrk_custom_list.lua http://localhost
|
||||||
|
|
||||||
|
# -t1 => more correct, since the url list is loaded exactly in sequence
|
||||||
|
# -t4 => reflecting real world usage
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@@ -17,9 +17,7 @@ def c1000k(c):
|
|||||||
# make sure it runs till 1 million
|
# make sure it runs till 1 million
|
||||||
|
|
||||||
|
|
||||||
def benchmark(c):
|
def wrk(c):
|
||||||
apt_get_install(c, 'wrk')
|
apt_get_install(c, 'wrk')
|
||||||
c.sudo('mkdir -p /data/ofm/benchmark')
|
c.sudo('mkdir -p /data/ofm/benchmark')
|
||||||
put(c, f'{SCRIPTS_DIR}/http_host/benchmark/wrk_custom_list.lua', '/data/ofm/benchmark')
|
put(c, f'{SCRIPTS_DIR}/http_host/benchmark/wrk_custom_list.lua', '/data/ofm/benchmark')
|
||||||
|
|
||||||
# wrk -c10 -d10s -t1 -s /data/ofm/benchmark/wrk_custom_list.lua http://localhost
|
|
||||||
|
|||||||
Reference in New Issue
Block a user