Hi all,

Le jeudi 9 d??cembre 2010 07:40:20, ?????? a ??crit :
> My english is very poor. If nginx proxy server is front of haproxy
> server with option http-pretent-keeplive , the requests become very
> slow. But is normal of direct request to haproxy server .
> please help me.
> Changrong.zhou

I think I could reproduce the same issue, with and whithout nginx, with this 
short configuration sample (with KeepAliveTimeout 15 on the apache backend) :
listen close_test :8080
        mode http
        option httpclose
        option http-pretend-keepalive
        server www localhost:80

listen tunnel_test :8081
        mode http
        option http-pretend-keepalive
        server www localhost:80

Both have problems nginx (unless I disabled buffering in nginx).
But it's also reproducible with ab :
$ ab -n1 http://localhost:8080/
Time taken for tests:   15.017 seconds

$ ab -n1 http://localhost:8081/
Time taken for tests:   15.016 seconds

$ ab -n1 http://localhost:8082/
Time taken for tests:   15.016 seconds

It appeared with this commit : 
http://haproxy.1wt.eu/git?p=haproxy-1.4.git;a=commit;h=2be7ec90fa9caf66294f446423bbab2d00db9004

Willy, can you review the patch below to see if it's the right approach ?
Thanks ;-)

--- haproxy-1.4.10/src/proto_http.c     2010-11-29 07:36:47.000000000 +0100
+++ haproxy-1.4.10-ka/src/proto_http.c  2010-12-25 21:58:29.943435278 +0100
@@ -3057,9 +3057,11 @@
        del_cl = del_ka = 0;
 
        if ((!(txn->flags & TX_HDR_CONN_PRS) &&
-            (s->fe->options & (PR_O_KEEPALIVE|PR_O_SERVER_CLO|PR_O_HTTP_CLOSE|
PR_O_FORCE_CLO))) ||
+            (s->fe->options & (PR_O_KEEPALIVE|PR_O_SERVER_CLO|PR_O_HTTP_CLOSE|
PR_O_FORCE_CLO)) ||
+            (s->fe->options2 & PR_O2_FAKE_KA)) ||
            ((s->fe->options & (PR_O_KEEPALIVE|PR_O_SERVER_CLO|PR_O_HTTP_CLOSE|
PR_O_FORCE_CLO)) !=
-            (s->be->options & (PR_O_KEEPALIVE|PR_O_SERVER_CLO|PR_O_HTTP_CLOSE|
PR_O_FORCE_CLO)))) {
+            (s->be->options & (PR_O_KEEPALIVE|PR_O_SERVER_CLO|PR_O_HTTP_CLOSE|
PR_O_FORCE_CLO))) ||
+           ((s->fe->options2 & PR_O2_FAKE_KA) != (s->be->options & 
PR_O2_FAKE_KA))) {
                int tmp = TX_CON_WANT_TUN;
 
                if ((s->fe->options|s->be->options) & PR_O_KEEPALIVE)
@@ -3086,7 +3088,8 @@
 
                /* check if client or config asks for explicit close in KAL/SCL 
*/
                if (((txn->flags & TX_CON_WANT_MSK) == TX_CON_WANT_KAL ||
-                    (txn->flags & TX_CON_WANT_MSK) == TX_CON_WANT_SCL) &&
+                    (txn->flags & TX_CON_WANT_MSK) == TX_CON_WANT_SCL ||
+                    ((s->fe->options2|s->be->options2) & PR_O2_FAKE_KA)) &&
                    ((txn->flags & TX_HDR_CONN_CLO) ||                         
/* 
"connection: close" */
                     (txn->flags & (TX_REQ_VER_11|TX_HDR_CONN_KAL)) == 0 ||    
/* no 
"connection: k-a" in 1.0 */
                     (((s->fe->options|s->be->options) & PR_O_HTTP_CLOSE) &&   
/* 
httpclose without pretend-ka... */

-- 
Cyril Bont??

Reply via email to