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.
on 04.09.2008 00:56
on 04.09.2008 01:50
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.
on 04.09.2008 02:03
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' <value name="style">static</value> To implement your suggestion of 10 engines do you mean simply changing: <value name="max_children">5</value> to 10 ? Have you run into any issues whereby you have needed to raise: <value name="rlimit_files">1024</value> and <value name="max_requests">500</value> Thanks again for your reply. Very helpful
on 04.09.2008 02:17
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</value>
<value
name="MinSpareServers">2</value>
<value
name="MaxSpareServers">2</value>
</value>
</value>
<value
name="request_execution_timeout">31s</value>
<value name="rlimit_files">1024</value>
<value name="rlimit_core">unlimited</value>
<value name="catch_workers_output">yes</value>
<value name="max_requests">250</value>
<value name="allowed_clients">127.0.0.1</value>
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 <mishy.cth@gmail.com> 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'
> <value name="style">static</value>
yeah, right now apache stuff is not completed
> To implement your suggestion of 10 engines do you mean simply changing:
>
> <value name="max_children">5</value>
>
> to 10 ?
yes, and maybe StartServers for good measure
> <value name="rlimit_files">1024</value>
haven't needed to change this
> <value name="max_requests">500</value>
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...
on 04.09.2008 02:29
Thanks Mike, that helps alot. I noticed in the section of conf you posted that you had: <value name="rlimit_core">unlimited</value> 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 04.09.2008 03:30
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
on 04.09.2008 06:39
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.
on 04.09.2008 10:40
Thanks very much for your help Igor and Mike.