Recent Topics

1 Sep 21, 2005 02:49    

The Database Optimizer Plug-in for [url=http://b2evolution.net]b2evolution[/url] is intended to optimize your local [url=http://b2evolution.net]b2evolution[/url] database tables.

What is it?
[list]The Database Optimizer Plug-in is a [url=http://b2evolution.net]b2evolution[/url] renderer plug-in intended to optimize all your [url=http://b2evolution.net]b2evolution[/url] database tables. This may speed up your blogs display a bit, especially on very high volume blogs.

The current 0.1 release is intended for [url=http://b2evolution.net]b2evolution[/url] versions 0.9.1 (Dawn) and 0.9.0.x (Amsterdam, Paris, Copenhagen, Madrid, Oslo, Berlin, Europe). It has been successfully tested on [url=http://b2evolution.net]b2evolution[/url] versions 0.9.1 (Dawn) and 0.9.0.11 (Paris).[/list:u]
What does it do?
[list]The Database Optimizer Plug-in:[list]

  • removes obsolete entries in the hitlog table;

  • for each table, executes the following SQL commands:[list][*]REPAIR to repair broken entries,

  • OPTIMIZE to reorganize entries,

  • ANALYZE to optimize indexes.[/list:u][/list:u]In order to be called on a frequent basis, the Database Optimizer Plug-in is a renderer plug-in. That means it is automatically executed on each article's contents display. Since the optimization process may last a while, the plug-in does nothing most of the time. In fact, the plug-in optimizes the database tables around 1 to 5 AM or when requested by a [url=http://b2evolution.net]b2evolution[/url] administrator user (any level 10 user).[/list:u]

  • When to use it?
    [list]This plug-in is interesting on high volume blogs publishing, modifying, deleting many posts and comments. Moreover, it is also interesting on high traffic blogs using the [url=http://b2evolution.net]b2evolution[/url] default statistics, constantly adding and removing entries in the hitlog table.[/list:u]
    How to use it?
    [list]First, you have to install the plug-in:[list]

  • [url=http://blog.lesperlesduchat.com/media/zip/Database_Optimizer_Plugin_0.1_for_b2evolution.zip]Download[/url] the Database Optimizer Plug-in.

  • Uncompress the compressed archive.

  • Copy the _databaseoptimizer.renderer.php file into your plugins/renderers folder.[/list:u]Then, an administrator user can force a database optimization by setting the optimizedb in your URL. This can be done like so:[list][*]http://www.yourdomain.com/yourfolder/yourblog.php?optimizedb=1

  • http://www.yourdomain.com/yourfolder/index.php?blog=2&optimizedb=1[/list:u]In its default configuration, the Database Optimizer Plug-in also optimizes your database tables when your blogs' pages are displayed by night (between 1 and 5 AM) on a random basis (1 chance out of 100). You can change this default behavior by editing the source code directly.

  • If you want to deactivate the Database Optimizer Plug-in, change the following line in _databaseoptimizer.renderer.php about line 58:

    var $apply_when = 'stealth';

    to:

    var $apply_when = 'never';

    You can also delete the previously installed _databaseoptimizer.renderer.php file.[/list:u]
    Known bugs
    [list]The Database Optimizer Plug-in does not check if the displayed content appears in the backoffice or not. It may slow down your backoffice display when performing optimization. However, the plug-in is intended to avoid disturbing while checking a preview.[/list:u]
    Final words
    [list]This plug-in is based on the ideas presented in the [url=http://forums.b2evolution.net/viewtopic.php?t=4620]Optimize your blog database & Empty Hit log[/url] thread. Thanks to [url=http://forums.b2evolution.net/viewtopic.php?t=4620]kraemers[/url] for his great idea about optimizing database tables.

    The "official" page of this plug-in is: [url=http://blog.lesperlesduchat.com/dev.php/2005/09/21/b2evolution_database_optimizer_plug_in]b2evolution: Database Optimizer Plug-in[/url].

    This is my first [url=http://b2evolution.net]b2evolution[/url] plug-in. Any feedback is appreciated.[/list:u]

    2 Sep 21, 2005 04:45

    1. Nice work making it an actual plugin rather than a hack. That's much easier for users to install.

    2. I added it to plugins.b2evolution.net. Let me know if you have any corrections to my post. Did you want me to link to the forum post or to your blog post? Is ralphy the right name for the author?

    3. If I were to use this plugin, I would probably set up a cronjob to do the repair once a day or something. If I wanted to use wget to hit the ?optimizedb=1 url, would I have to also include &user=username&pass=mypassword?

    Great job!

    3 Sep 21, 2005 05:02

    I'm looking forward to giving this a shot when I can, but I've got too many digital irons in the proverbial fire right now and keep tripping over my own junk, but I gotta point something out here.
    kwa wrote:

    ... /yourblog.php?optimizedb=1 ...

    I saw that and I thought you were trying to optimize me! Since I don't do anything how's this gonna get me to do it bett... oh uh, never mind!

    4 Sep 21, 2005 05:12

    EdB wrote:

    kwa wrote:

    ... /yourblog.php?optimizedb=1 ...

    I saw that and I thought you were trying to optimize me! Since I don't do anything how's this gonna get me to do it bett... oh uh, never mind!

    Now you're optimizedb, you still do nothing, but you do it quicker! :lol:

    5 Sep 21, 2005 05:38

    personman wrote:

    1. Nice work making it an actual plugin rather than a hack. That's much easier for users to install.

    I wondered how to make it a plug-in with the current versions of [url=http://blog.lesperlesduchat.com]b2evolution[/url] (0.9.1 and 0.9.0x) and found a not so bad way to implement this feature as a renderer plug-in. However, optimizing the database tables takes a while (about 10-15 seconds on my blogs) and stopping the display of the page just after the title of the first blog or in the middle of the linkblog (depending of your blog's layout) appears buggy, doesn't it? It would be fine to have a "page displayed" event or so in the next version of [url=http://b2evolution.net]b2evolution[/url].

    But the main issue of the current [url=http://b2evolution.net]b2evolution[/url] version is there is no clean way to define plug-in's parameters. You have to change them in the source code. It is still possible to create a toolbar plug-ins, but accessing a global plug-in from post edition does not appear to be very straightforward...

    personman wrote:

    2. I added it to plugins.b2evolution.net. Let me know if you have any corrections to my post. Did you want me to link to the forum post or to your blog post? Is ralphy the right name for the author?

    Thanks! I tried to submit the plug-in a couple of times, but I've got an error message from my browser... My right developer nickname is kwa and my code web page is [url=http://blog.lesperlesduchat.com/dev.php]My Own Little Development Blog[/url]. I've written a post dedicated to that plug-in: [url=http://blog.lesperlesduchat.com/dev.php/2005/09/21/b2evolution_database_optimizer_plug_in]b2evolution: Database Optimizer Plug-in[/url]. (Other parts of my site, [url=http://blog.lesperlesduchat.com]Les perles du chat[/url], aremainly sex-oriented. Even if there is no porn or anything porn-related, linking a plug-in with sex is probably not the best way to promote it ;))

    You may leave the current link to this thread. It is probably more interesting for newcomers to read what the other users tell about a plug-in.

    personman wrote:

    3. If I were to use this plugin, I would probably set up a cronjob to do the repair once a day or something. If I wanted to use wget to hit the ?optimizedb=1 url, would I have to also include &user=username&pass=mypassword?

    I'm afraid you're going to have to include your administrator connection parameters. However, take care: if you've got public stats (either [url=http://b2evolution.net]b2evolution[/url] stats, [url=http://www.mrunix.net/webalizer/]Webalizer[/url] or [url=http://awstats.sourceforge.net/]AwStats[/url]), your login and password will become publicly available, since appearing in your logs!

    It is possible to remove the administrator check, but then, since optimizing your database takes a while, your server might become overloaded if somebody decides to hit your page too often with the optimizedb=1 parameter.

    In fact, I should either create a new database table, either use the hitlog table as a log of the Database Optimizer Plug-in activity. The main problem is some people deactivated the hitlog table update. I'm going to think about. A new version might appear in a couple of days...

    6 Sep 21, 2005 05:47

    I fixed up the author name and link. And I fixed the Submit a Plugin page. I forgot to restore a file after my 0.9.1 upgrade. It's working now.

    7 Sep 21, 2005 05:53

    personman wrote:

    I fixed up the author name and link. And I fixed the Submit a Plugin page. I forgot to restore a file after my 0.9.1 upgrade. It's working now.

    Perfect! :) I've updated my profile too, in order to avoid any confusion in the future.

    8 Sep 21, 2005 06:01

    I'm curious about your thoughts on not going with a toolbar plugin. I know it's a funky place to put it since it would look like a something to tweak your post with, but it would put the moment of optimization in the hands of the user rather than upon each time attempting to actually post something.

    Another question I had is about the 1% chance between 1a and 5a. Is that GMT or server time or blog time? I think the ideal would be blog time since that sort of implies low traffic time, but knowing allows the savvy user to customize the start and end hours.

    Something else, but I'm really just popping in as a break from the constant never ending always uphill battle otherwise known as the antispam list.

    Oh yeah! It goes away from plugin level, but have you considered adding a field to the settings table called 'last_optimize_date' then use that value to limit the frequency of optimizing? For example a low-traffic blog might go 24 hours but a high traffic blog might choose 4 hours. That way you still trigger on posting, but also say "hey we did it 11.8 hours ago and this guy says wait 12". I'm doing an installation where I added a field to that table is what made me think of it, plus a duration cycle would be a blog-side setting.

    Just some thoughts.

    9 Sep 21, 2005 06:30

    EdB wrote:

    I'm curious about your thoughts on not going with a toolbar plugin. I know it's a funky place to put it since it would look like a something to tweak your post with, but it would put the moment of optimization in the hands of the user rather than upon each time attempting to actually post something.

    I'm going to think about creating a toolbar. In fact, I've already begun a toolbar plug-in to edit the plug-in's parameters, but that solution didn't look very clean to me... However, it's probably better to make possible parameters edition in any way.

    Today, creating a fully functional plug-in looks like adding a clever hack... I definitively have to look at the Phoenix source code to see what plug-ins can really do.

    EdB wrote:

    Another question I had is about the 1% chance between 1a and 5a. Is that GMT or server time or blog time? I think the ideal would be blog time since that sort of implies low traffic time, but knowing allows the savvy user to customize the start and end hours.

    It's blog time, because of the reason you talk about.

    EdB wrote:

    Something else, but I'm really just popping in as a break from the constant never ending always uphill battle otherwise known as the antispam list.

    Oh yeah! It goes away from plugin level, but have you considered adding a field to the settings table called 'last_optimize_date' then use that value to limit the frequency of optimizing?

    You know what? I haven't considered that, because... I've never noticed that table before you told about! :-/ It's probably the best way to define every parameter, including the plug-in parameters as well!

    EdB wrote:

    For example a low-traffic blog might go 24 hours but a high traffic blog might choose 4 hours. That way you still trigger on posting, but also say "hey we did it 11.8 hours ago and this guy says wait 12". I'm doing an installation where I added a field to that table is what made me think of it, plus a duration cycle would be a blog-side setting.

    In fact, optimizing the table once a day as well as autoprunning obsolete hitlog table entries should be enough.

    All the "clever" 1% chance between 1 and 5 AM to optimize the database was intended to make sure every blog (low and high traffic ones) is going to be optimized (at least) once a day. By setting a last_optimize_date and a optimize_at entries in the settings table, there is no more need to perform those checks. There is also no more need to force the update, since it would be performed once a day. The only way to not perform the optimization would be to not have any visitor for a whole day! But then, the tables would still optimized anyway!

    EdB wrote:

    Just some thoughts.

    Thanks a lot, you noticed some excellent directions to investigate about.

    10 Apr 30, 2006 03:24

    clicked link to download
    got empty source

    is it gone???

    12 Jul 23, 2006 00:25

    I installed this, and I got a number of errors about the set_time_limit function on line 130. The error I saw in my logs was "Cannot set time limit in safe mode..."

    What is this and how can it be fixed? Does the script still run and do its thing even with this error?

    Each time the error occurs, it appears 12 times, if that makes any difference.

    Also, has anyone had issues with this script and MySQL? I am on a dedicated server, and it seems that MySQL has shut down twice since I installed this script. I'm not sure if the script is a culprit, but I removed it to see if anything else happens.

    13 Jul 23, 2006 00:48

    your host is running php in safe mode. I havent looked at kwa's script but i can hazard a guess it needs some changes to work in that environment.

    14 Mar 28, 2007 06:18

    I would like to have this plug in but I've downloaded it from both spots in this thread and both archives appear to be corrupt.

    15 Jul 16, 2007 07:25

    I still have been unable to locate a good copy of this plugin. I download it and the zip file is corrupt.

    Does anyone happen to have a copy to share?

    Thanks


    Form is loading...

    Photo gallery software – This forum is powered by b2evolution CMS, a complete engine for your website.