Welcome! Log In Create A New Profile

Advanced

A question of fastcgi_pass method

SanCao Jie
October 17, 2010 06:48AM
HI,

I'm a chinese ,sorry for my poor english.

I'm new to nginx. I have installed nginx 0.7.67 ,and installed flup
,web.py to use python .
I writer a simple test.py file ,and just run : python test.py . VIsit
http://ip:8080 and it works well.
That means the web.py is right installed.

So, I try to use nginx with this python file.
I edit the nginx.conf like this:

fastcgi_pass 127.0.0.1:9000;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param PATH_INFO $fastcgi_script_name;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;


and use spawn-fcgi to start up the python file :

spawn-fcgi -f FILE -a 127.0.0.1 -p 9000

then visit the address http://ip it works ,shows the result what I wanted
..

and then I simply change the fastcgi_pass method TCP to UNIX SOCKET

nginx.conf : fastcgi_pass unix:/tmp/nginx.socket

spawn-fcgi command : spawn-fcgi -f FILE -s /tmp/nginx.socket ( And change
the mod of /tmp/nginx.socket to 777 ).

This times it works well too .


Then I just did a simple test for this two different way of connections
between nginx and spawn-fcgi .

I use webbench to do this test : webbench -c 100 http://IP/

This is the result:

USE TCP Method:

Speed=5730 pages/min, 14038 bytes/sec.
Requests: 2865 susceed, 0 failed.

USE UNIX SOCKET Method:

Speed=5548 pages/min, 13592 bytes/sec.
Requests: 2774 susceed, 0 failed.

Why the test shows that TCP method is faster than Unix Socket ?

And an other quertion is :during the TCP Method test ,I typed : netstat -an
| grep 9000 ,this were many ports shows
TIME WAIT .almost over 3,000 . when the webbench is over ,zhe TIME WAIT
ports number is decrease.
Why this ,And is it safe ?


THANKS
_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

A question of fastcgi_pass method

SanCao Jie October 17, 2010 06:48AM

Re: A question of fastcgi_pass method

Maxim Dounin October 17, 2010 07:58AM

Re: A question of fastcgi_pass method

SanCao Jie October 17, 2010 09:26AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 165
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready