![]() |
Cache the datastore in the filesystem
Ok, the purpose of this hack is to move the huge parts of the datastore,that are called each time you access a page, into a file unserialized and passed through var_export in order to save the time used to load the data from the database and to unserialize it. If you're using a PHP optimizer, like eAccelerator for example, this may save even more time I think. The result is, that huge arrays, like the forumcache are now loaded simply by executing
PHP Code:
Additionally this saves 4 calls to the function unserialize, which is broken in PHP 5.0.3 and 4.3.10, so this should be a good work around until PHP 5.0.4 and/or PHP 4.3.11 has been released. It tries to finish, what has been started in the code and AFAICS you can even find the beginnings of that in the init.php of vB3.0.6,although I'm still running vB 3.0.3, so I can't tell, that this works without problems in newer versions. Some Notes:
0.8.1 Alpha:
|
Very very very cool. :) I must try this.
|
Hehe, I did that a few days ago ;)
But I think there as not much difference in perfomace, once the bug in unserialize() has been fixed. IIRC can can find discussions about this on vB.com, whre one of the Devs said that this is even slower then using the DB. |
That was what my concern was. But while php 4.3.10 has that serialize bug which does slow my site down, this is a nice workaround.
|
From the guy who runs my host:
Quote:
(I tried this hack but it blew up in my face with foreach errors and stuff...I have apostrophes in my forum descriptions and it caused errors in functions_datastorecache.php ... ) |
Quote:
Quote:
|
i'd like to see a performance ranking on this hack, hit to a db like the one here on vb.org ...
|
I cant found this code in includes/init.php
PHP Code:
I'm using vbulletin 3.0.1 Thanx in advance. |
Mmm... you need to chmod 0777 the includes directory or you get a permission denied. Correct?
|
Okay, got it working 100% with my other hacks. :) Thanks!!! This has helped my multi-server setup. Will wait till we are at peak times and compare...
|
Quote:
BTW, the instructions are strange.. maybe thefile is corrupted ?! look: Quote:
Quote:
|
Quote:
In my init.php i have 5 instances of $optionsfound (listing the more relevants): PHP Code:
PHP Code:
PHP Code:
|
@Acido.. you have listed the less relevants... look at that one:
$optionsfound = !empty($vboptions); you have to forget the tabs (just find the text, not the line) |
Quote:
Not sure, but i think that your hack need 3.0.2 or higher to work. I'll try it after upgrade. Thanx for your reply's. :) |
Will this saqves queries?
If i dont have the unserialize bug will this effect? |
Quote:
Its just a leftover of that hack and it will be removed in future versions. |
Quote:
Quote:
If your database and your webserver are on different machines it may have an effect, depending on the connection between them. |
Quote:
|
Quote:
Quote:
|
Quote:
|
I look forward to future versions.
Interesting that the vB developers had already coded this into vB by default. You just needed to activate it in config.php really. :) |
Quote:
|
OK, I'm finished with the new version so far:
0.8.1 Alpha:
|
I installed 0.8.1 - works 100%. The backups were an annoyance and I'm glad you coded it so that they disappear. :) Thanks.
|
Parse error: parse error, unexpected T_STRING, expecting ')' in /home3/nzboards/public_html/forums/includes/datastore_cache.php on line 2833
Line 2833: 'description' => 'Kall\\'s private forum', |
In your functions.php (the hacked version) find the following:
PHP Code:
PHP Code:
|
Hmm ... why don't you just write the variables without comments?
I think this could make it easier :) |
Quote:
Good idea though, and thanks for the help. :) |
This hack works but I've uninstalled it :). It was really annoying to have to keep manually updating the datastore on each of my separate web servers. The crunch came when I put my forums offline to do a backup, but as I did not update the datastore manually, members could still access the forums, causing my 15 Gb database to become corrupted. :) Took me 28 hours to fix it manually as I didn't want to lose even 1 day of data. There is a slight page loading improvement, but I'd rather have the convenience.
|
Well yeah, if you're running this on a multi server setup, you need to synchronize everything on the fly and I suppose, that setting up such a system can be a lot of work, I guess.
|
I've just added the following warning to the description:
This hack is not designed for a multi-server setup. So unless the data on the filesystem is being updated on the fly its not recommended to install this. Thanks for helping with your feedback. |
Quote:
A good workaround is to make sure each time you edit settings in AdminCP the datastore is automatically rebuild. The problem is not multi-server, but multi-web server = when the datastore is rebuild, it only gets rebuild on the ONE web server. Trying to sync it in real-time won't be easy. :) |
Quote:
|
Quote:
|
anyone confirm if this works on 3.0.6 without obvious problems?
arn |
Quote:
I've upgraded to vB 3.0.6 Wednesday evening and I had no problems so far. btw: The backup feature may be removed in future version. I usually implemented it, so you could restore a previous version, if something went wrong, but since rebuild_dscache.php works perfectly, these backups are no longer needed. |
Quote:
|
Is anyone running this on a forum that has Ushop?
|
Quote:
|
Ok, I have a few questions before I decided whether to risk sticking it on my production forum. It installed fine on my beta test and appeared to cut the page loading time down from 25/30seconds to 15.
My server has been hit hard by vB3's agressive database load and the unserialize() bug, hence the obvious difference. However, some aspects confuse me, for example: Quote:
1) When do you actually need to run the 'rebuild' process? Judging by the data - only when you change an option in the admin CP or add/edit one of your forums/category names & options. Does it need to be rebuilt after every new post or is it just doing the more static data? 2) Can I remove the admincp/rebuild....php script from the server when not needing to be used or does something require it to be there? 3) If I need to take my forums offline to change the options, then (as per above) will this corrupt my database? I'm confused about how this can be prevented as admins always need to update options/add forums etc. now and then. Do you take it offline, run the rebuild, update the options, run the rebuild, put it online and then run the rebuild again? Am a little confused ;) . ----------- Otherwise, can I just say, this is an excellent idea. If your database gets a lot of load and your actual webserver is still fast, then calling the key settings/forum names+details from the file system instead of the database (I think that's how it works?) saves a lot of DB pressure. This may be more obvious to those on shared hosting, when vB3's heavy load can become a pain. |
All times are GMT. The time now is 04:43 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|