10 ms·
Although my Loom server code is completely standalone and does not use Apache, I'll take this opportunity to discuss Keep-Alive policy since the article mention
by fexl 16y ago
Although my Loom server code is completely standalone and does not use Apache, I'll take this opportunity to discuss Keep-Alive policy since the article mentions it.
The Loom server automatically scales down the Keep-Alive interval as the server load increases. Each child process monitors its own life span, basically like this:
# These parameters are configurable.
my $max_children = 128;
my $min_life = 10; # seconds
my $max_life = 600; # seconds
# Now compute the lifespan.
my $num_children = get_current_number_of_child_processes();
my $free_slots = $max_children - $num_children;
my $cur_life = int($max_life * ($free_slots / $max_children));
$cur_life = $min_life if $cur_life < $min_life;
At this point $cur_life is the maximum number of seconds this child process should live. If the child has been alive that long or longer, it voluntarily exits.
An instance of this server code is running at https://loom.cc https://loom.cc . You can find the source code via the News page at https://loom.cc/news https://loom.cc/news . The relevant function is Loom::Sloop::Client::check_lifespan .