PDA

View Full Version : Board Optimization - True Asynchronous Cron Jobs using Javascript [!AJAX]. No more hanging page loads.


Analogpoint
10-17-2007, 10:00 PM
How vB's Cron Jobs Work (and the problem with them)
vBulletin has a great, built-in scheduled task system. It relies on an invisible pixel image output on the bottom of the forum pages to run the scheduled tasks (cron jobs). It works like this: When a user visits a page, vB checks to see if there are any pending cron jobs to execute. If there are, the cron image is inserted at the bottom of the page. That image, instead of displaying a real image, actually calls the scheduled task script which first returns the image, then proceeds to execute the scheduled task. This setup can cause the page load to hang, depending on what browser you're using. vB goes to great lengths to send the content-length header, then flush the image data to the browser. This causes some browsers to stop loading the page even though the script isn't finished running (it has to execute the cron job), since the data returned matches the content-length header. However, not all browsers are that smart. Sometimes they sit there with whatever indicator they have spinning, saying the page is still loading, until the scheduled task has finished.

How this product works, and how it fixes the problem
This add-on fixes the problem. How it works:
1. First it checks to see if the user has Javascript enabled. No Javascript means the standard vB cron image is used, so your scheduled tasks keep running.
2. If Javascript is enabled, then a short snippet of Javascript is inserted at the bottom of the page instead of the cron image.
3. What this Javascript does is first wait until the page is completely loaded. After the page is loaded, it ask for the standard vB cron image, which runs your scheduled task. After the image is loaded, it displays it (it's invisible) at the bottom of the page. It's as simple as that.

The advantage of this setup is that the cron image is requested via Javascript after the page is done loading, so that the user doesn't think something is wrong and wonder why the page won't finish loading.

Installation
Import the product XML via the Product Manager. You can enable/disable the product in the JS Cron Image Options group.

Technical Specs
This product adds one plugin which inserts Javascript where the vB cron image used to go. That's it.

History
Version 1.0.0 - Initial Release
Version 1.0.1 - Better compatibility with vBa and other 'portal' scripts. $vbulletin->options['bburl'] is prepended to the cron image URL.

This product doesn't change how cron jobs execute at all, it only requests the cron image (which starts cron job execution) in a different way, so that the user doesn't have forever-loading pages.

If you use this, please click Mark As Installed.

DragonMasterNYC
10-18-2007, 04:05 PM
I like it installing now

dazed12
10-18-2007, 05:14 PM
i've installed and trying it out. looks nice
thanks

aveon
10-18-2007, 06:42 PM
so this speends up our forum or what

Mrdby
10-18-2007, 06:48 PM
interesting

DragonMasterNYC
10-18-2007, 06:48 PM
so this speends up our forum or whatYes it does just a little your forums won't stall when a task is being done.

ciprianrpp
10-18-2007, 06:49 PM
works pretty..thank you . installed

Mrdby
10-18-2007, 06:51 PM
installed

aveon
10-18-2007, 06:56 PM
yea installed and works fine thanx

TTG
10-18-2007, 07:17 PM
Excellent addition .. thanks Analogpoint

Clicked install :up:

Milad
10-18-2007, 08:13 PM
Very good.

But, will be there a conflict with the <body onload="bla bla bla">?

Is it compatible with all browsers? especially IE6-7 FF1.5 FF2.

Mrdby
10-18-2007, 08:45 PM
When i refresh using Mozilla..it gives me a grey screen and then goes back to normal.Why is that?

PoetJA-1975
10-18-2007, 11:40 PM
Interesting share = Thanx ;)

Jacquii.

Lizard King
10-19-2007, 02:29 AM
<a href="https://vborg.vbsupport.ru/showthread.php?t=123719" target="_blank">https://vborg.vbsupport.ru/showthread.php?t=123719</a>

Analogpoint
10-19-2007, 03:23 AM
Very good.

But, will be there a conflict with the <body onload="bla bla bla">?

No.

Is it compatible with all browsers? especially IE6-7 FF1.5 FF2.
Yes.

When i refresh using Mozilla..it gives me a grey screen and then goes back to normal.Why is that?
This doesn't affect the display of your forums layout in any way.

https://vborg.vbsupport.ru/showthread.php?t=123719

That's a classic case of using a bulldozer to knock over a molehill. You have to upload a Javascript file, and a php file, as well as install the product. It uses AJAX where AJAX is not needed. It makes you run a hacked version of vB's cron.php file. It doesn't work with vBadvanced, vBdruapal and others. I'm not sure how it deals with users who don't have Javascript enabled. This mod has none of those problems. Shall I continue?

PoetJA-1975
10-19-2007, 06:43 AM
was waiting for the above statement to install :)
Thanx for the share!

Jacquii.

succo
10-19-2007, 08:33 AM
ehm... to make it work under vbadvanced (i mean, the portal) i had to subst cron.php in the plugin with the full path to cron, or it was searching for cron in the root folder, obviously not finding it :)

btw, yes, this seems to speed up loading very much, thanks!

Mecho
10-19-2007, 09:59 AM
would u plz someone explain how we should kno that it works or not ?? i mean where we can find any detail that how it works in our board and ... !!

thanks

Analogpoint
10-19-2007, 02:02 PM
ehm... to make it work under vbadvanced (i mean, the portal) i had to subst cron.php in the plugin with the full path to cron, or it was searching for cron in the root folder, obviously not finding it :)

btw, yes, this seems to speed up loading very much, thanks!
It has the same behaviour as the default vB cron image, which also wouldn't be inserted into vBa pages.

would u plz someone explain how we should kno that it works or not ?? i mean where we can find any detail that how it works in our board and ... !!

thanks
View your cron log and see if the scheduled tasks are being run. :)

Analogpoint
10-19-2007, 02:33 PM
ehm... to make it work under vbadvanced (i mean, the portal) i had to subst cron.php in the plugin with the full path to cron, or it was searching for cron in the root folder, obviously not finding it :)

btw, yes, this seems to speed up loading very much, thanks!

I've updated the product (version 1.0.1) to use $vbulletin->options['bburl'] so that it will have better out-of-the-box compatibility with vBa and other portal scripts. If you're not using a portal script, there's no reason to update, but it also won't hurt anything if you do update. :)

DragonMasterNYC
10-19-2007, 03:25 PM
I'll see how this update is when I install MK portal even though its not completely integrated with vBulletin.

almqdad
10-19-2007, 07:05 PM
THANKS Analogpoint

GReAT HACK

Mrdby
10-19-2007, 07:35 PM
No.


Yes.


This doesn't affect the display of your forums layout in any way.



That's a classic case of using a bulldozer to knock over a molehill. You have to upload a Javascript file, and a php file, as well as install the product. It uses AJAX where AJAX is not needed. It makes you run a hacked version of vB's cron.php file. It doesn't work with vBadvanced, vBdruapal and others. I'm not sure how it deals with users who don't have Javascript enabled. This mod has none of those problems. Shall I continue?

lmao get em

iogames
10-19-2007, 07:37 PM
Time has teach me to wait for the second version :D
Great-must install!

Analogpoint
10-19-2007, 07:49 PM
I'll see how this update is when I install MK portal even though its not completely integrated with vBulletin.
Great! Post back here and let us know how it worked.

lmao get em
:) Actually I wasn't intending to attack the authors of the other mod. They have a valid way of doing it. I just think this mod accomplishes the same thing (Asynchronous Cron Jobs) in a *lot* simpler and less error-prone fashion.

Saviour
10-20-2007, 12:28 AM
Noticeable improvement on page loading time. Much appreciated! Marked Installed...

Kihon Kata
10-20-2007, 02:08 AM
What? I only see a XML to import, no files.

You have to upload a Javascript file, and a php file, as well as install the product.

Analogpoint
10-20-2007, 04:18 AM
What? I only see a XML to import, no files.

That's right, for this product, all you have to do is import the XML file.

BobbyBig
10-20-2007, 10:47 AM
How about including what browsers do problems..

Mecho
10-20-2007, 12:37 PM
View your cron log and see if the scheduled tasks are being run. :)

i searched everywhere but i couldnt find anything ! would u plz tell me where exactly i have to look ?

p.s. JS Cron Image Options is Enabled

Thanks

Tulsa
10-20-2007, 01:01 PM
i searched everywhere but i couldnt find anything ! would u plz tell me where exactly i have to look ?

p.s. JS Cron Image Options is Enabled

Thanks

Admincp > Statistics & Logs > Scheduled Task Log

You can view any of all of your cron jobs

Analogpoint
10-20-2007, 01:03 PM
How about including what browsers do problems..
I tested it in IE6, IE7, FF2, Opera9. It should work in *any* browser that runs Javascript. And remember, if Javascript is not available, it reverts back to the standard vB cronimage so your scheduled tasks continue to run.

i searched everywhere but i couldnt find anything ! would u plz tell me where exactly i have to look ?

p.s. JS Cron Image Options is Enabled

Thanks

Admin Control Panel -> Scheduled Tasks (near the bottom) -> Scheduled Task Log.

Kihon Kata
10-20-2007, 01:04 PM
Hey, Analog, How do we know it's working?

Mecho
10-20-2007, 01:58 PM
Admin Control Panel -> Scheduled Tasks (near the bottom) -> Scheduled Task Log.

Thanks but i dunno y i can not see any log for this cron !!

Analogpoint
10-20-2007, 02:18 PM
Hey, Analog, How do we know it's working?
Check your logs.

Admin Control Panel -> Scheduled Tasks (near the bottom) -> Scheduled Task Log.


Thanks but i dunno y i can not see any log for this cron !!

Are there any logs for scheduled tasks from before installing this product? Do you have any scheduled tasks set up and enabled? Have you had any forum visitors? (if you don't your scheduled tasks won't run)

I'll reiterate. This mod doesn't change how scheduled task run. It only changes how the cronimage is loaded into the footer of the site.

Mecho
10-23-2007, 01:14 PM
yea i have many scheduled logs ! but i can not see any log for this mod in LOGS :(

Analogpoint
10-23-2007, 05:41 PM
yea i have many scheduled logs ! but i can not see any log for this mod in LOGS :(

There's no log for this mod. If your regular scheduled tasks are running, then this mod is doing it's job. This mod simply runs all your regular scheduled tasks, it just works better than the default vB cronimage.

Mecho
10-24-2007, 11:59 AM
today i check the scheduled tasks and i saw the times r for 4 days before !! and next time running time was for 3days before !!
any idea ???

Analogpoint
10-24-2007, 07:54 PM
today i check the scheduled tasks and i saw the times r for 4 days before !! and next time running time was for 3days before !!
any idea ???

If you don't have any forum visitors the scheduled tasks can't run. If you want to test it, disable this product, and the scheduled task log will look exactly like it does with it enabled.

andrewy3k
10-28-2007, 04:55 AM
I have a question.. is there any way to really tell if this actually improves loading times?.. Anyone actually test to see? And is it a more efficient hack for big boards?

thanks ahead of time

Analogpoint
10-28-2007, 05:19 AM
I have a question.. is there any way to really tell if this actually improves loading times?.. Anyone actually test to see? And is it a more efficient hack for big boards?

thanks ahead of time

This won't improve loading times. The entire page still has to load, and this mod does not affect that. What it does do is keep the page from appearing to hang when it is "almost" done loading. It appears to hang (in some, not all cases), because the pixel image at the bottom of the page, that calls the cron script doesn't load until the cron script is done running. This mod requests the cron image via JS after the page has been loaded, eliminating the annoying pages that are apparently loaded (visually they are all there), but the loading indicator in the browser says the page is still loading because the cron image is still loading.

andrewy3k
10-28-2007, 05:27 AM
hmm, I'm trying to recall if thats ever been noticeable on my board.. if there is hang time maybe half a second to a second max to a point it may not be noticeable.. not sure what I should be looking for :) .. the only hangtime I notice is loading after $navbar .. but thats just because I have a larger board..

The Bish
10-28-2007, 05:55 AM
Good lord man! This has solved an issue I have been having with my board for some time. Where in the hell do I send your Christmas Card too?

andrewy3k
10-28-2007, 06:45 AM
Good lord man! This has solved an issue I have been having with my board for some time. Where in the hell do I send your Christmas Card too?

whats that?.. please do share.. :)

The Bish
10-28-2007, 07:04 AM
I have been having the page load and then hang for what seemed like 5 seconds. Had members complain that it took upwards of 5 seconds or more at times to load. I have been IMing a few of them and they all say it is loading faster although one person says I have a ton of shit html which could also be an issue. So as far as the load hang goes... the usual complainees seem to think it is working better since the install.

PoetJA-1975
10-28-2007, 07:29 AM
Noticeable improvement on page loading time. Much appreciated! Marked Installed...

I agree! Thanx so much to the Author of this fine modification ;)

Jacquii.

andrewy3k
10-28-2007, 08:48 AM
Maybe I should try .. see if it makes any difference.. I don't think it will.. but wont hurt

andrewy3k
10-28-2007, 06:04 PM
I tried it.. didn't see any noticeable differences.. in both FF and IE

timothydog76
10-29-2007, 12:20 AM
Installed this today. Seems cool. I noticed one minor glitch (nitpicking really). If I look in the plugins manager the drop-down box and "Go" button are oriented funny. Is this an issue anyone else is seeing?

Thanks,

jawatkin
10-29-2007, 03:04 AM
This is a godsend, seriously. I always hated that delay, it was annoying as ever.... And now... Thank you!!

Analogpoint
10-30-2007, 04:53 PM
Installed this today. Seems cool. I noticed one minor glitch (nitpicking really). If I look in the plugins manager the drop-down box and "Go" button are oriented funny. Is this an issue anyone else is seeing?

Thanks,

That is a problem with vBulletin (with any products you install), and is not directly related to this product. But I hear you, I think it's annoying too. :)

Code Monkey
11-01-2007, 06:04 AM
https://vborg.vbsupport.ru/showthread.php?t=123719



That's a classic case of using a bulldozer to knock over a molehill. You have to upload a Javascript file, and a php file, as well as install the product. It uses AJAX where AJAX is not needed. It makes you run a hacked version of vB's cron.php file. It doesn't work with vBadvanced, vBdruapal and others. I'm not sure how it deals with users who don't have Javascript enabled. This mod has none of those problems. Shall I continue?

That's a nice bulldozer post to get people to use your product instead of the original. lol Nothing like being insulted by someone you don't know.

Just to answer your mud flinging.

The hacked cron file returns less crap that is not needed and prevents many issues that were found using cron.php.

The uploaded javascript is cached by the users browser where your inline js must be downloaded with each and every page load.

It works fine with vbadvanced.

And as far as users without js, it defaults to the normal vb method.

Oh, and it only loads when a cron is to be run. Not every page load like this one.

And what's best of all, it's original.

Nice people don't fling mud. Have a nice day.

Analogpoint
11-01-2007, 06:59 AM
That's a nice bulldozer post to get people to use your product instead of the original. lol Nothing like being insulted by someone you don't know.

Just to answer your mud flinging.

The hacked cron file returns less crap that is not needed and prevents many issues that were found using cron.php.

The uploaded javascript is cached by the users browser where your inline js must be downloaded with each and every page load.

It works fine with vbadvanced.

And as far as users without js, it defaults to the normal vb method.

Oh, and it only loads when a cron is to be run. Not every page load like this one.

And what's best of all, it's original.

Nice people don't fling mud. Have a nice day.


Code Monkey,

I offer you my sincerest apologies. I created this mod for my own personal use, and I created it to the best of my abilities. My post that you call 'mud flinging' was an attempt to compare the two mods, only since someone asked. I never told anyone to use my mod instead of yours, everyone's free to use what they want. My personal preference with modifications, is the simpler and more straightforward it is, the better. You have misinformation in your post, concerning both the mods, which I won't respond to. Each user can decide for themselves which mod they want to install, if any. I hope you'll forgive me and not feel that I'm stepping on your toes. I hope we can peacefully coexist here on vB.org.

Respectfully,
David.

mhackl
11-01-2007, 08:02 AM
I installed this and noticed a significant increase in performance. Better in Firefox than IE though.

JohnBee
11-02-2007, 01:30 AM
Thanks for this! very smart MOD .twothumbsup.

Paxion
11-06-2007, 01:33 PM
Greatest mod I have so far.... and my forum has pretty much everything.

kollam003
11-08-2007, 09:59 AM
Indianprofits.com clicks install

class101
11-09-2007, 10:39 AM
thank you , this addon fixed a problem I had with $cronimage and Zoints Tags rewritten urls

69lakalle
11-15-2007, 02:27 PM
Can you add an option were we can set the sizes for posts and signatures separate ?

plothook
12-06-2007, 10:50 AM
* Clicks Mark as Uninstalled *
Those annoying hangs in Firefox are a thing of the past!

Thanks Analogpoint!

MrNase
12-06-2007, 09:12 PM
Does it only attach the plugin code when there is a cron job that needs to be run?

cosy
12-20-2007, 07:56 PM
any plans to get this for 3.7 ?

dashed
05-02-2008, 12:47 AM
Does this work for vb 3.7?

K4GAP
05-02-2008, 12:59 PM
Waiting for answer to last two posts.... 3.7 ?

Helloooo, anyone there? lol, sorry I get in a hurry sometimes :)

Milad
05-03-2008, 12:08 AM
I think it works. the developer is absent since 06 Dec 2007

ArnyVee
06-18-2008, 04:48 PM
I can't really tell if it's working or not, to tell you the truth :)

But, I haven't had any issues and I'm running 3.7.1 P1

trilljester
06-18-2008, 06:38 PM
I'll give this a shot to see if my cron jobs will execute better.

I wish Jelsoft would give us that have actual shell access to our servers the ability to execute the cron jobs from a shell-based cron, rather than PHP-based.

Fenriz
08-19-2009, 08:12 PM
Does it work with vb 3.8.x ?

Jazzi
09-16-2009, 11:30 AM
Working for 3.8.4. :)

too_cool_3
02-04-2012, 08:58 PM
Does this mod do anything in vB 4 and does it work?

Max Taxable
01-13-2014, 02:48 AM
Installed on a v3.8.6 and actually also moved the $cronimage call out of the footer template and into the headinclude template.

fxdigi-cash
06-13-2015, 12:40 PM
works on vb 4.2.2 perfectly! no issues at all. one of the best articles ever! Big Thanks

pl804
12-15-2015, 03:23 PM
Do modern browsers still hang when the pixel calls a scheduled task, or has this been resolved by the latest browser versions?