Welcome Guest, Not a member yet? Register   Sign In
High CPU usage and server load using Codeigniter
#1

[eluser]fouadami[/eluser]
Hello,
I'm using codeigniter for a web game and I'm facing with a high server load right now. The game has about 300,000 visitors per day. When I 'top' in shell, mysql usage is about 2% to 30%, but the avg is 5% which is somehow normal for the game but httpd and php usage is very hight. Sometimes an httpd command takes more than 15% cpu and PHP also takes 6-7% in the peak.
I've upgraded Apache to the latest stable version but It doesn't help at all. Is there anything wrong with my server/script/codeigniter?

Thanks
#2

[eluser]rogierb[/eluser]
I can say it's all wrong and I can say that this is how it is supposed to be. Without detailed info I don't think anyone can help you.

But here are some pointers:
-What thread or http request is causing the hight load, are there more then one.
Find the top 10 of most CPU consuming threads and analyse them. Every microsecond you can shave off, is 1...
- Get a MYSQL tuning script and see if there is room for improvement in your my.cnf
- Log all slow queries and analyse them, index whereever needed, otherwise try to rewrite queries to be faster.

But the main thing is: log and analyse. It might take a week to just get one part a microsecond faster but tuning and retuning is a must.
#3

[eluser]Krzemo[/eluser]
I've been through performance tuning myself recently.
I guess noone will tell you much at lest not knowing how well you box is tunned. There are lots of options if its standard configuration: apache tuning (turning loggin off i.e. or changing it for Lighttpd), mysql tuning (starting from queries, indexes etc and finishion on configuration) and finally eaccelerator or xcache for PHP.

I wouldn't worry about MySQL, HTTPD or PHP doing 30% untill load average is not much higher then number of your CPU cores and you dont see website performance decrease (you can check requests response times in FireBux ie), unless you are expecting high traffic peaks soon...




Theme © iAndrew 2016 - Forum software by © MyBB