Performance Optimization

So we brought out quite a biggish product. The problem is, it is running a bit slow. Not incredibly slow, but not the speed we want it to run.

I have done some basic optimization and improved the speed a weee bit.

Do anybody know of a few tools that can help me determine where the bottle necks are happening and what is slowing our application down.

Optimization is not usually done with tools, rather by examining your scripts, using profiling tool like xdebug, fining bottlenecks and changing your script manually. It’s a manual labor, not tool is smart enough to fix the poorly written script for you.

You should use a Profiler, XDebug has one and this one looks quick and nice:

Also in Google Chrome you can right click, Go to Inspect Element, Resources Tab, Enable Resource Tracking – and take a gander at that for a lot of other stuff too.

Without doing any coding, I’ve found step #1 to speed up a sluggish PHP application is to install a cache on the server like PHP APC. If the app is a huge beast of code, then at least it wont have to be compiled on every run.

Ofc, the problem could be with it’s database usage. If it run queries on large tables, then finding those queries and trying to make sure they have correct indexes could help

PHP APC is definately on the list of things to do, as well as memcache. For now I would like to focus on getting the code up to standard and optimized.

The application is database driven, and quite alot of db queries were written by Juniors who do not know alot about indexes and optimizing queries.

SO for ths php code I can use a profiler to help me determine where the code is taking to long, or using up to much memory, but is there a Mysql command or tool that I can use to determine which queries are taking the longest to execute?

MySQL slow log can be very usefull for this, and then you can use EXPLAIN on the queries identified to see their index usage