To keep-alive, or not to keep-alive, that is the question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bstillman
    Senior Member
    • Jun 2007
    • 127
    • 3.8.x

    [Forum] To keep-alive, or not to keep-alive, that is the question

    Howdy folks. I have possibly one of the dumbest questions ever for you.

    Why use Apache keep-alive?

    I've read a whole lot of posts saying to have it on. The tuning folks say to turn it on. I've been told by tech support here to have it on. And for the past several years, I've had it turned on. Fast forward to recent times. I'd been having an issue with pages sometimes taking forever to load, but hitting refresh loaded the page instantly. Sometimes there'd be a 1-3 second delay before the page started loading, then loaded promptly. It was annoying at best. So after a few hours of reading others having the same problem with no resolution, I decided to go through the http.conf file, one variable at a time, tweaking things here and there. What I found was my last expectation. Disabling keep-alive not only eliminated the problem completely, it actually sped the site up considerably. Why? I read into how keep-alive works. The first big thing I saw; keep-alive only works with files with finite sizes. It will not work with dynamic pages (IE: PHP). It seems as though to 1-3 second delay is Apache waiting for a keep-alive child process to timeout (suggested for 3 seconds by the vb.o tuning folks). That explains the 1-3 second delay. When the page hangs, it seems like Apache is processing what can be kept alive and what can't and just times out. So I've been running my site with keep-alive turned off for a little over a week now. It's much faster. I even had a few members ask me if we moved servers because they noticed how much faster things were loading.

    So back to the question, why use Apache keep-alive?
    Last edited by bstillman; Fri 8 Apr '11, 10:08am.
  • bstillman
    Senior Member
    • Jun 2007
    • 127
    • 3.8.x

    #2
    Anyone?

    Comment

    • Lynne
      Former vBulletin Support
      • Oct 2004
      • 26255

      #3
      This is probably a better question for George, so you should post it over in the Server Configuration forum.

      Please don't PM or VM me for support - I only help out in the threads.
      vBulletin Manual & vBulletin 4.0 Code Documentation (API)
      Want help modifying your vbulletin forum? Head on over to vbulletin.org
      If I post CSS and you don't know where it goes, throw it into the additional.css template.

      W3Schools <- awesome site for html/css help

      Comment

      • Andreas
        Senior Member
        • Feb 2004
        • 2323

        #4
        There is no easy answer to the question as it depends on your workload: If you have a lot of clients requesting several resources during a certain timeframe is is usually better to have keepalive turned on to get rid of the overhead for establishing TCP connections. But if your clients request only a few resources it is better to have keep-alive turned off to free workers immediately. Rule of Thumb:
        • Keep-Alive off for backend servers
        • Keep-Alive off for frontend servers
        • Keep-Alive on for static content servers

        Comment

        • IBxAnders
          Senior Member
          • Aug 2001
          • 1172
          • 4.0.x

          #5
          Good feedback from Unix Expert (M.Polek IB):

          Keepalive is a double edged sword. It allows you to keep a connection open, like through a firewall or load balancer. It’s useful for things like SSH connections where you need to keep a connection open through a firewall, but there may be periods of time where there is no traffic on the connection. In an HTTP setting, it can allow you to keep a connection open through a load balancer. However, that can also mean that connections can be left open after their last real use, taking up resources in the load balancer and on the HTTP server. While you may see a boot in the load testing that you’re doing, that doesn’t necessarily translate into a performance boost for regular users. It depends on traffic patterns… how the site is used. It’s one of those tricky things in the “don’t mess with this unless you know what you’re doing” realm, I think.
          anders | vbulletin team | check out the new vbulletin facebook app
          Proudly vBulletin'ing since 2001
          Please be my friend!
          http://www.twitter.com/inetskunkworks
          vBulletin Performance Articles:
          Click here to read

          Comment

          • sross
            Senior Member
            • Mar 2004
            • 660

            #6
            Just noticed this thread. Like the OP I had a huge issue with pages "thinking" for up to 30 seconds before loading. I have a fairly busy forum 1.2 mil posts, 60k users. Turning keep alive off (at least on my server) solved all my woes. Everything on my site for all users now loads practically instantaneously. I've had it turned off for a week now, no issues, just members commenting on how fast the forum has become. It's amazing the effect one little "yes" or "no" can have.

            Comment

            widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
            Working...