WordPress.org

Forums

[resolved] optimazing MU and adding new feature [post count per author] (6 posts)

  1. stuk88
    Member
    Posted 4 years ago #

    HI boys and girls.

    There is some major optimazing feature I'd like to discuss on.
    Im sitting here checking the system and there is a very big and noticeble problem flowing up the stream.
    Im having alot of plugins in my mu-plugins directory,
    and every time new page on the system loads it loads all the plugins files that are in this directory...
    It overloads the system of the server and delays the time takes to compute the code.
    And i just was thinking why not gather all the hooks in one file and make the function calls just include the whole plugins code from inner folder just when it needed. cuz the code will be included from outer file just when the hook is called it will cut down on the resorces the site uses and will make it faster... esspecialy when i use 15 or more plugins.

    Another topic is post counting.
    In my MU intall i have alot of user and authors.
    If i want to show the number of posts one author has i have to count the DB for all the posts he sent.
    multiply it by 1000 and you will get the number of sql searches and counts per visit.
    not very server freindly at all does it?
    well i was thinking about writing a plugin that will add a row to the users table that will count the posts users sent.
    will be updated on post write or delete by increcing or decricing the number in that row.
    and in first install it should count every posts count for every user.
    kinda heavy for user loaded site.
    so i think it will only be an option in new installed sites with small number of users.

  2. Im having alot of plugins in my mu-plugins directory,
    and every time new page on the system loads it loads all the plugins files that are in this directory...

    Then you're using the folder incorrectly. :) Sorry. The mu-plugins folder *will* execute all code placed inside, without activation, as if ti were part of WordPress itself.

    If you put a lot of code in there, then yeah, it's gonna chug - especially if you have inefficient plugins in there.

    If you're putting regular plugins in there, don't. Only put ones in there that specifically state they need to be there.

    If you want plugin code running all the time on all sites, you may want to consider using the "Network activate" link on the plugins page.

    will be updated on post write or delete by increcing or decricing the number in that row.
    and in first install it should count every posts count for every user.

    Yep, that;s what you'll need to do. :)

    Not everyone will need this feature, that's why it's currently plugin territory. many current users of what was wordpressmu are running very large sites with lots of authors. they wrote their own code to handle this.

    Also, if you're on a shared server, you will run into issues. Because you have a large site with loads of plugins, not just because of WP.

  3. stuk88
    Member
    Posted 4 years ago #

    nope its dedicated server.

    BUT i'v noticed that even when a plugin says it designed for mu-plugins folder... there is alot of plugins that execute mysql queries even without the function structure... thus making the main page execute about 50-70 queries... yea thats huge...
    so i think slicing the plugins into separeted folder will secure the problem and will cut down the code the server loads each time.
    to address the problem in the green way... smaller code -> less server work -> faster page computing -> less electricety use -> better place to live in... =]

  4. I'd still argue that maybe the plugins that you're putting in there need to be optimized. :) Or if it's a bunch of smaller plugins, toss them all in one file. Make sure they're coded well.

    If you want to discuss development changes like this, and feedback from the devs, either hop in the wordpress dev chat in IRC or file a trac ticket.

  5. stuk88
    Member
    Posted 4 years ago #

    yea i agree that i'll have to optimize my plugins and in the same hand better and more organized code structure make it easier to debug and locate.

    I think there is good reason why companies use MVC in their code...
    I'm telling this cuz thats good example for code reorgenizing so it will be more efficient coding with less bugs and slow ungly code.

    Anyway I think that when you plan the system you should take in mind problems that could happen when the site will grow bigger...
    thus little un-efficient code will become a major pain in the ass.
    even if the original design was for single blog, the system now became a multisite featured from scratch by adding mu to the wp core code.

    Well thx for the tip... I'll go and talk there too =]

    Have a good day and happy coding =}
    (reSolved)

  6. You know wordpress.com runs the same code, right? ;)

Topic Closed

This topic has been closed to new replies.

About this Topic