Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

quick sketch with lighttpd configs #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bench.nix
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
enableModules = [ "mod_magnet" ];
document-root = "${pkgs.static-html}";
extraConfig = ''
magnet.attract-physical-path-to = ( "${luaScript}" )
magnet.attract-raw-url-to = ( "${luaScript}" )
'';
};
}
1 change: 1 addition & 0 deletions bench.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ test_concurrency=${VUS:-200}
declare -A proxies
proxies[caddy]=Caddyfile
proxies[nginx]=nginx.conf
proxies[lighttpd]=nginx.conf

declare -A tests
tests[synthetic]=''
Expand Down
3 changes: 3 additions & 0 deletions conf/lighttpd/default/html
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
server.port = 8080
server.document-root = "/srv/static"
mimetype.assign = (".html" => "text/html", ".js" => "text/javascript")
1 change: 1 addition & 0 deletions conf/lighttpd/default/html_large
1 change: 1 addition & 0 deletions conf/lighttpd/default/html_small
6 changes: 6 additions & 0 deletions conf/lighttpd/default/proxy
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
server.port = 8080
server.document-root = "/srv/static"
mimetype.assign = (".html" => "text/html", ".js" => "text/javascript")

server.modules += ("mod_proxy")
proxy.server = ( "" => (( "host" => "127.0.0.1", "port" => 8081 )))
6 changes: 6 additions & 0 deletions conf/lighttpd/default/synthetic
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
server.port = 8080
server.document-root = "/srv/static"
mimetype.assign = (".html" => "text/html", ".js" => "text/javascript")

server.modules += ("mod_magnet")
magnet.attract-raw-url-to = ("/srv/static/hello_world.lua")
39 changes: 39 additions & 0 deletions conf/lighttpd/optimized/html
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
server.port = 8080
server.document-root = "/srv/static"
mimetype.assign = (".html" => "text/html", ".js" => "text/javascript")

server.modules += ("mod_staticfile")


# benchmarking: handle large number (10k) of simultaneous connections
# lighttpd uses slightly less memory when these are tuned smaller
server.max-fds = 32768
server.max-connections = 10000

# benchmarking: allow up to 64k-1 requests on the same connection (default:1000)
server.max-keep-alive-requests = 65535

# benchmarking: tune to number of CPUs if > 1 and only if lighttpd is CPU-bound
server.max-worker = 4


# benchmarking micro-optimization: load only server.modules; no default modules
server.compat-module-load = "disable"

# benchmarking micro-optimization: omit "Server" response header
server.tag = ""

# benchmarking micro-optimization: omit "Accept-Ranges: bytes" response header
# (prefer to allow for production website; Range is generally desirable)
server.range-requests = "disable"

# benchmarking micro-optimization: omit "ETag" response header from static files
# (prefer to skip these for production website; ETag is generally desirable)
etag.use-inode = "disable"
etag.use-mtime = "disable"
etag.use-size = "disable"

# benchmarking micro-optimization: omit "Last-Modified" response header from
# static files by not assigning Content-Type; default "application/octet-stream"
# (not done)
#mimetype.assign := ()
1 change: 1 addition & 0 deletions conf/lighttpd/optimized/html_large
1 change: 1 addition & 0 deletions conf/lighttpd/optimized/html_small
30 changes: 30 additions & 0 deletions conf/lighttpd/optimized/proxy
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
server.port = 8080
server.document-root = "/srv/static"
mimetype.assign = (".html" => "text/html", ".js" => "text/javascript")

server.modules += ("mod_proxy")
proxy.server = ( "" => (( "host" => "127.0.0.1", "port" => 8081 )))
# FYI: lighttpd can also reverse-proxy to a (faster) unix domain socket


# benchmarking: handle large number (10k) of simultaneous connections
# lighttpd uses slightly less memory when these are tuned smaller
server.max-fds = 32768
server.max-connections = 10000

# benchmarking: allow up to 64k-1 requests on the same connection (default:1000)
server.max-keep-alive-requests = 65535

# benchmarking: tune to number of CPUs if > 1 and only if lighttpd is CPU-bound
server.max-worker = 4


# benchmarking micro-optimization: load only server.modules; no default modules
server.compat-module-load = "disable"

# benchmarking micro-optimization: omit "Server" response header
server.tag = ""

# benchmarking micro-optimization: omit "Accept-Ranges: bytes" response header
# (prefer to allow for production website; Range is generally desirable)
server.range-requests = "disable"
29 changes: 29 additions & 0 deletions conf/lighttpd/optimized/synthetic
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
server.port = 8080
server.document-root = "/srv/static"
mimetype.assign = (".html" => "text/html", ".js" => "text/javascript")

server.modules += ("mod_magnet")
magnet.attract-raw-url-to = ("/srv/static/hello_world.lua")


# benchmarking: handle large number (10k) of simultaneous connections
# lighttpd uses slightly less memory when these are tuned smaller
server.max-fds = 32768
server.max-connections = 10000

# benchmarking: allow up to 64k-1 requests on the same connection (default:1000)
server.max-keep-alive-requests = 65535

# benchmarking: tune to number of CPUs if > 1 and only if lighttpd is CPU-bound
server.max-worker = 4


# benchmarking micro-optimization: load only server.modules; no default modules
server.compat-module-load = "disable"

# benchmarking micro-optimization: omit "Server" response header
server.tag = ""

# benchmarking micro-optimization: omit "Accept-Ranges: bytes" response header
# (prefer to allow for production website; Range is generally desirable)
server.range-requests = "disable"
14 changes: 13 additions & 1 deletion postprocess.jq
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
duration: .[2].metrics.http_req_duration.values,
fail_rate: .[2].metrics.http_req_failed.values.rate,
ttfb: .[2].metrics.http_req_waiting.values
},
lighttpd: {
requests: .[2].metrics.http_reqs.values.count,
duration: .[2].metrics.http_req_duration.values,
fail_rate: .[2].metrics.http_req_failed.values.rate,
ttfb: .[2].metrics.http_req_waiting.values
}
},
synthetic: {
Expand All @@ -25,6 +31,12 @@
duration: .[3].metrics.http_req_duration.values,
fail_rate: .[3].metrics.http_req_failed.values.rate,
ttfb: .[3].metrics.http_req_waiting.values
},
lighttpd: {
requests: .[3].metrics.http_reqs.values.count,
duration: .[3].metrics.http_req_duration.values,
fail_rate: .[3].metrics.http_req_failed.values.rate,
ttfb: .[3].metrics.http_req_waiting.values
}
}
}
}
26 changes: 25 additions & 1 deletion resources.gp
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,28 @@ plot nginx_optimized_html_large_baseline using 1:2 smooth csplines, \
nginx_optimized_proxy_baseline using 1:2 smooth csplines, \
nginx_optimized_proxy_baseline using 1:3 axes x1y2 smooth csplines, \
nginx_optimized_synthetic_baseline using 1:2 smooth csplines, \
nginx_optimized_synthetic_baseline using 1:3 axes x1y2 smooth csplines
nginx_optimized_synthetic_baseline using 1:3 axes x1y2 smooth csplines

set title sprintf("Resource Utilization - lighttpd - Default - %s clients", par) enhanced font ",16" tc rgb "white"
set origin 0,0.5
set size 0.5,0.5
plot lighttpd_default_html_large_baseline using 1:2 smooth csplines, \
lighttpd_default_html_large_baseline using 1:3 axes x1y2 smooth csplines, \
lighttpd_default_html_small_baseline using 1:2 smooth csplines, \
lighttpd_default_html_small_baseline using 1:3 axes x1y2 smooth csplines, \
lighttpd_default_proxy_baseline using 1:2 smooth csplines, \
lighttpd_default_proxy_baseline using 1:3 axes x1y2 smooth csplines, \
lighttpd_default_synthetic_baseline using 1:2 smooth csplines, \
lighttpd_default_synthetic_baseline using 1:3 axes x1y2 smooth csplines

set title sprintf("Resource Utilization - lighttpd - Optimized - %s clients", par) enhanced font ",16" tc rgb "white"
set origin 0.5,0.5
set size 0.5,0.5
plot lighttpd_optimized_html_large_baseline using 1:2 smooth csplines, \
lighttpd_optimized_html_large_baseline using 1:3 axes x1y2 smooth csplines, \
lighttpd_optimized_html_small_baseline using 1:2 smooth csplines, \
lighttpd_optimized_html_small_baseline using 1:3 axes x1y2 smooth csplines, \
lighttpd_optimized_proxy_baseline using 1:2 smooth csplines, \
lighttpd_optimized_proxy_baseline using 1:3 axes x1y2 smooth csplines, \
lighttpd_optimized_synthetic_baseline using 1:2 smooth csplines, \
lighttpd_optimized_synthetic_baseline using 1:3 axes x1y2 smooth csplines
3 changes: 3 additions & 0 deletions static/hello_world.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
--lighty.r.resp_header["Content-Type"] = "text/plain" -- omit for benchmarking
lighty.r.resp_body.set("Hello, world!")
return 200