Hi,

On Fri, Apr 25, 2014 at 02:51:36AM +0000, Stefan wrote:
> Hello,
> 
> I'm stuck with one issue. Can you help me, please.
> 
> I have a service that gets about 1K connections/second 
> and 15K requests/sec in top. 
> And my service should response maximum in 120 ms.
> The client, that sends me these requests within keep-alive connection.
> 
> But i have a lot of 400 and 408 errors.
> Example:
> ... <NOSRV> -1/-1/-1/-1/50185 408 212 - - 
>                     cR-- 5236/1728/0/0/0 0/0 "<BADREQ>"
> ... <NOSRV> -1/-1/-1/-1/13282 400 187 - - 
>                    CR-- 5169/3506/0/0/0 0/0 "<BADREQ>"
> 
> >From the docs, i found the explanation of these errors:
> - for the first one:
>        he client never completed its request, which was aborted by the
>        time-out ("c---") after 50s, while the proxy was waiting for the 
> request
>        headers ("-R--").  Nothing was sent to any server, but the proxy could
>        send a 408 return code to the client.
> - for the second one: 
>        the client never completed its request and aborted itself ("C---") 
> after
>        8.5s, while the proxy was waiting for the request headers ("-R--").
>        Nothing was sent to any server.
> 
> As i understand here, the client established connection 
> and in first case didn't send any request 
> during 50 sec (i'm closing the connection with 408 code). 
> And in second case the client aborting 
> connection during which no request was send.

Unfortunately, this has became the new norm for all of us after Google Chrome
invented the pre-connect feature. It decides to connect to web sites you
recently visited just in case you'd want to go there. And it litterally
kills the internet by establishing tons of useless connections to many
web sites, some of which cannot cope with the load and who have to shrink
their request timeouts. At least on haproxy, you can :

   1) lower the HTTP request timeout : "timeout http-request 5s"
   2) disable logging of empty requests : "option dontlognull"

It's a real disaster but they find it beneficial for end user's
experience. I believe Firefox does the same now :-(

> May be my settings (e.g. sysctl.conf or something else) 
> are not optimized for such load?

Your settings look really fine.

> And the main problem is that i'm not a system administrator, 
> i'm a developer ((( 
> But for the last couple of months i had to read so many docs )))

It seems you read the right docs :-)

> Another question:
> Is it possible to abort request with code 204 
> if it takes more than some time (e.g. 120 ms)?

It's 408 which is expected when the request does not come, not 204. If
for any reason you want to send a different code, you can rewrite the
error message using "errorfile 408". If you want to abort the request
processing on the server, you can simply use "timeout server 120" and
then an error 504 will be emitted. Similarly if you want to change that
error code, you can do it using "errorfile 504".

But I'd really advise you against changing the standard HTTP status
codes for error cases.  For example, 204 cannot report any message
since it forbids any contents.

Regards,
Willy

Reply via email to