Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement --max-keepalive-requests #124

Open
eserte opened this issue Jul 3, 2017 · 3 comments
Open

Implement --max-keepalive-requests #124

eserte opened this issue Jul 3, 2017 · 3 comments

Comments

@eserte
Copy link

eserte commented Jul 3, 2017

I would like to see something like Apache's MaxKeepAliveRequests implemented for Starman.

Rationale: on a heavily used server with few clients it is possible that a worker process lives for very long time, even with the default setting of --max-requests=1000. Reason is that --max-requests does not count requests within a keepalive connection.

The implementation is probably quite simple, something like the following in process_request in Starman::Server (untested):

     if (exists $self->{options}->{max_keepalive_requests}) {
         last if ++$keepalive_requests >= $self->{options}->{max_keepalive_requests};
     }
     DEBUG && warn "[$$] Waiting on previous connection for keep-alive request...\n";

If this feature request is accepted, then I would do a formal pull request.

@miyagawa
Copy link
Owner

miyagawa commented Jul 3, 2017

Sounds reasonable to me!

eserte added a commit to eserte/Starman that referenced this issue Jul 4, 2017
eserte added a commit to eserte/Starman that referenced this issue Jul 5, 2017
eserte added a commit to eserte/Starman that referenced this issue Jul 6, 2017
eserte added a commit to eserte/Starman that referenced this issue Jul 11, 2017
@Logioniz
Copy link

Logioniz commented Jun 9, 2021

Oh.... i have already make pull request to fix this situation with max_requests and keepalive connections without max-keepalive-requests param. #142

@eserte i look at your code eserte@06cee30 and detect race between closing connection and sending new request to starman because your code not changed "Connection" header to value "close" which led to http 502 from the balancer under heavy load.

I can to help to fix your problem but first need to understand what kind of logic we will implement (mine or with flag --max-keepalive-requests).

@pepl
Copy link

pepl commented Nov 26, 2022

@miyagawa any update on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants