vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3.6 Add-ons (https://vborg.vbsupport.ru/forumdisplay.php?f=194)
-   -   Add-On Releases - vBISpy - AJAX real-time feed of new posts/threads (https://vborg.vbsupport.ru/showthread.php?t=125947)

soletrader 09-15-2006 03:23 AM

Does anybody know if this hack is server intensive?

buro9 09-15-2006 07:34 AM

Quote:

Originally Posted by soletrader
Does anybody know if this hack is server intensive?

The original version was, it did a full table scan of the thread table. The version currently attached to the thread only scans the last 24 hours of the thread table. If you're on a busy forum you should have it scan less, I scan only the last hour.

Aside from that, take a look... turn on debug mode and add explain=1 to the do=xml querystring for the php file. I'm seeing the page generated in 5 queries, all taking less than 0.01 seconds, and the largest query isn't the spy query, but the ones that fetch the datastore and templates (I'm using the template layer for spy and not the echo'd HTML that spy originally shipped with).

I also reduced the number of refreshes fired by the JavaScript, from 7 seconds down to 20 seconds. As that is the highest rate of posting on my forum around peak time, so it seemed daft to be firing off so many useless AJAX calls. I'm considering dropping it further to 30 seconds, which would be about the maximum on a large forum before you degrade the user experience of the spy.

In summary: Doesn't need to be intensive, but the first version was.

Oh, and the JavaScript is horrible. All kinds of dodgy 1.0 stuff and bizarre splitting of strings. I'm very much inclined to re-write that stuff using proper DOM stuff. vBulletin is largely XHTML, there's not much excuse to break that on this page through the use of innerHTML rather than DOM manipulation. Besides... use one or the other, both are fast, but combined they are cludgy. So I'm going to change most of mine to fully use DOM stuff, and get rid of those arrays of data when objects would be just as good, or using the original responseXML.

Anyway... rambling... low server load if you use the latest version.

ForumDog 09-15-2006 08:03 AM

Quote:

Originally Posted by MPDev
I'd probably say that any code to support other plugins should not be standard; if you use that mod you can add the code as you documented.

Fair enough. :) I've added the hack title and author name to the post so others can find it if they search.

buro9, would you release your improvements? I also moved the code except the inside of the table rows to the templating system and changed the non-IE XHTML to divs and spans with CSS for better markup and to fix the Opera rendering failure, plus some other cosmetic changes/additions. It's currently driving me nuts that the HTML is all inside the JS and I can't use conditionals or anything like that.

It would be really great if I could and the code was vB consistent if I could twist your arm. :)

buro9 09-15-2006 08:19 AM

When I've done the DOM JavaScript stuff I'll post it here. It may be a few weeks though, I'm still running the old javascript on my site, the new stuff I haven't had tested in many browsers (just Firefox on Ubuntu), so I've yet to even get it past IE on Windows ;) And I'm going to be distracted and slow working for a fortnight as my girl is coming to stay for a couple of weeks... this takes a lower priority ;)

As for the basics to make things better now:
In vaispy.php:
REPLACE:
Code:

$daysprune = 1;
WITH:
Code:

$daysprune = 0.04;
That will take one days worth of queries down to 1 hour worth of queries (57.1 minutes to be precise). So even fewer rows in the thread table locked.

In va_spy.js:
REPLACE:
Code:

var xmldelay = 7000;
WITH:
Code:

var xmldelay = 20 * 1000;
AND

REPLACE THE TWO INSTANCES OF:
Code:

setTimeout("getXML()", 5000);
WITH:
Code:

setTimeout("getXML()", xmldelay);
That changes the time between polling for updates from 7 seconds to 20. I prefer doing the math like that as it makes it obvious it's 20 x 1000 milliseconds = 20 seconds.

Changing that you will have taken each users average 10 queries per minute down to 3 queries per minute. Change it to 30 seconds and they'll be down to 2 queries per minute. Any time span higher than this will reduce the beauty and usability of the spy page too much for my liking. But quiet forums could easily get it to 1 minute per poll.

I also don't like * queries in SQL, so I changed in vaispy.php:
Code:

    $getthreads = $db->query_read("
        SELECT thread.*, post.pagetext AS preview, post.userid AS lastpuserid
        FROM ".TABLE_PREFIX."thread AS thread
        LEFT JOIN ".TABLE_PREFIX."deletionlog AS deletionlog ON(thread.threadid = deletionlog.primaryid AND type = 'thread')
        LEFT JOIN ".TABLE_PREFIX."post AS post ON(post.postid = thread.lastpostid)
        WHERE open <> 10 AND thread.lastpostid > $lastpostid
        AND forumid NOT IN (0$blockforums)
        AND thread.visible = '1'
                AND post.visible = 1
        AND deletionlog.primaryid IS NULL
        $datecut
        ORDER BY lastpost DESC LIMIT 10");

TO:
Code:

    $getthreads = $db->query_read("
      SELECT thread.forumid,
            thread.firstpostid,
            thread.lastpost,
            thread.lastposter,
            thread.lastpostid,
            thread.replycount,
            thread.threadid,
            thread.title,
            thread.views,
            post.pagetext AS preview,
            post.userid AS lastpuserid
        FROM " . TABLE_PREFIX . "thread AS thread
            LEFT JOIN " . TABLE_PREFIX . "deletionlog AS deletionlog ON (thread.threadid = deletionlog.primaryid AND type = 'thread')
            LEFT JOIN " . TABLE_PREFIX . "post AS post ON (post.postid = thread.lastpostid)
      WHERE open <> 10
        $datecut
        AND forumid NOT IN (0$blockforums)
        AND thread.visible = '1'
        AND thread.lastpostid > $lastpostid
        AND post.visible = 1
        AND deletionlog.primaryid IS NULL
      ORDER BY thread.lastpost DESC LIMIT 10
    ");

The difference on that is neglible on performance, but I prefer to know what my queries return.

bashy 09-15-2006 10:05 AM

Hi peeps

Can someone please take a look at my vaispy.php as the opacity is not working this time. It worked the last time i edited the page to my liking, but then i updated and lot it all, so i have now done it again but the opacity is not working on the last few posts at all....

You can view it here untill i remove for guests http://www.bashys-place.com/forums/vaispy.php

I have enclosed the php for you to check if you have time please?

Also done a quick scout and cannot find how i could stop guests from using this please?
At present guests can only see 10 or so posts, memebsr can see 45, i dont want guests seeing any!

ForumDog 09-15-2006 10:08 AM

Quote:

Originally Posted by bashy
Hi peeps

Can someone please take a look at my vaispy.php as the opacity is not working this time. It worked the last time i edited the page to my liking, but then i updated and lot it all, so i have now done it again but the opacity is not working on the last few posts at all....

You can view it here untill i remove for guests http://www.bashys-place.com/forums/vaispy.php

I have enclosed the php for you to check if you have time please?

Also done a quick scout and cannot find how i could stop guests from using this please?
At present guests can only see 10 or so posts, memebsr can see 45, i dont want guests seeing any!

There's a post near the beginning that says how restrict permissions to member's only, have a search.

The opacity was not correct in the first place, it's one of the fixes I made I'll post it with the rest soon. Thanks buro9 :) great to see people working together on this mod.

MPDev 09-15-2006 11:31 AM

Quote:

Originally Posted by buro9
All kinds of dodgy 1.0 stuff and bizarre splitting of strings.

In the latest version I got rid of that code as well; for IE I just use a string.

I'll change the query in the next update so everyone can benefit from the improvement.

And nice to have others putting in the effort! Thanks.

bashy 09-15-2006 02:22 PM

I did have the opacity working the on 1st install, it was fine :)

Quote:

Originally Posted by ForumDog
There's a post near the beginning that says how restrict permissions to member's only, have a search.

The opacity was not correct in the first place, it's one of the fixes I made I'll post it with the rest soon. Thanks buro9 :) great to see people working together on this mod.


MPDev 09-15-2006 04:03 PM

It works for IE, but not on FF; I assume it's a tag, but haven't had the time to go looking just yet.

MPDev 09-16-2006 01:55 AM

Quote:

Originally Posted by ForumDog
I also moved the code except the inside of the table rows to the templating system and changed the non-IE XHTML to divs and spans with CSS for better markup and to fix the Opera rendering failure, plus some other cosmetic changes/additions.

The Opera fix would be helpful; as I am sure the others would be. Thanks for sharing.


All times are GMT. The time now is 01:10 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01649 seconds
  • Memory Usage 1,767KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (8)bbcode_code_printable
  • (6)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (3)pagenav_pagelinkrel
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (10)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete