Virtual Domains

Hello,

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.com www.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 ?

max_children
StartServers
MinSpareServers
MaxSpareServers
rlimit_files
rlimit_core
max_requests

Thanks for any help.

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.

Mike,

Thank you for your reply!

I am unclear what you mean by engines. Do you mean servers in the apache
sense ?

So looking at php-fpm.conf I see what looks to be the beginnings of the
apache
style you were talking about in terms of min maxservers.

Because I am currently using:

Sets style of controling worker process count.
Valid values are ‘static’ and ‘apache-like’
static

To implement your suggestion of 10 engines do you mean simply changing:

5

to 10 ?

Have you run into any issues whereby you have needed to raise:

1024
and
500

Thanks again for your reply. Very helpful

first off here’s a snippet of one of my fastcgi pools:

                    <value name="pm">
                            <value name="style">static</value>
                            <value name="max_children">4</value>
                            <value name="apache_like">
                                    <value 

name=“StartServers”>4
2
2


31s
1024
unlimited
yes
250
127.0.0.1

i set max_children and StartServers to the same, although I believe
anything inside of “apache_like” is ignored for now.

but yes, engines = how many instances of php (via php-fpm) are running
per fastcgi pool

for example, above, it is 4 engines

On Wed, Sep 3, 2008 at 4:57 PM, David [email protected] wrote:

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

Thanks Mike, that helps alot.

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.

Thanks very much for your help Igor and Mike.