Profile My Little Forum (General)

by danielb987, Monday, March 20, 2017, 12:29 (2566 days ago)

Another thread diskusses how to improve the speed of the forum. The first question to ask in order to solve that is how long time each sql query takes. This process is called profiling.

The way this works is to replace each call to mysqli_query with a call to profile_mysqli_query. You then use the parts of the forum you want to test and after that use the script profile_result.php to see the result.

To use the script, create the profile tables using the sql queries in profile_mlf.sql.

Then add the statement "include('profile_mysqli.php');" to the top of the index.php file.

And then replace all occurencies of mysqli_query with profile_mysqli_query.

I have a complete installation of My Little Forum version 2.4.2 with profiling. Se below.

The function profile_mysqli_query is in the file profile_mysqli.php.txt. Please note that you have to change the variable $forum_folder in the top of the file to the location on the server of the forum.

To show the result, run the script profile_result.php.

"Show profile data per file and line" shows a summary of all sql queries of each row in a file. A particular row may have several different queries, for example different id, but all queries on the same row are added up.

"Show profile data per query" shows every single query. So even if a row has several identical sql queries, each of them are shown individual.

"Clear profile data" clears the profile tables. No question is asked!

The script is provided as freeware. Feel free to change it as you like. This is a quick hack and may have bugs. Use at own risk.

Important note!!!
This script is slow and must not be run on a public forum! The profiler adds extra sql queries to each sql query, with the result of a lot of overhead. But it is nessesary to find which sql queries that are causing the problem.

Best regards,
Daniel


Complete thread:

 RSS Feed of thread