You are not logged in.

#1 2013-11-04 14:05:32

aurelieng
Member
Registered: 2010-02-02
Posts: 104

[SOLVED] lighttpd reverse-proxy'ing Apache2: very slow :S

Hi all,

I'm seeing something strange on my HTTP server: I have lighttpd installed as a reverse proxy for Apache2, which serves a simple website in PHP. Lighttpd and Apache2 both run in 2 distinct OpenVZ containers, on the same hardware node. And it's _slow_.

I suspect that there is a problem somewhere because when i bypass the reverse proxy (thanks to ssh -d + foxyproxy), the website is almost 10 times faster (thanks apache bench). I guess the problem may come from the configuration of Lighttpd. Here's a the relevant part of lighttpd.conf:

    $HTTP["host"] == "XXXXXXXXXXXX" {
      $SERVER["socket"] == "0.0.0.0:443" {
        ssl.pemfile = "/etc/lighttpd/certs/XXXXXXXXXXXX.pem"
      }
      proxy.server  = ( "" => ( ( "host" => "X.Y.Z.T", "port" => 80 ) ) )
    }

The network tab of firebug reveals a 5s delay for the connection to be establish when some files are requested. There is no such delay when I connect directly (well, through ssh -d + foxyproxy), and the website is much faster.

Any suggestions of things I can test ? Any idea ?

Thanks a lot!

Aurel.

Last edited by aurelieng (2013-11-04 16:13:04)

Offline

#2 2013-11-04 16:14:32

aurelieng
Member
Registered: 2010-02-02
Posts: 104

Re: [SOLVED] lighttpd reverse-proxy'ing Apache2: very slow :S

I just found the problem: Apache2 had a  KeepAliveTimeout set to 5s. Setting it to 0 restored the expected performance.

KeepAliveTimeout: Number of seconds to wait for the next request from the same client on the same connection.

Since all requests are coming from the reverse proxy, better not to wait.

Aurel.

Offline

Board footer

Powered by FluxBB