passenger_enabled slows down nginx dramatically

33 views
Skip to first unread message

Ming

unread,
Jan 6, 2010, 11:36:34 AM1/6/10
to nginx, phusion-passenger
I'm using nginx to serve files cached by merb.  Passenger/mod_rails to deals with requests not served by the cache.  merb is not touched by the test case here.  all test (cached) files are handled by nginx or passenger.

Nginx can serve a cached file ~5,000 / sec.   That drops to 5 / sec when "passenger_enabled on."  Please see the notes in the body of the server block of the nginx.conf below.  Anyone know the cause of this drop?

OS: Ubuntu 9.10, 32bit
Nginx: 0.8.31, compiled with headers-more 0.07 + Passenger: 2.2.8 without OpenSSL

TIA,
Ming

nginx.conf:

events {
    worker_connections  1024;
}


http {
    passenger_root /usr/lib/ruby/gems/1.8/gems/passenger-2.2.8;
    passenger_ruby /usr/bin/ruby1.8;
    passenger_log_level 0;

    include       mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;

    server {
        listen       80;
        server_name  myapp.local;
        root     /var/www/myapp/public;

        rack_env development;

        access_log  logs/host.access.log  main;

        location ~* \.(ico|css|js|gif|jpe?g|png|swf)$ {
           break;
        }

        passenger_enabled on; <-- on = 5 requests / sec, off = 5K requests / sec

       # code below is not necessary for passenger to serve cached files.  if i "passenger_enabled on" and optionally delete the code below, nginx will serve ~5 requests/ sec or less; if i keep the code and passenger_enable off, nginx will serve ~5,000 requests /sec

        if (-f $request_filename) {
    break;
}

# cached pages
set $cache_extension '';
if ($request_method = GET) {
     set $cache_extension '.html';
}

# the above is a hack because nginx doesn't allow nested or ANDed ifs
if (-f $request_filename$cache_extension) {
           #more_set_headers  "Content-Encoding: gzip";
     rewrite (.*) $1.html break;
}
}

 

Asif Shams

unread,
Jan 6, 2010, 12:39:28 PM1/6/10
to phusion passenger

Hi,

I am using plesk for domain creation, I have a owner of that domain which is a ftp user, I have deployed ruby applications, but my application is only working when I applied root:root as owner and group permissions for rails/application folder. I have gone through these links but unfortunately this is not working for me, can any one help me to correct this problem as I don't want to apply root:root as owner of the domain

http://mdsmediagroup.com/posts/24


http://www.modrails.com/documentation/Users%20guide%20Apache.html#_deploying_a_ruby_on_rails_application

 

And some more good info:


http://www.rubyinside.com/28_mod_rails_and_passenger_resources-899.html


Regards,
Asif Shams

Hotmail: Powerful Free email with security by Microsoft. Get it now.

Anuj Dutta

unread,
Jan 6, 2010, 11:20:32 PM1/6/10
to phusion-...@googlegroups.com

Anuj Dutta

unread,
Jan 7, 2010, 4:16:04 AM1/7/10
to phusion-...@googlegroups.com


2010/1/6 Asif Shams <aasif...@hotmail.com>


Hi,

I am using plesk for domain creation, I have a owner of that domain which is a ftp user, I have deployed ruby applications, but my application is only working when I applied root:root as owner and group permissions for rails/application folder. I have gone through these links but unfortunately this is not working for me, can any one help me to correct this problem as I don't want to apply root:root as owner of the domain

http://mdsmediagroup.com/posts/24


http://www.modrails.com/documentation/Users%20guide%20Apache.html#_deploying_a_ruby_on_rails_application

 

And some more good info:


http://www.rubyinside.com/28_mod_rails_and_passenger_resources-899.html


Regards,
Asif Shams


You should create a group called "webapps" (or anything else you fancy) and a user called "<domain-name>". Add this "user" to the webapps group and run Passenger as this user. You should also look into how users and permissions work on a Unix based system and that would kind of help you.

I hope this helps.

Anuj


 


Hotmail: Powerful Free email with security by Microsoft. Get it now.

--
You received this message because you are subscribed to the Google Groups "Phusion Passenger Discussions" group.
To post to this group, send email to phusion-...@googlegroups.com.
To unsubscribe from this group, send email to phusion-passen...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/phusion-passenger?hl=en.




--
Anuj DUTTA
Reply all
Reply to author
Forward
0 new messages