Loading...
 
Development

Development


Improving MySQL Performance

posts: 4

I've been poking around in the (admittedly outdated) 1.74 and the time to generate pages was very slow. A profile revealed that almost all the time was being spent in MySQL so I homed in on that.

I further discovered that the most easily optimized part of the MySQL equation was the connection, which has enormous overhead. By using DB::connect($dsn, array('persistent'=>true)) in all instances, I was able to reduce page generation times from 3.5 seconds to about .88 seconds.

Tests on other systems with ADODB reveal that caching the database object in a session variable (not DB-stored) can make single-server response increase another order of magnitude. That implies propagating the class definitions across all source files, so it might not be worth all the code you have to touch.

Can anyone comment on whether either of these approaches has yet been attempted and if so, with what results?

Thanks

posts: 57

Tiki Wiki is insanely slow. I would very much like to see this get implemented, even the .88 seconds would be a huge improvement.

For example, tw.org is really slow with about 20 users.

If you could provide any sort of patches to 1.8 I would appreciate it.

Thanks for the information!



posts: 4

The exact patches on 1.74 are as follows (I suspect they are similar on 1.8):

/tiki-install.php (285)
$dbTiki = DB::connect($dsn, array('persistent'=>true));
/tiki-install.php (308)
$dbTiki = DB::connect($dsn, array('persistent'=>true));

/lib/bablotron.php (118)
$dbTiki = DB::connect($dsn, array('persistent'=>true));
// Note: this code is commented out so should not be an issue

/lib/wiki-plugins/wikiplugin_sql.php (15)
$dbPlugin = DB::connect($dsn, array('persistent'=>true));

/lib/pear/DB/mysql.php (819)

if (DB
isError($db = DB
connect($dsn, array('persistent'=>true)))) {

// Note: this may be redundant, as it is inside PEAR

/db/tiki-db.php (71)
$dbTiki = DB::connect($dsn, array('persistent'=>true));


posts: 2881 United Kingdom

My advice:

Dont touch persistant connections.

Thats all I have to say.

Damian


Upcoming Events

1)  18 Apr 2024 14:00 GMT-0000
Tiki Roundtable Meeting
2)  16 May 2024 14:00 GMT-0000
Tiki Roundtable Meeting
3)  20 Jun 2024 14:00 GMT-0000
Tiki Roundtable Meeting
4)  18 Jul 2024 14:00 GMT-0000
Tiki Roundtable Meeting
5)  15 Aug 2024 14:00 GMT-0000
Tiki Roundtable Meeting
6)  19 Sep 2024 14:00 GMT-0000
Tiki Roundtable Meeting
7) 
Tiki birthday
8)  17 Oct 2024 14:00 GMT-0000
Tiki Roundtable Meeting
9)  21 Nov 2024 14:00 GMT-0000
Tiki Roundtable Meeting
10)  19 Dec 2024 14:00 GMT-0000
Tiki Roundtable Meeting