![]() |
|
[PHP] Website causing overload - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444) +--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151) +---- Forum: Web Development (https://hackforums.net/forumdisplay.php?fid=183) +---- Thread: [PHP] Website causing overload (/showthread.php?tid=4349366) |
Website causing overload - theAbsolute - Jul 20, 2014 "Once again server causes more load and you need to upgrade to dedicated server environment to resolve this issue". That's the reply I often get from support of my hosting. They are unable to tell me what's actually causing this and asks me to upgarde even I am on VPS and don't have more then couple of thousands visitors daily. So the problem must be in my code. I'm using PDO + MySQL, no 3rd party applications. I guess there could be million things causing this but if you could tell me in short what generally could it be I would be much thankful. * - Quad - Jul 20, 2014 What type of application are you running? * - theAbsolute - Jul 20, 2014 I did actually a bit more complex website then I am actually able to do. It's like a mini social network with user profiles (profile pics, settings, statuses) and user blogs. Users daily posts around 100 statuses and I fetch them all on main page and also on their user profile pages. That's pretty much it. Also, I have a chat application. I guess that's what's eating most of resources, but couldn't be just it. * - Sh4d0wPr0xy - Jul 20, 2014 This is really hard to establish just from your post, you will have to run some tests to really find out what is happening. Some big memory leaks I have come across, come from poorly coded class methods, like the classic 'for ( ; ; )' that eats memory. Are you caching static content and using a CDN? * - VipVince - Jul 20, 2014 This is more of a networking than PHP issue. Depending on your budget, you could implement a 'load balancer' to distribute the traffic over several networks. * - AppleJuice - Jul 21, 2014 (Jul 20, 2014 08:30 AM)VipVince Wrote: This is more of a networking than PHP issue. Highly doubt it's a networking issue. Quote:"Once again server causes more load and you need to upgrade to dedicated server environment to resolve this issue". OP, can you give specs of server (if possible) along with PHP version and possibly PHP extensions? Is this custom coded, if not what application is it? Also how much memory is allocated to PHP? Whats the load time (use microtime(), see http://stackoverflow.com/questions/535020/tracking-the-script-execution-time-in-php ) Also have you tried to use xdebug and webgrind for PHP to see what is using most memory/time to execute? * - theAbsolute - Jul 21, 2014 Server specs: 2 CPU 512 RAM "Unlimited" bandwith and space ---- PHP Version 5.4.26 What do you actually mean by application? Memory limit is 32M Haven't tested load time in microtime(), but according to tools.pingdom.com, approximate load time for page is 600ms, 12 requests and 93/100 grade. Never heard of these debug tools, will try them out! Thanks. * - AppleJuice - Jul 21, 2014 (Jul 21, 2014 12:37 PM)theAbsolute Wrote: ~ fancy snip ~ Shoot, sorry for not explaining. Doing the microtime() would show you how long it takes for PHP to execute the code. Example PHP Code Although I'm pretty sure you can use $_SERVER['REQUEST_TIME_FLOAT'] (or without float) instead of $start. As well by application, I mean like CMS if you didn't make it or have someone else make it for you. * - YERANUK - Jul 21, 2014 Try using a free trial of an application monitor, I think theres some PHP extensions that do it. It will make it clear as to what is causing the heavy load. http://newrelic.com/lp/php-monitoring * - theAbsolute - Jul 21, 2014 (Jul 21, 2014 12:47 PM)AppleJuice Wrote: Shoot, sorry for not explaining. Doing the microtime() would show you how long it takes for PHP to execute the code. Example Thanks, will try it. Yeah, I made it from scratch, that's why it is buggy haha. No CMS or any framework used. * - Aldo. - Jul 21, 2014 (Jul 21, 2014 12:37 PM)theAbsolute Wrote: Server specs: What software (Webserver, SQL server etc.) and operating system are you using? * - antonn - Jul 23, 2014 Switch to a better hosting, when I cause overload my hosting always tells me what is causing it. * - chrisn - Jul 24, 2014 what do you pay for the VPS so we can give advice what would work better ? |