Simple Machines Community Forum

Customizing SMF => Modifications and Packages => Topic started by: albertlast on September 14, 2017, 06:00:04 PM

Title: SMF-Benchmark
Post by: albertlast on September 14, 2017, 06:00:04 PM
Link zur Modifikation (https://custom.simplemachines.org/mods/index.php?mod=4155)

SMF-Benchmark (https://custom.simplemachines.org/mods/index.php?mod=4155)

This mod provide SMF 2.1 with the posibility to check the performance of the enviorment.

Benchmark type
- Create as many users as possible in one minute - cpu heavy test
- Create as many posts as possible in one minute - This test is db insert performance heavy
- Repeatedly access a topic for one minute - This test depends heavily on the size of your board and the active features

Use case
- Changing your php or database version
- Changing your database solution exp. MySQL -> MariaDB
- Changing smf settings exp. different Caching Methods or levels
- Changing your host
- Possible side effect from mods
- To check if your board get slower over time

This mod run on MySQL, MariaDB and PostgreSQL.

After install you find the entry under: Maintenance > Forum Maintenance > Benchmark

GitHub Link (https://github.com/albertlast/SMF-Benchmark)


All suggestions related to core features and UI are most welcomed.



License
* This SMF Modification is subject to the BSD 3
Title: Re: SMF-Benchmark
Post by: vbgamer45 on September 14, 2017, 06:50:55 PM
Nice idea would have to check it out.
Title: Re: SMF-Benchmark
Post by: Gryzor on September 15, 2017, 01:01:45 PM
Oh, how very interesting! Any chance of a 2.0.x version?
Title: Re: SMF-Benchmark
Post by: albertlast on September 16, 2017, 04:08:44 PM
Since i don't use smf 2.0.x i had no plan to make this work for this.
I try to install my mod on smf 2.0.x but the displaying doesn't work...
Title: Re: SMF-Benchmark
Post by: Gryzor on September 17, 2017, 04:28:16 AM
Yeah, I figured it wouldn't, so I didn't even try it in the first place :) But thanks for letting us know at least!
Title: Re: SMF-Benchmark
Post by: albertlast on September 28, 2017, 04:24:32 PM
Maybe for comparison, please hav in mind that is a synthetic benchmark.
smf 2.1 "beta4" pg 9.6 php 7.1 mariadb 10.1

PG is a mid size board
PG Cache lvl3 is a mid size board with pg as cache level 3
MySQL is near fresh
PG fresh is a fresh install






Test
PG
PG Cache lvl3
MariaDB
PG fresh
User Creation
111
113
88
865
Post Creation
5381
9087
75
8263
Post read
7371
12475
19080
17872
Title: Re: SMF-Benchmark
Post by: albertlast on October 01, 2017, 10:24:30 AM
Because i created this table with benchmark i was interessted in smf 2.0 too.
So setup a clean version of MariaDB with two changes,
convert all tables to innodb and disable caching.

User Creation    316
Post Creation    82
Post read          9130

Since i did it, i know what is needed to run this mod on smf 2.0.x

Three steps (first two steps you find in attachment):
-Add in package-info.xml


<install for="2.0, 2.0.1-2.0.99">
<readme type="file" parsebbc="true">readme.txt</readme>
<require-dir name="Themes" destination="$boarddir">Theme files</require-dir>
<require-dir name="Sources/SMFBenchmark" destination="$sourcedir">Source files</require-dir>
<code>installer/installHooks2.1.php</code>
<redirect url="?action=admin;area=maintain;sa=benchmark" type="inline" timeout="2000">Please stand by while you are being redirected to benchmark side.</redirect>
</install>
<uninstall for="2.0, 2.0.1-2.0.99">
<code>installer/uninstall2.1.php</code>
<remove-dir name="$sourcedir/SMFBenchmark" />
<remove-file name="$themedir/SMFBenchmark.template.php" />
<remove-file name="$languagedir/SMFBenchmark.english.php" />
</uninstall>


- search Class-SMFBenchmark.php for (should be there three times)

if (!isset($_SESSION['optimized_tables']))
validateToken('admin-maint');
else
validateToken('admin-optimize', 'post', false);

and replace this with


/*
if (!isset($_SESSION['optimized_tables']))
validateToken('admin-maint');
else
validateToken('admin-optimize', 'post', false);
*/


- Last step >after< the install of the mod in your board
got to Sources/ManageMaintenance.php
to the end of $subActions array (in smf 2.0.14 this is line 178)
add after this:

//Bechmark
        loadTemplate('SMFBenchmark');

        $context[$context['admin_menu_name']]['tab_data']['tabs']['benchmark'] = array();

        $subActions['benchmark'] = [
                'function' => 'SMFBenchmark::MaintainBenchmark',
                'template' => 'maintain_Benchmark',
                'activities' => [
                        'usercreate' => 'SMFBenchmark::UserCreate',
                        'postcreate' => 'SMFBenchmark::PostCreate',
                        'postread' => 'SMFBenchmark::PostRead',
                ],
        ];
        //end Bechmark


The first two steps i combined in the attachment already,
so you can install the mod and go to step three.

As always i recommand to redo the changes of step three and removed the mod asap,
when you done with testing.
Title: Re: SMF-Benchmark
Post by: g4gt on November 15, 2017, 03:23:14 PM
help ,how can I install on fresh 2.0.14...getting error when tring to install :(
Title: Re: SMF-Benchmark
Post by: d3vcho on November 15, 2017, 03:34:38 PM
This mod doesn't work for any 2.0.xx versions. Just for SMF 2.1 Beta 3.
Title: Re: SMF-Benchmark
Post by: albertlast on March 31, 2018, 02:55:39 AM
Changed the version to 1.2
Changelog:
Added Russia
Added Beta4 (github version) support
Place a check if db_show_debug is enabled - don't run the benchmark when you enabled this, when you did you need to restart you webserver after running
Title: Re: SMF-Benchmark
Post by: alexetgus on March 31, 2018, 06:33:51 AM
Too bad this mod is not planned for SMF 2.0.x ... :'(
Title: Re: SMF-Benchmark
Post by: albertlast on March 31, 2018, 06:50:06 AM
You can use this but you need to do the steps which i posted here: https://www.simplemachines.org/community/index.php?topic=556205.msg3943565#msg3943565
Title: Re: SMF-Benchmark
Post by: alexetgus on March 31, 2018, 06:57:07 AM
So you propose a "patch" for an official SMF and a full mod for a beta version.
Okay.
Thank you goodbye !
Title: Re: SMF-Benchmark
Post by: Bigguy on December 02, 2018, 05:03:22 PM
To use this do I have to:

- Create as many users as possible in one minute - cpu heavy test
- Create as many posts as possible in one minute - This test is db insert performance heavy
- Repeatedly access a topic for one minute - This test depends heavily on the size of your board and the active features
???
Title: Re: SMF-Benchmark
Post by: albertlast on December 02, 2018, 11:50:46 PM
Why you belief this?
This are different options which the benchmark can run.
Title: Re: SMF-Benchmark
Post by: Bigguy on December 03, 2018, 07:48:50 AM
OK, if I don't have to run that stuff than I will install this later today at some point.
Title: Re: SMF-Benchmark
Post by: Arantor on December 03, 2018, 07:57:39 AM
This mod is for seeing how quickly different things work on your server and for testing different ways to do something. I don't think you want this in your production site.
Title: Re: SMF-Benchmark
Post by: Bigguy on December 03, 2018, 08:11:53 AM
If it's going to mess with stuff than no I don't.
Title: Re: SMF-Benchmark
Post by: albertlast on December 03, 2018, 12:06:43 PM
No it don't mess up with any stuff,
but since it a benchmark it make no sense to keept it after you run your tests.
Title: Re: SMF-Benchmark
Post by: Bigguy on December 03, 2018, 06:28:04 PM
I have a test site. I will try it on there and see what happens.
Title: Re: SMF-Benchmark
Post by: Bigguy on December 04, 2018, 07:31:40 PM
I have installed it to my test site. I have a question though. I have a vps so creating all these users and posts may not be a good idea if it shuts down my server in some way. I don't know if it could do that but it was a thought that entered my head.
Title: Re: SMF-Benchmark
Post by: albertlast on December 04, 2018, 11:26:54 PM
I don't understand you thought.
It's a benchmark and you can decide which test you run.
Title: Re: SMF-Benchmark
Post by: Bigguy on December 05, 2018, 07:20:01 AM
I understand what you are saying. I just worry about creating that many users and posts all at once on a small server.
Title: Re: SMF-Benchmark
Post by: Arantor on December 05, 2018, 07:36:48 AM
But that's exactly the point, to see how fast the server can do it.
Title: Re: SMF-Benchmark
Post by: Bigguy on December 05, 2018, 08:11:55 AM
I know that's the point. Could it crash a server though. ??
Title: Re: SMF-Benchmark
Post by: Bigguy on December 05, 2018, 08:15:09 AM
Ok, it just created 110 users....forums still there, lol. Page created in 60.225 seconds with 608 queries.
Title: Re: SMF-Benchmark
Post by: Bigguy on December 05, 2018, 08:16:14 AM
3085 posts created Page created in 60.925 seconds with 34042 queries.
One topic accessed Page created in 60.101 seconds with 174801 queries.
Title: Re: SMF-Benchmark
Post by: Ben_S on March 01, 2019, 05:55:38 AM
Out of mild curiosity with caching off:-

Creating User:142
Creating Posts:26001
Reading Posts:80409