Nginx + PHP = VERY High CPU Usage
Roger Hoover
roger.hoover at gmail.com
Fri Dec 10 22:12:45 MSK 2010
Are you using APC cache? You may need to adjust the APC config to get
it to work under php-cgi? Just a guess...
On Fri, Dec 10, 2010 at 11:05 AM, hasson <nginx-forum at nginx.us> wrote:
> Hello All,
>
> I was using APACHE and I decided to migrate to nginx.
> I researched and nginx is supposed to have a completely superior
> performance for webpages that have lot of simultaneous requests, such as
> real time pages sending AJAX requests every second.
>
> My application is based on MYSQL + PHP + AJAX + JAVASCRIPT.
>
> After I installed the NGINX, I started testing it, and noticed that
> something is strange due the HIGH-CPU usage of PHP-CGI process.
>
> The curious is that with around 6-8 Tabs open on Firefox, I can reach
> around 80% of CPU usage. that is completely high, even with this test
> machine that have a cpu of only 1.8ghz. But talking about only 8 web
> pages open, reach this amount of CPU usage, I think that something is
> wrong.
>
> Anyone can please advise me?
>
> [size=x-small]last pid: 39019; load averages: 0.98, 0.22, 0.08
>
> up 4+16:53:45 17:03:29
> 51 processes: 2 running, 49 sleeping
> CPU: 84.8% user, 0.0% nice, 14.4% system, 0.4% interrupt, 0.4% idle
> Mem: 46M Active, 204M Inact, 83M Wired, 128K Cache, 60M Buf, 157M Free
> Swap: 991M Total, 991M Free
>
> PID USERNAME THR PRI NICE SIZE RES STATE TIME WCPU COMMAND
> 39017 www 1 70 0 18908K 10932K accept 0:04 17.09% php-cgi
> 39009 www 1 72 0 18908K 11396K accept 0:05 16.26% php-cgi
> 39008 www 1 68 0 18908K 11428K accept 0:05 15.67% php-cgi
> 39019 www 1 66 0 18908K 10932K accept 0:03 15.48% php-cgi
> 39018 www 1 64 0 21980K 13100K RUN 0:03 13.96% php-cgi
> 954 mysql 14 44 0 63332K 30672K sbwait 5:55 0.00% mysqld
> 1150 daemon 6 44 0 13460K 6716K ucond 0:34 0.00%
> memcached
> 1617 nobody 1 44 0 5348K 4180K kqread 0:12 0.00% nginx
> 1009 root 1 44 0 6080K 3476K select 0:11 0.00%
> sendmail
> 1020 root 1 44 0 3376K 1372K nanslp 0:04 0.00% cron
> 1001 root 1 44 0 6704K 3744K select 0:02 0.00% sshd
> 642 root 1 44 0 3348K 1336K select 0:02 0.00% syslogd
> 38189 rafael 1 44 0 9428K 4552K select 0:01 0.00% sshd
> 1013 smmsp 1 44 0 6080K 3332K pause 0:00 0.00%
> sendmail
> 783 www 1 73 0 17884K 8412K wait 0:00 0.00% php-cgi
> 812 nobody 1 44 0 3292K 1296K select 0:00 0.00% noip2
> 38186 root 1 44 0 9428K 4488K sbwait 0:00 0.00% sshd
> 1487 root 1 44 0 5348K 3636K pause 0:00 0.00% nginx
> 38193 root 1 44 0 4564K 2404K wait 0:00 0.00% bash
> 39016 root 1 44 0 3684K 1956K RUN 0:00 0.00% top
> 823 root 1 76 0 3628K 1504K wait 0:00 0.00% sh
> 38192 rafael 1 44 0 3808K 1724K wait 0:00 0.00% su
> 38190 rafael 1 45 0 3628K 1612K wait 0:00 0.00% sh
> 1084 root 1 76 0 3348K 1156K ttyin 0:00 0.00% getty
> 508 root 1 44 0 1888K 584K select 0:00 0.00% devd
> 1086 root 1 76 0 3348K 1156K ttyin 0:00 0.00% getty
> 1085 root 1 76 0 3348K 1156K ttyin 0:00 0.00% getty
> 1089 root 1 76 0 3348K 1156K ttyin 0:00 0.00% getty
> 1087 root 1 76 0 3348K 1156K ttyin 0:00 0.00% getty
> 1090 root 1 76 0 3348K 1156K ttyin 0:00 0.00% getty
> 1091 root 1 76 0 3348K 1156K ttyin 0:00 0.00% getty
> 1088 root 1 76 0 3348K 1156K ttyin 0:00 0.00% getty
> 120 root 1 76 0 1540K 844K pause 0:00 0.00%
> adjkerntz[/size]
>
> Posted at Nginx Forum: http://forum.nginx.org/read.php?2,157575,157575#msg-157575
>
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://nginx.org/mailman/listinfo/nginx
>
More information about the nginx
mailing list