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

neither passenger_max_instances or passenger_max_pool_size seem to work (RoR) #395

Open
raquelhortab opened this issue Apr 2, 2024 · 1 comment

Comments

@raquelhortab
Copy link

I followed the instructions on the README and got my app working fine. However, I wanted to limit the max simultaneous requests that can be processed and cannot figure out how to make it work. I have tried setting passenger_max_instances and passenger_max_pool_size in the nginx conf file but the app still handles more than 2 requests at a time.

webapp.conf:

server {
    listen 80;
    server_name www.webapp.com;
    root /home/app/webapp/public;

    passenger_enabled on;
    passenger_user app;
    passenger_min_instances 2;
    passenger_max_instances 2;

    passenger_ruby /usr/bin/ruby3.2;

    client_max_body_size 50M;

}

passenger_max_pool_size 2;

I am using this to simulate simultaneous requests:

ab -c 10 -n 10 http://localhost:3001/

And I got this code on the RoR app:

def index
  pp "entering #{Time.now}"
  sleep 3
  pp "done #{Time.now}"
end

By looking at the logs, I see that all 10 requests start before any of them having finished.

I wonder if I am using the wrong config.

@ajhodgson
Copy link
Contributor

The config looks OK.

Do you see more than 2 passenger processes running in the container?

I'm wondering if you're seeing more of a log flush delay. Perhaps put a stdout.flush after each print?

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

2 participants