Closed gnat closed 7 months ago
Hi @gnat! Thanks for filing the first issue.
Im also excited with what's possible by using wsgi in Caddy.
I was able to reproduce the problem from your comment. The root cause was that I was calling WriteHeader
before setting the user provided headers.
I pushed the fix to main
branch and I can confirm that it works as intended now by doing the following:
$ CGO_ENABLED=1 xcaddy build --with github.com/mliezun/caddy-snake@main
$ ./caddy run --config Caddyfile
$ curl -i http://localhost:9080/
HTTP/1.1 200 OK
Content-Type: text/plain
Hello: World
Server: Caddy
Date: Sun, 18 Feb 2024 15:59:14 GMT
Content-Length: 48
Hello World 2e924ad4-9070-4623-9ce1-fa55bd1a2f30
Can you confirm in your end that it works as intended?
I also ran similar benchmarks and got around 6k requests/s on my machine. 😎
With gunicorn out of the box I got 1000 requests/s. Nonetheless gunicorn can be tweaked to be more performant.
Still, this is just a simple test and not indicative of real world applications performance.
Yup, that was it. Cheers @mliezun !!
First, awesome, awesome project. Thank you!!
Amazing to finally get an alternative to
mod_wsgi
, specifically for Caddy! Kudos.Been playing around with caddy-snake on Ubuntu, performance is pretty awesome under load for a WSGI server. (using hey:
ulimit -n 1000000; ./hey -z 10s -c 1000 http://127.0.0.1:9080/
) getting 6,000+ requests/sec on 16 thread machine. Not too shabby!First thing I tried was to set a custom header, which didn't seem to work.
Seems like Chrome is auto-converting to
text/html
as well after including<br>
in the response.