[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [libmicrohttpd] HTTP/1.0 and keep-alive
From: |
Christian Grothoff |
Subject: |
Re: [libmicrohttpd] HTTP/1.0 and keep-alive |
Date: |
Wed, 01 Jan 2014 21:51:18 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20131103 Icedove/17.0.10 |
On 12/28/2013 08:43 PM, Oleg Romanenko wrote:
> Hello!
> I have tested HTTP/1.1 with keep-alive connections and it works fine.
> But for HTTP/1.0 library always close connections, even I add header
> "Connection: keep-alive" to request.
>
> Use telnet for test (server - minimal_example.c):
> address@hidden:~# telnet 127.0.0.1 8888
> Trying 127.0.0.1...
> Connected to 127.0.0.1.
> Escape character is '^]'.
> GET / HTTP/1.0
> Connection: Keep-Alive
> Host: 127.0.0.1:8888
> User-Agent: Test
> Accept: */*
>
> HTTP/1.0 200 OK
> Content-Length: 90
>
> <html><head><title>libmicrohttpd demo</title></head><body>libmicrohttpd
> demo</body></html>Connection closed by foreign host.
>
> So, what should I do to enforce keep-alive for HTTP/1.0 clients like apache
> benchmark etc?
>
Well, the short answer is that this was not possible with MHD 0.9.33. I've
added support to honor client's requests for "Connection: Keep-Alive"
even if the HTTP version is 1.0 in SVN 31776 (a few minutes ago). So this
will be in 0.9.34. With this patch, you can now do:
$ src/examples/demo 8888 &
$ ab -k -n1000000 -c8 http://127.0.0.1:8888/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 100000 requests
Completed 200000 requests
Completed 300000 requests
Completed 400000 requests
Completed 500000 requests
Completed 600000 requests
Completed 700000 requests
Completed 800000 requests
Completed 900000 requests
Completed 1000000 requests
Finished 1000000 requests
Server Software:
Server Hostname: 127.0.0.1
Server Port: 8888
Document Path: /
Document Length: 1167 bytes
Concurrency Level: 8
Time taken for tests: 15.314 seconds
Complete requests: 1000000
Failed requests: 0
Write errors: 0
Keep-Alive requests: 1000000
Total transferred: 1364000000 bytes
HTML transferred: 1167000000 bytes
Requests per second: 65300.98 [#/sec] (mean)
Time per request: 0.123 [ms] (mean)
Time per request: 0.015 [ms] (mean, across all concurrent requests)
Transfer rate: 86982.95 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 1
Processing: 0 0 0.1 0 5
Waiting: 0 0 0.1 0 5
Total: 0 0 0.1 0 5
Percentage of the requests served within a certain time (ms)
50% 0
66% 0
75% 0
80% 0
90% 0
95% 0
98% 0
99% 0
100% 5 (longest request)
For comparison, using Apache 2.2 *default* Debian/stable installation,
I get on the same system:
ab -k -n1000000 -c8 http://127.0.0.1:80/
This is ApacheBench, Version 2.3 <$Revision: 655654 $>
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/
Benchmarking 127.0.0.1 (be patient)
Completed 100000 requests
Completed 200000 requests
Completed 300000 requests
Completed 400000 requests
Completed 500000 requests
Completed 600000 requests
Completed 700000 requests
Completed 800000 requests
Completed 900000 requests
Completed 1000000 requests
Finished 1000000 requests
Server Software: Apache/2.2.22
Server Hostname: 127.0.0.1
Server Port: 80
Document Path: /
Document Length: 177 bytes
Concurrency Level: 8
Time taken for tests: 26.432 seconds
Complete requests: 1000000
Failed requests: 0
Write errors: 0
Keep-Alive requests: 990104
Total transferred: 489564577 bytes
HTML transferred: 177000000 bytes
Requests per second: 37833.29 [#/sec] (mean)
Time per request: 0.211 [ms] (mean)
Time per request: 0.026 [ms] (mean, across all concurrent requests)
Transfer rate: 18087.73 [Kbytes/sec] received
Connection Times (ms)
min mean[+/-sd] median max
Connect: 0 0 0.0 0 1
Processing: 0 0 0.1 0 6
Waiting: 0 0 0.1 0 6
Total: 0 0 0.1 0 6
Percentage of the requests served within a certain time (ms)
50% 0
66% 0
75% 0
80% 0
90% 0
95% 0
98% 0
99% 1
100% 6 (longest request)
Note that the Document Length is different as Apache's default site is
much smaller;
MHD still "wins" by a long shot. However, it should be noted that
Apache was not
tuned in any sense, so this is hardly a scientific comparison, and
merely to
illustrate that MHD performs just fine.
Happy hacking!
Christian
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [libmicrohttpd] HTTP/1.0 and keep-alive,
Christian Grothoff <=