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

Can not work with Jetty 7, 8, 9 when use -H 'Connection: Close' for non-keepAlive benchmark #118

Closed
xfeep opened this issue Jan 29, 2015 · 4 comments

Comments

@xfeep
Copy link

xfeep commented Jan 29, 2015

 wrk -c 1  -t 1 -d 10s  -H 'Connection: Close' http://127.0.0.1:8082
Running 10s test @ http://127.0.0.1:8082
  1 threads and 1 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency     0.00us    0.00us   0.00us    -nan%
    Req/Sec     0.00      0.00     0.00      -nan%
  0 requests in 10.00s, 50.31MB read
  Socket errors: connect 0, read 40117, write 0, timeout 0
Requests/sec:      0.00
Transfer/sec:      5.03MB

But both ab and curl are OK.

@wg
Copy link
Owner

wg commented Jan 30, 2015

Hi @xfeep, is Jetty returning an error response when you hit 'http://127.0.0.1:8082'?
If so there's a bug where I need to pass EOF through to the parser, I'll commit a fix soon.

@xfeep
Copy link
Author

xfeep commented Jan 30, 2015

Hi @wg Thanks for your quick reply.
when we use curl or apache ab to access this url 'http://127.0.0.1:8082' , everything is OK without any errors.

Here is curl 's result

curl -v -H 'Connection: Close' http://127.0.0.1:8082
* About to connect() to 127.0.0.1 port 8082 (#0)
*   Trying 127.0.0.1...
* Connected to 127.0.0.1 (127.0.0.1) port 8082 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: 127.0.0.1:8082
> Accept: */*
> Connection: Close
> 
< HTTP/1.1 200 OK
< Date: Sun, 25 Jan 2015 02:29:33 GMT
< Content-Type: text/html;charset=ISO-8859-1
< Connection: close
< Server: Jetty(7.6.13.v20130916)
> .........1K size of content omited...........

If we remove the -H 'Connection: Close' , wrk is also OK without any errors.

@wg
Copy link
Owner

wg commented Jan 30, 2015

Thanks for the quick response! That's odd, I can't reproduce the issue with a 200 response. Try this patch anyway:

index b4741c7..fb093bb 100644
--- a/src/net.c
+++ b/src/net.c
@@ -17,7 +17,7 @@ status sock_close(connection *c) {
 status sock_read(connection *c, size_t *n) {
     ssize_t r = read(c->fd, c->buf, sizeof(c->buf));
     *n = (size_t) r;
-    return r > 0 ? OK : ERROR;
+    return r >= 0 ? OK : ERROR;
 }

@xfeep
Copy link
Author

xfeep commented Jan 30, 2015

Thanks for your patch!
It works like a charm!

]$ wrk -c 1  -t 1 -d 10s  -H 'Connection: Close' http://127.0.0.1:8082
Running 10s test @ http://127.0.0.1:8082
  1 threads and 1 connections
  Thread Stats   Avg      Stdev     Max   +/- Stdev
    Latency   116.81us  283.83us  10.77ms   99.88%
    Req/Sec     4.62k   373.14     5.33k    68.42%
  43311 requests in 10.00s, 54.32MB read
Requests/sec:   4331.17
Transfer/sec:      5.43MB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants