Support » Plugin: WP Photo Album Plus » Huge Performance Hit / Can you revise plugin?

  • Resolved CoolDavidoff

    (@cooldavidoff)


    Jacob I hesitated long whether to post this at all give how many “feature requests” you have to deal with here, makes me feel sorry!

    But: I post it now because it may avoid a huge “plugin acceptance” hit for you going forward. I will briefly summarize my REPORT (not request) in two sections:

    1) database problem
    2) resources load (scripts and css)

    1) database problem
    Seems no one noticed this (yet!): Your wppa plugin EXPLODES the database size, and all caused by your “sessions logging”. 15MB in a couple of days?? I am lost for words!
    Your 973 or what admin options… is one thing.
    But blowing up a standard wp database for NO BENEFIT WHATSOEVER that is a whole different matter.
    How I found out: Whenever we had to import a backup, your plugin’s db table “wppa_sessions” through errors, like:

    Indexes for table wp_wppa_session

    ALTER TABLE wp_wppa_session
    ADD PRIMARY KEY (id),
    ADD KEY sessionkey (session(20))

    MySQL said: Documentation
    #1062 – Duplicate entry ‘0’ for key ‘PRIMARY’

    Looking at the database backup file, I saw that your “sessions” table is already bulking up the db by THIRTY MEGABYTES.
    I then looked how to DELETE hundreds of thousands of rows in notepad ++. Like this: Right click, “Begin Select”
    then “End Select”
    then hit “Delete” 🙂

    This is how I quickly(?) got rid of your sessions table before importing, so as to avoid getting another import error like that.

    ==> You MUST drop your idea of logging every “session” into the database! Why at all?? Is there ANY value at all of logging “sessions”?
    And even if YOU see value in that, at least DELETE your own sessions frequently. Automatically.
    Plugin USERS do not seek to (know to) do that themselves. Just my tip. 😉

    2) resources load (scripts and css)
    On any page anything of your plugin is used, ALL OF THESE LOAD:

    a) Get loaded in header, thus above the fold!

    <script type='text/javascript' src='http://domain.com/wp-includes/js/jquery/jquery.js'></script> (for us, always there, for you, the only one needed?!)
    <script type='text/javascript' src='http://domain.com/wp-includes/js/jquery/jquery.form.min.js'></script>
    <script type='text/javascript' src='http://domain.com/wp-content/plugins/wp-photo-album-plus/js/wppa-utils.min.js'></script>
    <script type='text/javascript' src='http://domain.com/wp-includes/js/jquery/ui/core.min.js'></script>
    <script type='text/javascript' src='http://domain.com/wp-includes/js/jquery/ui/widget.min.js'></script>
    <script type='text/javascript' src='http://domain.com/wp-includes/js/jquery/ui/mouse.min.js'></script>
    <script type='text/javascript' src='http://domain.com/wp-includes/js/jquery/ui/resizable.min.js'></script>
    <script type='text/javascript' src='http://domain.com/wp-includes/js/jquery/ui/draggable.min.js'></script>
    <script type='text/javascript' src='http://domain.com/wp-includes/js/jquery/ui/button.min.js'></script>
    <script type='text/javascript' src='http://domain.com/wp-includes/js/jquery/ui/position.min.js'></script>
    <script type='text/javascript' src='http://domain.com/wp-includes/js/jquery/ui/dialog.min.js'></script>
    <script type='text/javascript' src='http://domain.com/wp-content/plugins/wp-photo-album-plus/js/wppa.min.js'></script>
    <script type='text/javascript' src='http://domain.com/wp-content/plugins/wp-photo-album-plus/wppa-init.en.js'></script>
    
    b) Get loaded in footer, thus at least not also blocking page rendering!
    <script type='text/javascript' src='http://domain.com/wp-content/plugins/wp-photo-album-plus/js/wppa-slideshow.min.js'></script>
    <script type='text/javascript' src='http://domain.com/wp-content/plugins/wp-photo-album-plus/js/wppa-ajax-front.min.js'></script>
    <script type='text/javascript' src='http://domain.com/wp-content/plugins/wp-photo-album-plus/js/wppa-popup.min.js'></script>
    <script type='text/javascript' src='http://domain.com/wp-content/plugins/wp-photo-album-plus/js/wppa-touch.min.js'></script>
    <script type='text/javascript' src='https://maps.googleapis.com/maps/api/js?key=AIzaSyCD0VIRFeVaYHe5WrYph3GTsYRCyk8NYA4&sensor=false'></script>
    <script type='text/javascript' src='http://domain.com/wp-content/uploads/wppa/temp/wppa.172.69.70.243.js'></script>

    c) PLUS several inline scripts!

    d) That was only the SCRIPTS… Then come all the CSS….

    e) OMG! While researching the intricacies of your plugin my constant thought was “does he not think about efficiency….?”

    Summary: Friendly, really 100% friendly, tip (else I wouldn’t bother to write here, you see): Stop attending to those temporary feature requests, and instead devise a permanent solution:

    1) Load only what is absolutely necessary for the chosen functionality

    2) Load all your plugin scripts in the footer, use defer, so AFTER the page has been rendered, UNLESS one is needed earlier. Then make it ONE.

    3) Use wp-enqueue to load scripts and css. Like for example you “blindly” load //assets.pinterest.com/js/pinit.js without realizing that (likely) it IS already loaded by sth else, or it SHALL not be loaded at all.
    Well, a user of your plugin can only select ALL social shares, so we had to turn it off altogether.

    4) Kill all session logging.

    I know this helps. If only you take it serious.

    • This topic was modified 1 year, 10 months ago by Steve Stern.
    • This topic was modified 1 year, 10 months ago by Steve Stern.
Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Jacob N. Breetvelt

    (@opajaap)

    I really do not feel the need to explain all the design choices i made.
    Just a few remarks to the above:

    The session db table is self maintaining and will not grow forever, unless you kileed the wp cron processes. 15 MB is not much to my opinion, when we live in an era where 100 GB is small for a disk, and 100 MB is normal for a servers memory. The session db table is there because $_SESSION has proven to be unreliable. One of the applications is the fact that mutliple views of a specific photo within a session should count only once for the photo or albums viewcount.
    You may TRUNCATE TABLE the session table at any time.
    The key is auto_incremented:

    $create_session = "CREATE TABLE " . WPPA_SESSION . " (
    				id bigint(20) NOT NULL AUTO_INCREMENT,
    				session tinytext NOT NULL,
    				timestamp tinytext NOT NULL,
    				user tinytext NOT NULL,
    				ip tinytext NOT NULL,
    				status tinytext NOT NULL,
    				data text NOT NULL,
    				count bigint(20) NOT NULL default '0',
    				PRIMARY KEY  (id),
    				KEY sessionkey (session(20))
    				) DEFAULT CHARACTER SET utf8;";
    

    so, if you install and activate wppa normally, you will not see a duplicate key error.
    When moving to an other server, do not move the sessions table, its useless.

    I do use enqueue_script(). See the function wppa_add_javascripts() in wppa-non-admin.php where it is decided what scripts must be loaded. If you use all features, all scripts will be loaded

    You can select sm buttons in Table II-C13 and beyond, you can also select pages where not to load share code.

    You can defer scripts. Please use Table IV-A13, and NOT an external ‘optimizing’ – read ‘destructing’ – plugin, unless you break slideshows.

    wppa is rather good caching plugin friendly, i reommend Comet Cache.

    “I really do not feel the need to explain all the design choices i made.”

    Man! No one here on this huge wordpress.org website suggests that! Frankly, most don’t care what Jacob is doing.
    Why do you always get so touchy when users of your plugin take time out to try to help you with critical issues of your plugin?
    Do you think any of the “Downloaded: more than a million” plugins would have become successful if their authors reacted touchy when getting help?

    “15 MB is not much to my opinion”
    Man, did you read at all? IN TWO DAYS! 15MB …MORE… sessions in TWO DAYS!
    Not much in your opinion? What planet are you from?? Do you know of ANY plugin at all that is so …. programmed to USELESSLY blow up the wordpress database?
    And then ALL THE TIME causing “session errors” when importing a backup?!

    Phew! I am lost for words.

    “When moving to an other server, do not move the sessions table, its useless.”
    Indeed.

    CoolDavidoff
    I would suggest that if you feel WP Photo Album Plus is so bad then you consider using something else.

    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    @davidallen23 Touché

    davidallen I would suggest you learn to read before you write. Look how much I have contributed to further the plugin, and you have… zero.

    Next lesson would be to learn to think. The fact that I contribute so much means what?

    Finally the fact that Jacob instantly responds to your mini post suggests what?

    Exactly.

    And @jacob: If you feel no honored after all that superb feedback, but you feel the need to plus1 pointless “support” then you have completely misunderstood me.

    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    Why do you always get so touchy when users of your plugin take time out to try to help you with critical issues of your plugin?

    Because you say negative things that are simply not true.

    – It is clearly documented that you should not transfer WPPA_SESSION:
    https://wppa.nl/changelog/installation-notes/#moving says:

    WPPA_SESSION You can NOT transfer this to the new system

    – You CAN defer scripts including inline scripts to the footer: IV-A13
    – You CAN minimize inline styles: IV-A14
    – Wppa DOES use wp_enqueue_script() and decides what scripts must be loaded. NOT all scripts regardless. The bunch of jquery is loaded only when you use a feature that needs jquery-ui-dialog, because they are prerequisites.
    – You CAN select what social media buttons to show. II-C

    All optimisations have a tricky side. Therefor the defaults are set to maximize the probability that the plugins features work on any theme and in combination with any other plugins, i.e. to minimize the probability of compatibility issues.

    Any ‘optimisation’ can have – and mostly has proven in the past to have under certain circumstances – unwanted side-effects. so, if you defer scripts, reduce inline styles, do it at your own risk.

    If you do not know if something is possible, ask me, or do more research, but do not state here that it is impossible and/or wrong, please. I do appreciate your positive feedback, i do not appreciate “blind” criticism.

    If you have an issue with duplicate loading of pinterest script, ask me to make it swtch-offable, or don’t you want to have setting number 954?

    @cooldavidoff

    My sessions table seems not to grow above 1-2 mb. Also i see no performance hit from the plugin (and i’m using a limited resources hosting shared-plan). But WPPA is not definitely a lightweight plugin, that is for sure.

    As for Jacob, in my case, he has responded to each and every request or question i have posted here and even gone out of his way to help. For free.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Huge Performance Hit / Can you revise plugin?’ is closed to new replies.