[Solved] Enabling keepalive after 'x' number of concurrent connections.
I was wondering if there are any current tricks to achieve something I was interested in --
I'm curious if it's even feasible, but having something that kicks in Keep-Alive after a certain amount of concurrent requests. For instance, my site handles millions of connections per day for images. There's no set number of images any given page could call.. could be one at a time, could be 20, could be more.
Normal KeepAlive simply sets the individual connection to be handled one at a time, so in the case of 20 images, they would all display one after another (averaging 1 second per round-trip, that's 20 seconds to get the page to load!). If I could tell [something] to allow 5 concurrent connections and then enable KeepAlive on any further requests, that would cut down page load time by quite a bit. Of course, I realize it wouldn't be that cut-and-dry; I know KA is 'suggested' in the response headers, so if it were set to 4, for instance, if it detected that four concurrent connections (or completed connections within ~1 second) had occurred for the same IP, it would start sending KA's to each further connection.
I know modern browsers cull the number of concurrent connections to a site, but this can also be changed in many (Firefox comes to mind).
Maybe this is all moot, and the Keep-Alive would eventually be forced into one connection by the browser.
Can anyone make any sense out of what I'm attempting to explain, and if so, is it any bit feasible?
Thanks for your time :)
RE: Enabling keepalive after 'x' number of concurrent connections. - Added by nitrox almost 9 years ago
I´m a bit confused...you want lighty to assume that after e.g. someone downloaded 5 images one after the other that he indeed wants to download more (like 20) and want to enable keepalive on the 6. request??
RE: Enabling keepalive after 'x' number of concurrent connections. - Added by icy almost 9 years ago
Just enable keep-alive? It doesn't hurt much when connections are hanging around.
If you have a lot of them, set the keep alive idle timeout to 5 seconds.
RE: Enabling keepalive after 'x' number of concurrent connections. - Added by Olaf-van-der-Spek almost 9 years ago
Pipelining is supposed to improve this, unfortunately it's not enabled by default in most browsers. (AFAIK).
Disabling keep-alive is probably not going to help.
RE: Enabling keepalive after 'x' number of concurrent connections. - Added by Morgon almost 9 years ago
Sorry for forgetting about this thread.
nitrox: Yes and no.
Consider a page with.. say, 8 images from the same server:
image1.jpg - Served with thread 1
image2.jpg - Thread 2
image3.jpg - Thread 3
image4.jpg - Thread 4
image5.jpg - Thread 5
image6.jpg - Thread x (Whatever's free)
image7.jpg - Thread x (Whatever's free)
image8.jpg - Thread x (Whatever's free)
icy: I like my speed. :P Keep-alive would mean that no images could be served until the previous one finishes.. Sometimes this can take up to 3 - 4 seconds (as these are dynamic images that often rely on external data). It's nice that one image isn't making my site look like a slug, and they can all pop up at once. The problem is simply when someone has 20 images on the page.
Olaf: I'll have to try pipelining on my local Firefox install and see if it helps any. Sure, it won't do anything else for the millions of other users, but it would be nice to know that there's some way of achieving it. Just wish it was something that could be done on the server side to hold those connections in a keep-alive fashion after it sees a certain number in a defined timeframe.
RE: [Solved] Enabling keepalive after 'x' number of concurrent connections. - Added by gstrauss 9 months ago
Just wish it was something that could be done on the server side to hold those connections in a keep-alive fashion after it sees a certain number in a defined timeframe.
There is. It is called keep-alive and it is enabled by default in lighttpd. Also, most browsers make multiple socket connections to a server in order to be able to download resources (such as multiple images) in parallel. This is already happening in most modern browsers.