On Dec 9, 2006, at 2:38 PM, Xavier Noria wrote:
> Yeah, I tried that yesterday and got no response so far. Before
> patching Mongrel, looks like ngnix supports that limit and would be a
> good or even better choice for our application than Apache, I am
> right now testing it.
Well, looks like the limit is working with Nginx, but I get very poor
performance compared to Apache, same server machine, same (remote)
stress machine. Apache is serving about 17 req/s, whereas Nginx is
serving about 5 req/s. Since Nginx is known to be fast I bet my
config, albeit simple, is somehow wrong. I attach it below in case
some experienced eye catches something.
-- fxn
tested with: ab -t 60 -c 5 -H 'Accept-Encoding: gzip'
url_to_dynamic_page
Nginx (5 req/s)
---------------
user daemon;
error_log logs/error.log;
pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include conf/mime.types;
default_type application/octet-stream;
sendfile on;
gzip on;
gzip_proxied any;
gzip_types text/html text/plain text/xml text/css application/x-
javascript;
client_max_body_size 1M;
upstream mongrel {
server 127.0.0.1:3001;
server 127.0.0.1:3002;
server 127.0.0.1:3003;
}
server {
listen 80;
server_name www.example.com;
root /home/oper/www/public;
location ^~ \.flv$ {
flv;
}
location / {
if (!-f $request_filename) {
proxy_pass http://mongrel;
}
}
error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
Apache (17 req/s)
-----------------
NameVirtualHost *:80
# Configure the balancer to dispatch to the Mongrel cluster.
<Proxy balancer://example_cluster>
BalancerMember http://127.0.0.1:3001
BalancerMember http://127.0.0.1:3002
BalancerMember http://127.0.0.1:3003
</Proxy>
# Setup the VirtualHost for your Rails application
<VirtualHost *:80>
ServerAdmin [EMAIL PROTECTED]
ServerName www.example.com
ServerAlias localhost
DocumentRoot /path/to/example/public
<Directory '/path/to/example/public'>
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
</Directory>
ProxyPass / balancer://example_cluster/
ProxyPassReverse / balancer://example_cluster/
# Setup your Rewrite rules here
RewriteEngine On
# Rewrite index to check for static
RewriteRule ^/$ /index.html [QSA]
# Send all requests that are not found as existing files to the
cluster
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f
RewriteRule ^/(.*)$ balancer://example_cluster%{REQUEST_URI}
[P,QSA,L]
# Deflate
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/
css application/x-javascript
# Error logs
ErrorLog /path/to/example/log/apache_error_log
CustomLog /path/to/example/log/apache_access_log combined
</VirtualHost>
_______________________________________________
Mongrel-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/mongrel-users