vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   My plugin suddenly started slowing down my forum (https://vborg.vbsupport.ru/showthread.php?t=281338)

Jeremy8 04-09-2012 10:32 PM

My plugin suddenly started slowing down my forum
 
I made a plugin that get's the number of users in my IRC and puts the number in the tab that links to the IRC. For example, if there are 8 people in the IRC, the tab says "Chat: 8".

Anyway, the plugin that gets the number and makes it into a variable for the tab template stopped working and made the whole forum go very slow. I've used this for about a year with no problems, so I don't know what happened.

This is the plugin:
Code:

$usercount = file_get_contents('http://usercount.geekshed.net/?chan=belltree&noimage');

vB_Template::preRegister('irc_navtab',array(
'usersin' => $usercount
));


$template_hook['users_in_chat'] = $usercount;

You can see that the URL above contains a number of the amount of users in the IRC room. http://usercount.geekshed.net/?chan=belltree&noimage

Here's the tab's template if you need to see it for any reason

Code:

<li<vb:if condition="$vbulletin->options['selectednavtab'] == 'chat'"> class="selected"</vb:if>><a class="navtab" href="chat.php">Chat<vb:if condition="$usersin != 0">: {vb:raw template_hook.users_in_chat}</vb:if></a></li>

SEOvB 04-09-2012 11:06 PM

This is a bit of speculation on my part, but the issue might actually be with the request time for that http page. I believe the script freezes while it's waiting for the page to load, so any slowness on the part of that page would result in slow loading times for all of your pages.

Why don't you fetch the number with ajax javascript? That would allow your page to load first, even if the counter page is loading slowly, and it would take the burden off your server and put it on the users' browsers.

-Nick, SEOvB Developer

Jeremy8 04-21-2012 07:22 PM

Quote:

Originally Posted by SEOvB (Post 2318497)
This is a bit of speculation on my part, but the issue might actually be with the request time for that http page. I believe the script freezes while it's waiting for the page to load, so any slowness on the part of that page would result in slow loading times for all of your pages.

Why don't you fetch the number with ajax javascript? That would allow your page to load first, even if the counter page is loading slowly, and it would take the burden off your server and put it on the users' browsers.

-Nick, SEOvB Developer

This is going to sound weird, but I think the thing actually fixed itself.

However, do you think it's still a good idea to use AJAX instead of PHP? I've never used AJAX with a vB plugin, so I'm not really sure how that would work.


All times are GMT. The time now is 02:02 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
  • Page Generation 0.01189 seconds
  • Memory Usage 1,719KB
  • 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
  • (2)bbcode_code_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (3)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete