I have 5 sites that will all be sharing the same IP, and 2 that will
have their
own IP addresses.
I have a series of conf files that I include that contain server {}
sections.
Each conf looks like this:
server {
listen xxx.xxx.xxx.xxx;
server_name domain.comwww.domain.com;
access_log /var/log/nginx/domain.access.log main;
location / {
index index.php index.html;
root /home/domain/public_html/domain;
}
}
For the sites with unique IP addresses I have put their unique IP
address in the
listen statement.
For the sites that are sharing an IP address I have put the same IP
address in
each domains conf file for the listen statement.
Is this setup correctly ?
Additionally, for a site that receives 700K PVs/month on a Dual 2.8Ghz
Xeon 4Gb
RAM with pretty heavy MySQL usage, how many workers should I be starting
would
you think ? I have something in the region of 500 users loading pages
every 15
minutes.
Whilst here, if anyone has had any experience with a site setup/volume
like
that, what PHP-FPM settings do you use ?
you basically need one fastcgi engine per concurrent request. but it
seems like it can handle multiple requests per second though; the
great thing about php-fpm is soon it will support adaptive/apache
style process spawning. currently it does not, so you’re stuck with a
fixed amount of engines.
15 mins * 60 seconds = 900 seconds
500 users / 900 seconds = .55556 users per second, if my math is right.
i’d say start out with 10 engines. you can look at the php-fpm log and
see how often it is recycling engines, and see if nginx is being
denied due to engines being busy. then bump up as needed. i’ve got a
site doing over a million php requests per day running 20 engines x 3
servers and i think it’s more than enough. i can’t wait for php-fpm to
do apache spawning so i can start it at a lower number and let it
adapt so i’m not wasting resources.
I am unclear what you mean by engines. Do you mean servers in the apache sense ?
correct
Sets style of controling worker process count.
Valid values are ‘static’ and ‘apache-like’
static
yeah, right now apache stuff is not completed
To implement your suggestion of 10 engines do you mean simply changing:
5
to 10 ?
yes, and maybe StartServers for good measure
1024
haven’t needed to change this
500
i usually set mine a little bit lower. i don’t really have any
benchmarks or evidence either way. originally when i was having issues
a while back i thought perhaps it was leaking too much memory so i
made it more aggressive by restarting processes after less requests.
500 should be fine. 250 should be fine. any number is probably fine…
i don’t know - it was either in the sample or i saw it somewhere.
either way i haven’t seen it negatively or positively impact anything
from what i can tell. best case would be to ask the author of php-fpm,
check out http://groups.google.com/group/highload-php-en - that’s
where Andrei hangs out and discusses php-fpm
I noticed in the section of conf you posted that you had:
unlimited
I have google’d around a bit, and have been unable to find anything in
English
that says what/how this is used. The default is 0, what has your
experience of
this been ?
On Wed, Sep 03, 2008 at 10:49:47PM +0000, David wrote:
For the sites that are sharing an IP address I have put the same IP address in
each domains conf file for the listen statement.
Is this setup correctly ?
Yes.
Additionally, for a site that receives 700K PVs/month on a Dual 2.8Ghz Xeon 4Gb
RAM with pretty heavy MySQL usage, how many workers should I be starting would
you think ? I have something in the region of 500 users loading pages every 15
minutes.
Usually one worker is enough.
If you use gzipping in nginx side, then try 2 workers (for each CPU).
If you have large files, those are not cached ib OS VM,
you probably need 10-20 workers.