1

We've been having load issues at the company I work for. Certain scripts have been taking long execution times, and we have not been able to track which ones. We use a LAMP stack. My question is, is there a way to view what files are currently being parsed by php? The servers vary from Ubuntu, Gentoo, and Cent OS, so something that would work on linux in general would be helpful.

kokorohakai
  • 215
  • 2
  • 7
  • 2
    XDebug has a profiling option/capability, which can track down the performance of your code, down to the execution of diverse SQL statements. – Havelock Feb 09 '13 at 09:51
  • While that is an answer, thank you, It just leads me to another question. Is there something a little more lightweight than that to use? I don't want to start a whole profiler/debugger, when all we need to do is track what file is process of currently being parsed. – kokorohakai Feb 09 '13 at 09:54
  • [Profiling with XDebug](http://www.xdebug.org/docs/profiler) is not a big deal. Another way I could think of would be to use a logger of some sort, e.g. [log4php](http://logging.apache.org/log4php/) or if you'd like and feel fit your own implementation, which could then track the execution of your program. – Havelock Feb 09 '13 at 09:59
  • 1
    Sounds like log4php might be what I'm looking for. Thanks! – kokorohakai Feb 09 '13 at 16:50

1 Answers1

0

I would install NewRelic onto your server and use that to profile which scripts are running and what is taking the longest. The basic version is free, but it might be worth going 'pro' for a month and get a deeper insight (by drilling down) on the 'peaks' in your performance graphs.

Xdebug is great if you know in particular which script/execution path is causing the problem. NewRelic will help you identify that and then you can use xdebug profiling combined with webcachegrind to parse the results of the profile and identify issues.

Jujhar Singh
  • 3,641
  • 5
  • 29
  • 38