PDA

View Full Version : Board Optimization - Plugin Based Template Cache


Pages : 1 [2]

ociosos
01-18-2007, 06:11 PM
it is really nice hack....
but it is not VBADVANCED CMPS Friendly :(

having some issues with it :(

amcd
01-18-2007, 07:31 PM
Installed the 'experimental' stuff on my live board. Its running fine so far. xcache does not show any discernible increase in memory consumption.

orban
01-20-2007, 09:41 AM
Yes, it is only happening on some pages. I am thinking it is an issue with those pages, but I don't really know what to look for.

I reverted to the default method to "fix" the issue.

Are you using a lot of custom templates?

Try to turn on debug mode and see if there are any uncached templates, those might causing the issue.

I could write some additional checks (which I will for sure if I ever make this thing "stable").

it is really nice hack....
but it is not VBADVANCED CMPS Friendly :(

having some issues with it :(

Are you using the experimental one?

If not, try to set the full path to the templates folder in the admincp under Plugin Based Template Cache options.

Installed the 'experimental' stuff on my live board. Its running fine so far. xcache does not show any discernible increase in memory consumption.

Cool, glad to hear :)

ociosos
01-20-2007, 07:49 PM
i got it to work now!!!!
lol
thank you :p

excellent HACK recomended!!!

I click INSTALL

THANK YOU!!!! again!!!

taibahost
01-28-2007, 02:30 PM
nise thank you

taibahost

Zia
02-09-2007, 04:32 PM
Orban,

maybe i will go a bit out of track from this hack..

here this hack works fine with APC or eAcclerator..
i have read in vb.com using this hack.. cached script will be increased

atm we are using eAcclerator , soon we move to Xcache..
and this hack will work with Xcahce too ? right?

amcd
02-09-2007, 04:36 PM
Yes, it works fine with xcache, even with the optimizer turned on.

orban
02-09-2007, 04:39 PM
Yeah I'm using it with xcache.

Zia
02-10-2007, 04:31 AM
nice to know...

can u tell me few more thing
if we allow 32Mb of Ram and if its filled up with cached script...what will happen next ?
and (i read at vb.com)Xcache's performance is better than APC & eAcclereator ?

M-Tuning
02-10-2007, 05:44 PM
Installed it, Serverload went from 5 to 2 at the moment,

With eAccelerator installed

M-Tuning
02-11-2007, 09:02 AM
I found a "bug", the quickreply doesn't work anymore,
The message is posted but you can't see it after you posted it.
You see it after you press F5 though.

orban
02-11-2007, 11:54 AM
Are you using any addons that modify the quickreply behavior?

M-Tuning
02-11-2007, 06:06 PM
I believe not, but it does work with other styles,
which template does the ajax quickreply thing?

Bulent Tekcan
02-11-2007, 09:51 PM
I believe not, but it does work with other styles,
which template does the ajax quickreply thing?

I have been using this plugin since 6-7 months without any problem.Also our boards realy under heavy traffic and also list in bigboards.

Are you use mod_security ? If you use this module check your conf. because some POST action hang on quickreply screen.

M-Tuning
02-12-2007, 02:25 PM
I solved the problem, I reverted the Template and added my mods to it.

And know it works :P

Mudvayne
02-20-2007, 06:22 PM
Installed again & also nominated for MOTM :).

Xplorer4x4
03-03-2007, 05:27 PM
My forums are in the root folder so I have put templates folder into the root directory. For soem reason this will only cache my templates into my forums/server root and not /templates.

Any idea why this might be happening?

orban
03-03-2007, 08:22 PM
Have you tried setting the full path in the options?

Xplorer4x4
03-04-2007, 03:01 AM
Have you tried setting the full path in the options?

Yes I tried /home/name/www/templates and /home/name/public_html/templates and it still writes to the root.

Frames
03-05-2007, 10:19 AM
Hi,

I install with Cache Templates Seperately (I have APC)

¿Is normal the templates folder is empty?

¿Are all files cached in APC?

thanks

orban
03-05-2007, 10:23 AM
No, the templates folder is not supposed to be empty.

Have you set the correct permissions for the templates folder?

Xplorer4x4
03-05-2007, 11:43 AM
No, the templates folder is not supposed to be empty.

Have you set the correct permissions for the templates folder?
I have chmodded my folder to 777 but it refuses to write there. Only to the root.

Frames
03-07-2007, 12:40 AM
I can see all the templates now, I have 1 DB Server an 5 www servers, maybe this is the cause, I install in one server and update the pluggin options in the others.

Nominated Pluggin! very good for big forums!

Do you have some plugin to cache the home and forumdisplay, and update every 5 minuts?

thanks!

pd: if you are interested to work modding vbulleting please send me a private message

Xplorer4x4
03-07-2007, 12:37 PM
Also my templates do not update after i edit them unless i disable this, even if i clear my browsers cache.

da420
03-07-2007, 04:37 PM
Also my templates do not update after i edit them unless i disable this, even if i clear my browsers cache.

This happens to me sometimes too.

When I go into make template edits I just disable this modification. Then once I am done, I re-enable it, and alls well....

Xplorer4x4
03-07-2007, 04:43 PM
This happens to me sometimes too.

When I go into make template edits I just disable this modification. Then once I am done, I re-enable it, and alls well....

I tried this to but when i turn it back on, the edit is still in the HTML of the template but does not show up.

orban
03-07-2007, 04:45 PM
You can always just clear the templates folder manually.

Xplorer4x4
03-07-2007, 04:50 PM
Well my templates wont cache to any where but the forum root but i delete all the files related to this cache system and the templates still do not update.

thincom2000
03-07-2007, 05:43 PM
If you are using the experimental version, then yes, you have to clear the folder manually. If you are using the stable version, however, it should automatically clear whenever a page in the AdminCP loads (I believe it uses the admin_global hook).

Xplorer4x4
03-07-2007, 05:51 PM
I am using 1.0.3

Zia
03-09-2007, 03:23 PM
I am using 1.0.3

what are u using as cacher ? APC?

orban
03-09-2007, 05:46 PM
I have chmodded my folder to 777 but it refuses to write there. Only to the root.

Well, it automatically clears the template folder so if the cache does not get written into that folder then it won't get cleared.

I really have no idea why it doesn't work, maybe ask your host if they have any special setup?

Xplorer4x4
03-09-2007, 05:51 PM
what are u using as cacher ? APC?
Just this.
Well, it automatically clears the template folder so if the cache does not get written into that folder then it won't get cleared.

I really have no idea why it doesn't work, maybe ask your host if they have any special setup?
Special setup as in php cache systems like APC XCache and eaccelerator?

orban
03-09-2007, 05:54 PM
That shouldn't affect PHPs writing capabilities :/

Zia
03-10-2007, 07:36 AM
helo Xplorer..

umm u can have a try to use another cacher rather than APC.

Zia
03-10-2007, 08:11 AM
This happens to me sometimes too.

When I go into make template edits I just disable this modification. Then once I am done, I re-enable it, and alls well....

if ur on Xcache. u have to turn on
xcache.stat = on

if u set it off. it wont work.

Zia
03-10-2007, 08:13 AM
Orban,
Helo..
can u say whats the difference between urs hack (this thread) & This One (https://vborg.vbsupport.ru/showthread.php?t=139151)

both is template cacher..really very much confused..
this 2 can be use together?
(maybe ur on Xcache.im on xcache too)

Thanks

amcd
03-10-2007, 08:41 AM
Orban,
Helo..
can u say whats the difference between urs hack (this thread) & This One (https://vborg.vbsupport.ru/showthread.php?t=139151)

both is template cacher..really very much confused..
this 2 can be use together?
(maybe ur on Xcache.im on xcache too)

Thanks
From a quick read it seems that one tries to cache templates in the variable space of the php opcode cacher (APC/xcache/other), whereas orban's tries to create php files out of the templates, so that they get cached automatically by the cacher.

If properly implemented, both should give similar benefits, but IMHO the other one needs some more work to become fully stable. Even after that, new users will continue to face problems because by default the opcode caching programs have the variable memory disabled.

orban
03-10-2007, 09:33 AM
I don't think it avoids eval calls like mine does (which is the whole point of mine). It just saves the templates in the variable cache of apc/xcache/eac/mmcache and does some compressing. I also doubt they work together (mine will just overwrite his other the other way around).

You can't avoid the eval call unless you write the templates to files.

Zia
03-10-2007, 11:21 AM
Hi amcd,
Yes i noticed ,im on Xcache.the other one caching things at var. portion & didnt cache anything at php portion. at my end i have enabled var.cache using This (https://vborg.vbsupport.ru/showthread.php?t=141005)
which is relased by mOo aka phpxcache.

Orban, finally other one tries to cache thing at var.cache instead of php cache and urs one cache to phpcache but the moto is allmost same ? just the way is difference ??
do u have any suggetions ?

compress is diff.template compression always create probs as well.

orban
03-10-2007, 11:30 AM
That modification released by mOo is nice, I'm using memcached though, but in the end it's basically the same thing.

Yeah compressing templates always causes problems.

I know, the newly released template cache by lendy just caches the templates in a variable cache. You won't save any eval() calls by doing this, you won't even avoid the unserialize as far as I know (just took at a quick glance at his code).

amcd
03-10-2007, 01:21 PM
oh, I never thought about the evals. Yes, you are right. He cannot avoid evals by caching templates in variables.

Regarding the datastore, I installed memcache, but later went back to file because I could not notice any difference. Is there a way to benchmark the datastore?

orban
03-10-2007, 01:25 PM
Well you could probably write a script to read the datastore objects 1000 times from memcached and flat files (cached in APC) and from APC var cache and see how fast it is :)

Frames
03-10-2007, 01:46 PM
Hi, more info:

Without your plugin mysql use: 60 mb/sec

With your plugin mysql use: 30 mb/sec

Thanks!!!!!

Zia
03-10-2007, 04:12 PM
oh, I never thought about the evals. Yes, you are right. He cannot avoid evals by caching templates in variables.

Regarding the datastore, I installed memcache, but later went back to file because I could not notice any difference. Is there a way to benchmark the datastore?

using that data store(xcache + its datastore cache)...
it straight reduce 2 more query at my forum home..
rcade home..it reduce 5 call...
so i think in other pages it also reduced....
yes forum got more smoother

Xplorer4x4
03-10-2007, 04:32 PM
helo Xplorer..

umm u can have a try to use another cacher rather than APC.

Huh? I am not using nay other caches with this.

bluechris
03-10-2007, 11:37 PM
I have a problem since i installed it.... suddenly the forum index shows a strange error

Warning: Unterminated comment starting line 151 in C:\Domains\corollaclub.com\wwwroot\forums\forums.p hp(539) : eval()'d code on line 151

the line 151 in forums.php is this

if ($vbulletin->options['showevents'])

Forums.php is the normal index.php that vb has but i had renamed it and i have index the cmps.

The thing is that the code in the file is fine.... even though i had replaced it with the latest and i still getting the error.

I had also uninstalled the addon with no luck...... I am with IIS6 .. php 4.4.6 with apc and mysql 4.1.16.

Anyone has any clue?

amcd
03-11-2007, 08:55 AM
your error is on line 151 of the template which is called from line 539 of forums.php

bluechris
03-11-2007, 10:41 AM
But i havent touched something.....

the lines in forumhome template are

148 <!-- icons and login code -->
149 <table cellpadding="0" cellspacing="2" border="0" width="100%">
150 <tr valign="bottom">
151 <td>
152 <table cellpadding="2" cellspacing="0" border="0">

and in forums.php the 539 line is

($hook = vBulletinHook::fetch_hook('forumhome_complete')) ? eval($hook) : false;

I even created a new style with no parent (that supposes will have the default templates) and i get the same error.... atm i have puted in php.ini showerrors to off and i dont see it but its a problem. Is there anyway that i can debug more the error? to be more specific i mean?

amcd
03-11-2007, 10:47 AM
Line 539 is evaluating a hook, so look in your plugins, not in the template.

See which plugins are being executed on 'forumhome_complete'. One of them probably has a opening /* but no closing */

dbirosel
03-12-2007, 04:36 PM
reserved!!

orban
03-12-2007, 05:03 PM
I have a problem since i installed it.... suddenly the forum index shows a strange error



the line 151 in forums.php is this



Forums.php is the normal index.php that vb has but i had renamed it and i have index the cmps.

The thing is that the code in the file is fine.... even though i had replaced it with the latest and i still getting the error.

I had also uninstalled the addon with no luck...... I am with IIS6 .. php 4.4.6 with apc and mysql 4.1.16.

Anyone has any clue?

Are you using the experimental version?

reserved!!

Pardon?

Zia
03-13-2007, 04:28 AM
helo orban,

here its ur experiemntal one ?
https://vborg.vbsupport.ru/showpost.php?p=1157214&postcount=242

i got spaces for using it...but could u plese be more specific...or can u just make the function.php or whatever.php files here .. i want to go for it..if it give more output......

Looking for ur help.
Thnx.

GrendelKhan{TSU
03-16-2007, 12:19 PM
woot

|Jordan|
03-18-2007, 12:33 AM
Where can i get the opcode cache plugin?

Zia
03-18-2007, 06:22 AM
Where can i get the opcode cache plugin?

do u have any opcode cacher installed ?
like Xcache /eAcc or APC ?

Orban's mod will boost cacher....


if ur on xcache u can also try IT (https://vborg.vbsupport.ru/showthread.php?t=141005)

orban
03-18-2007, 09:20 AM
Where can i get the opcode cache plugin?

Sorry, what do you mean?

You don't need any vBulletin modification to run APC/aAccelerator/xcache.

Zia
03-18-2007, 12:24 PM
EXPERIMENTAL (for your dev board)

This will NEVER work with plugins who modify templates on run time so don't even try :)

Place the function in a file & create forums/cache folder


function cache_templates_one_file($templates, $templateidlist)
{
global $vbulletin, $templateassoc;

if (empty($templateassoc))
{
$templateassoc = unserialize($templateidlist);
}

if ($vbulletin->options['legacypostbit'] AND in_array('postbit', $templates))
{
$templateassoc['postbit'] = $templateassoc['postbit_legacy'];
}

foreach ($templates AS $template)
{
$templateids[] = intval($templateassoc["$template"]);
}

/* THE ACTUAL PLUGIN */
$templatefile = 'cache/'.md5(implode(',', $templateids)).'.php';
if (file_exists($templatefile))
{
include($templatefile);
}
else
{
$templatecache = '';
/* END ACTUAL PLUGIN */
// run query
$temps = $vbulletin->db->query_read("
SELECT templateid, title, template
FROM " . TABLE_PREFIX . "template
WHERE templateid IN (" . implode(',', $templateids) . ")");
// cache templates
while ($temp = $vbulletin->db->fetch_array($temps))
{
/* START ACTUAL PLUGIN */
preg_match_all('/\$[a-zA-Z][a-zA-Z\_0-9]+/', $temp['template'], $out);
$vars = array_unique($out[0]);
$templatecache .= '
/* '.$temp['title'].' */ $template_vars['.$temp['templateid'].'] = \''.implode(', ', $vars).'\'; function template_'.$temp['templateid'].'('.implode(', ', $vars).') { return "'.$temp['template'].'"; } ';
/* END ACTUAL PLUGIN */
}
$vbulletin->db->free_result($temps);
/* START ACTUAL PLUGIN */
$fp = fopen($templatefile, 'w+');
if ($fp && flock($fp, LOCK_EX))
{
fwrite($fp, '<?php '.$templatecache.' ?>');
flock($fp, LOCK_UN);
fclose($fp);
}
include($templatefile);
/* END ACTUAL PLUGIN */
}

foreach ($templates AS $template)
{
if (substr($template, 0, 17) == 'editor_jsoptions_' or substr($template, 0, 14) == 'editor_styles_')
{
$vbulletin->templatecache[$template] = call_user_func('template_'.intval($templateassoc["$template"]));
}
else $vbulletin->templatecache[$template] = '".template_'.intval($templateassoc["$template"]).'('.$template_vars[intval($templateassoc["$template"])].')."';
#$vbulletin->templatecache[$template] = '';
}

$vbulletin->bbcode_style = array(
'code' => &$templateassoc['bbcode_code_styleid'],
'html' => &$templateassoc['bbcode_html_styleid'],
'php' => &$templateassoc['bbcode_php_styleid'],
'quote' => &$templateassoc['bbcode_quote_styleid']
);
}

And call it in "cache_templates" hook (adjust the path for the file with the function in it)

include('includes/functions_hooks.php');
cache_templates_one_file($globaltemplates, $style['templatelist']);
$globaltemplates = array();

does not delete cache when modifying templates and no options in it, please

ONLY USE THIS IF YOU KNOW WHAT YOU ARE DOING and understand the code

It basically reads all templates and creates a function for every template with all the variables in it passed as arguments so you can avoid scope issues.

Please note this takes up A LOT of space in xcache/APC (about 40mb for the cache/ files alone) so make sure you have enough space allocated (I'm using 128mb atm and that works fine).

Again please don't install this if you don't know PHP well and know what you're doing. Just sharing this because I've been using it for a few days successfully and maybe somebody can use it. :) This mod doesn't modify the database or any vB files (like the version you can download).

Orban,could u please help a bit more about it...

orban
03-18-2007, 12:32 PM
I just don't have the time right now to support this thing (I mean check the number of pages in this thread, and the experimental is indeed experimental and there's several issues to be worked out).

Zia
03-18-2007, 12:40 PM
ah ha..Okay..
just thought it might be good than the existing one...so wanted to give a try....

Okay....but like this existing mods "boost up php cache" for any opcode cacher...
is there any way to boost up var.cacher ?

amcd
03-18-2007, 12:42 PM
Disable the original plugin based template cache. Under your forums, create a new folder called 'cache' and make sure it is writable by the webserver user (www or nobody or similar).

Copy everything in the first code block and put it in a new php file. Save it as yourforums.com/forums/includes/functions_hooks.php

Then, in your adminCP, open 'Add a new plugin'. Under hook location, select 'cache templates'. Under 'Plugin PHP code', put everything from the second code block in orban's post. Make sure 'active' is yes, give it a descriptive name like 'Orban's experimental template cache' and save it.

That's it.

If you ever make any changes to your templates, you have to manually delete forums/cache/*.php otherwise your template changes will not become active.

If this interferes with any other plugin, then there is no remedy as of now. You have to either stop using the other plugin or go back to the old cache.

Zia
03-18-2007, 12:51 PM
thnx amcd..

seemd it will create probs (as Orban said). But does it make it any better than the existing one?

amcd
03-18-2007, 12:59 PM
It 'may' create problems, not 'will'. It is unsupported. So you can use it if you are confident or daring.

Don't listen to me, because if something bad happens, I may not be competent to help you. It is orban's creation, and if he says it is experimental and not fit for production boards, I guess it is not. But I am using it without any problems from the day he first posted it.

edit: The only reason I am subtly urging you to use it is that I want more people to use it. That will probably put pressure on orban to develop it into a more mature solution. :)

Zia
03-18-2007, 04:44 PM
edit: The only reason I am subtly urging you to use it is that I want more people to use it. That will probably put pressure on orban to develop it into a more mature solution. :)

hahaah i believe u read my mind :P
more user more pressure developed version

what r u using as opcode cacher ? how many ram did u allocate for that?

what s ur experience about perfoamance gaining ?

amcd
03-18-2007, 05:24 PM
I am using xcache with lighttpd. I have allocated more, but 128 MB should be more than enough if you only have vbulletin.

Regarding performance gains, let us just say that I cannot imagine my forums running without xcache or this plugin. Come to think of it, I cannot imagine my forums running on apache.

btw, if you are really looking for big performance gains and have some php/mysql knowledge, do try sphinx search. The sphinx implementation for vbulletin is also orban's creation, and it is just unbelievable to say the least.

Zia
03-19-2007, 12:29 PM
ah i think yet pit forum is not in the shape to impliment sphinx search.yes i read the whole thread for sphinx by orban.Still we are not that large in size....even not in bigboards
just saw ur board...do u mind to say ur server configuration ? dedicated ?

but soon will install the new experimental one...maybe tomorrw night.....
we got 320MB Ram + 1Gb burst ram. 128MB wont be a problem for us.

amcd
03-23-2007, 11:22 AM
I am using the experimental version. Since yesterday our users were reporting few problems. The php error logs show a lot of these errors.

Call to undefined function template_4789() in /usr/home/xb/www/bbb/includes/functions.php(4605) : eval()'d code on line 1

line 4605 of functions.php calls the template called 'option'. I even tried adding a line to the beginning of the plugin, but it did not help. The line I put in was

globaltemplates[] = 'option';

orban
03-23-2007, 01:38 PM
Have you recently installed an addon?

You can also try to exclude it, it's somewhere in the function....like I excluded the css templates.

amcd
03-23-2007, 01:42 PM
no, I have not installed any add-on.

I have gone back to the original mod for now, and it seems to be working fine.

orban
03-23-2007, 05:06 PM
You could try to add "option" to

if (substr($template, 0, 17) == 'editor_jsoptions_' or substr($template, 0, 14) == 'editor_styles_')

or $template == 'option'

Or check what exactly is wrong on that line of code so I can maybe give you a fix...

amcd
03-24-2007, 07:08 PM
Weekends are very busy on my forum. I will try this next week and tell you.

COBRAws
04-07-2007, 05:09 AM
This is great orban, thank you very much ;) I see some performance improvement now.

bigbadbob0
04-10-2007, 11:43 AM
I installed this mod hoping to recover some of the increase in load I saw after upgrading from 3.0.10 to 3.6.5.

But this mod didn't help. The templates directory has 230 files making up 7.2MB of templates in it and APC shows what looks to be all of those being stored in its cache. So it is running.

However, cricket (and the scripts feeding cricket) show no discernable difference from before installing this mod and afterwards. See the attached picture. The green is the length of time in milliseconds it takes to get /forum/index.php. The red is the number of people currently browsing the forum (including guests, 15 minute timeout). You can see the big uptick in green last weekend, that was the upgrade to 3.6.5. We spent the week being slow. Easter weekend was dead for us, during which I installed this mod. Then yesterday was back to being slow.

I guess its time to upgrade hardware.

orban
04-10-2007, 11:54 AM
Do you have graphs of your server load? And MySQL load?

Also forum/index.php isn't the best choice, try showthread/forumdisplay...

What kind of server are you running this on?

amcd
04-10-2007, 12:31 PM
What did you use to get that graph?

bigbadbob0
04-10-2007, 01:10 PM
I've sent orban the server hosting these graphs for him to look at the other metrics I monitor, I don't like having them public.

As I told him, I started monitoring forumdisplay but only after my upgrade to 3.6.5. Oops.

The web and db server are both FreeBSD 5.2.

bigbadbob0
04-10-2007, 01:17 PM
What did you use to get that graph?

The software that manages keeping track of the data and generating the graphs is called Cricket. It's similar to MRTG if you've heard of that. http://cricket.sourceforge.net/

Once you get cricket setup and actually working (not the easiest thing to do) you can branch off of the example http performance demos and add in a datasource to keep the number of users online right now.

The script I use to get the number of users is:


#!/bin/sh

num_users_line=`fetch -o - http://www.mysite.com/forum 2>/dev/null | grep "Currently Active"`
echo `echo "$num_users_line" | perl -e 'while(<>){print $1 if m/: (\d+)/;}'`


If you actually get cricket up and running (or someone does) and wants me to share the cricket conf I use to get that particular graph I'd be happy to share.

|Jordan|
04-11-2007, 05:45 PM
My cache keeps getting corrupt every few days. Specifically in the way it handles javascript. All my javascripts stop working and page elements get removed as a result.

Why is this happening?

orban
04-11-2007, 05:51 PM
Were you editing templates before they broke?

|Jordan|
04-11-2007, 06:22 PM
Yes, but then i deleted all the cached files. And then about a day later they broke again without me changing anything.

orban
04-11-2007, 06:24 PM
You seem to be running *a lot* of modifications, which makes it kinda hard to debug... :/

|Jordan|
04-11-2007, 06:48 PM
Yea, i know, i kinda went crazy on the modifications (70 of them :O).

cobby
04-20-2007, 04:51 PM
Excellent mod orban, it's saved alot of people alot of resources & load times.

I've read the whole thread and have 1 nagging question, it was asked pages back and didn't get resolved.

I'm using the Display Count of Unread Posts in Welcome Box (https://vborg.vbsupport.ru/showthread.php?t=123886&highlight=Display+Unread+Posts) mod.

However when using "Cache Templates Seperately" the above mod fails to display. I've tried excluding "Navbar" from cache but this doesn't work.

If i use your mod with Cache Templates Seperately off, there is little to no improvement on my configuration, but with this enabled page loads are lightning fast.

Is there anything to do to enable the use of both together? I DESPERATELY want to cache templates seperately, but alot of members (myself included) don't want to loose this other mod.

Thanks for your ongoing support for this great mod.

orban
04-24-2007, 12:32 PM
Try to exclude "navbar" not "Navbar"

bmanzzz
04-29-2007, 09:12 AM
i love this Plugin
is there any thing else i can install that would improve the performance and reduce the load ?

yaworski
05-21-2007, 09:13 AM
bmanzzz if you have access to the shell on the server where you have your forum you can compile and run memcache server and configure your forum to use it in config.php :).

bjornstrom
05-23-2007, 08:12 PM
We're running 4 loadbalanced webservers and one dedicated MySQL - will I run into problems with this mod?

orban
05-25-2007, 06:56 PM
I don't know bjornstrom (https://vborg.vbsupport.ru/member.php?u=31015) I don't have experience with that setup.

There will probably an issue with clearing the cache so you'd have to do that manually.

amcd
05-26-2007, 01:36 AM
I am running a multiple webserver setup. Earlier I had the cache directory set on the NFS, and there were issues with random template corruption in the cache. Now I have the cache directory set to a local address on each webserver, and it is a pain. Whenever a template is edited, I have to manually clear the cache on each webserver.

I am seriously thinking about caching the templates in memcache, but could not find a mod for that. Looks like I will have to start with this mod and adapt it to memcache.

orban
05-26-2007, 09:14 AM
Well if you store templates in memcache you can't have them cached by xcache/etc so that's why I haven't added that.

amcd
05-26-2007, 10:30 AM
I am aware that storing them in memcache means more processing time on the webservers, but at least it will be better than the default, and I will not have to refresh the templates manually. And hopefully it will not have the instability which I was having with the cache on NFS.

aj8690
05-27-2007, 01:25 PM
Thank you very much. My forum is small but there is now a big difference in loading on my homepage. I guess because it calls so many templates. (vbadvanced).

I'm using vbseo and that works well, too. Thanks.

Thanks.

InfoSpyware
06-01-2007, 03:53 PM
Excellent mod orban :up:

"Stable"

I got a ton of feedback and it seems to run on nearly all installations. Even with vBSeo some users reporting...

I'm using vB 3.6.7 PL1 + vBSEO 3.0.0 Gold, and I have a problem in one function the vBSEO.

If active the mod, this function does not work: Display Permalink in Postbit content

Any idea about what's going on?

Thanks for the help.

Salu2

orban
06-01-2007, 03:58 PM
Sorry I don't have access to a vBSEO installation, but can you maybe try to exclude the postbit / postbit_legacy (?) templates?

InfoSpyware
06-01-2007, 05:01 PM
Sorry I don't have access to a vBSEO installation, but can you maybe try to exclude the postbit / postbit_legacy (?) templates?

Work good now :up: :D

Thanks.

lazytown
06-24-2007, 06:54 AM
So far so good -- thank you orban. Hopefully I'll see lower loads. I'm running the latest plugin install (from your first mod post -- not the experimental version) along with xcache.

I run the latest photopost vbgallery (2.2) (as well as vbseo, vbjournal and a few minor mods). The only thing so far I had to disable was forumhome and the gallery home. Without doing that, the latest 5 pictures would not show up on the forumhome nor the gallery home (that section was missing).

edit: I also had to disable "navbar" in order to get the links to work properly in the gallery (which is not within the forum folder).. I guess I could use absolute links if I really wanted to. Navbar seems pretty big -- big performance hit for disabling that?

How much of a hit am I taking by disabling forumhome? If it's big, do you think there is any way to still get those pictures to display without disabling the forumhome template? If I could get that working, I guess I could try your experimental version -- how much better is it?

Would this mod conflict in any way with the xcache datacache mod (https://vborg.vbsupport.ru/showthread.php?t=141005) ? Is it a good idea to run them together?

Thanks again
-vissa

orban
06-24-2007, 09:51 AM
"xcache datacache mod" caches the datastore with xcache, you can use them together without any problem

about the plugins...

if you know a bit of php you can replace the str_replaces on the templates with actual variables

str_replace('someting in the template', $new_stuff, $template)

->

add "$new_stuff" to the template and remove the str_replace

MissKalunji
06-24-2007, 08:03 PM
So far so good -- thank you orban. Hopefully I'll see lower loads. I'm running the latest plugin install (from your first mod post -- not the experimental version) along with xcache.

I run the latest photopost vbgallery (2.2) (as well as vbseo, vbjournal and a few minor mods). The only thing so far I had to disable was forumhome and the gallery home. Without doing that, the latest 5 pictures would not show up on the forumhome nor the gallery home (that section was missing).

edit: I also had to disable "navbar" in order to get the links to work properly in the gallery (which is not within the forum folder).. I guess I could use absolute links if I really wanted to. Navbar seems pretty big -- big performance hit for disabling that?

How much of a hit am I taking by disabling forumhome? If it's big, do you think there is any way to still get those pictures to display without disabling the forumhome template? If I could get that working, I guess I could try your experimental version -- how much better is it?

Would this mod conflict in any way with the xcache datacache mod (https://vborg.vbsupport.ru/showthread.php?t=141005) ? Is it a good idea to run them together?

Thanks again
-vissa

"xcache datacache mod" caches the datastore with xcache, you can use them together without any problem

about the plugins...

if you know a bit of php you can replace the str_replaces on the templates with actual variables

str_replace('someting in the template', $new_stuff, $template)

->

add "$new_stuff" to the template and remove the str_replace

Im having the same problem as well

rootnik
06-26-2007, 09:47 PM
Just a tip for vbadvanced users who do not have their portal in the root vbulletin directory...

Add header and headinclude to "Exclude Templates" part of this product's options. It will take care of allot of the problems you are having.

orban
07-04-2007, 10:14 PM
vissa/MissKalunji: Link the the addon here and I'll write you a fix.

Hopefully more and more addons will start using template hooks so this issue will be gone once for all.

Yellow Slider
07-06-2007, 11:18 AM
I've installed it, the page generation time as decreased, BUT..
the browsing between the forum is kind of slow, and it some times have a delay time when browsing the forum, what may be the problem? when there is a delay the debug mode shows that the page was generated on a normal time, and this is weird .. cous there is an unexplained delay .. can you help me please?

orban
07-06-2007, 11:19 AM
Are you on a shared host or a dedicated server and how many users do you have online?

Yellow Slider
07-06-2007, 11:45 AM
I'm on a dedicated server, I have 600 users online in 3600 sec' ..

amcd
07-06-2007, 12:10 PM
visit the server optimization forum on vbulletin.com

Yellow Slider
07-06-2007, 12:26 PM
my server is well optimized..

orban
07-06-2007, 12:28 PM
"when there is a delay the debug mode shows that the page was generated on a normal time, and this is weird .. cous there is an unexplained delay"

I don't really understand that...

Yellow Slider
07-06-2007, 09:47 PM
crawl my site, you'll understand (it's in hebrew.. )
The index is not normal, all the names you are seeing are forums..
www.atraf-f.net

jthorpe
07-06-2007, 11:36 PM
I just installed this on my site and so far so good. It's only been running for a few minutes but initial testing looks good. I see a lot of files in the templates directory. Site seems very fast with about 1000 users on right now. I'll give it some time tonight and see how it goes. I have cacti running on my machines watching everything include MySql so I'm curious if I'll see anything promising on the graphs.

I have eAccellerator as well so I'm going to be checking up on that. What do I look for there?

orban
07-06-2007, 11:38 PM
I haven't used eAcc in a long time but in xcache you show a list of all files that are being cached...

jthorpe
07-06-2007, 11:45 PM
ok, in eAccellerator I can see both my photopost templates and my classifieds templates being cached, but I don't see anything from VB other than the normal php files. I will give it a while and clear out expired scripts to give it some room. Thanks for the quick response. I'm looking at Cacti right now and I'm seeing a good 40% drop in CPU load as we speak. I also watched my Load Average drop from 2.4 down to 0.5 in about 5 minutes. So far so good.

-----

on edit:

Ok, I just checked again, and all of the templates are in eAccel now. Everything going smooth and the server is sleeping!!! I need to put you on the payroll. GOOD STUFF, and thank you!

orban
07-07-2007, 12:31 AM
My PayPal link is under Mod Information on top of this page :p Glad to have helped out! (And make sure eAcc got enough memory so it doesn't start removing files. And you if really want to push it and got the PHP knowledge try the experimental version I'm running it for several months and it works really smooooth. Though I guess the performance gain is about the same. )

Fenriz
07-20-2007, 11:15 PM
Will it help with my configuration - vb 3.6.7pl1, mysql 4.1.21 (mysqli in config), php 5.2, without any php cache and acceleration (as my shared hosting site5 doesn't allow that).
Any suggestions?

orban
07-20-2007, 11:27 PM
This modification is for HIGH TRAFFIC vB installations.

Fenriz
07-20-2007, 11:45 PM
orban, anyway it will not reduse the speed of my configuration, only help, right?

orban
07-20-2007, 11:48 PM
Not it can make your installation slower, use more resources, RAM, cpu.

Andreas
07-21-2007, 01:56 PM
2 suggestions:
- Instead of another eval() call, just use an include() and make the include return the code
- Hook into template_compile to determine if a cache clear is necessary
This would also fire for style import, etc.

orban
07-21-2007, 02:07 PM
1. How?

vB template calls are like this:

eval('$foo .= "' . fetch_template('bar') . '";');

fetch_template( ) returns the template as a string.

2. Is that hook new?

Andreas
07-21-2007, 02:13 PM
1) Construct the file like

<?php
return "template eval code";
?>


and


$vbulletin->templatecache["$temp[title]"] = '".(include(\''. $path . $temp['templateid'] . '.php\'))."';


2) It's been there since the early 3.5 days

orban
07-21-2007, 02:23 PM
1) Alright that works too thought I doubt there's any performance gain. I only use the experimental version anyway which basically does what you suggest just with functions.

2) Hmm, is that function called for every template? Might be a bad idea to clear the template cache 100 times when importing a style...not to mention importing a style doesn't require you to clear the template cache in the first place...? But for clearing the cache when editing a template might be worth a shot.

Andreas
07-21-2007, 03:02 PM
1) Probably not a noticable one, but there is one.

2) compile_template() is called whenever a template is saved.
If didn't mean that you shuld clear the cache in this hook, just that a flag that the cache is dirty.
This flag could then be checked in admin_complete and the cache cleared if set.

orban
07-21-2007, 03:12 PM
1) As I said if you are interested in maximizing performance take a look at the one I marked as experimental, I will actually clean that up a bit soon and upload here. Just did a quick and dirty benchmark with microtime, you save about 4*10^-6 seconds if you remove the double eval.

2) Good idea, thanks. Clearing the cache in the shell is the best idea anyway. ;)

Andreas
07-21-2007, 04:45 PM
The experimental Version is quite nice :)

However if breaks

Template foobarcheck

<if condition="$foo = 'bar'">
</if>



$foo = 'foo';
eval('$devnull = "' . fetch_template('foobarcheck') . '";');
// $foo = ?


Without this Plugin, $foo is bar. With this plugin it is still foo.

Also, you don't need to pass superglobals like $GLOBALS ;)

orban
07-21-2007, 04:48 PM
Do vB default templates have <if> conditions? Because all the default templates work fine for me. Feel free to filter out $GLOBALS, but what does it matter anyway? This level of detail is absolutely unnecessary you won't gain any performance by spending your time on that. The step from eval(very long string) to eval(function call cached by opcode cacher) is the important one.

Andreas
07-21-2007, 06:14 PM
Do vB default templates have <if> conditions?
Yes, they do - kind of.

Template memberlist_resultsbit for example:

<if condition="$show['emailcol'] AND exec_switch_bg()"><td class="$bgclass">


Without your plugin, you will get alternating column backgrounds.
With your Plugin, you won't

By using references, you could fix that; would also save some memory/processing.
For example, $vbphrase is used in almost all templates.
With the current code, this array is always being copied when a template is eval'ed.

Nevermid, I just wanted to make suggestion to improve this further. Sorry.

orban
07-21-2007, 10:57 PM
Alright I see where you are coming from. Yeah references will solve the problem, vB's code is more messed up than you'd ever think. Well I updated functions_template_cache.php.

RS_Jelle
07-25-2007, 06:39 PM
Alright I see where you are coming from. Yeah references will solve the problem, vB's code is more messed up than you'd ever think. Well I updated functions_template_cache.php.

So we just need to upload the new functions_template_cache.php to our FTP to have the everything actual on our forum for this mod?

It would be easier if you gave it a new version number (and eventually send an update mail to all users). Now it's a bit confusing as there's no concrete information about the changes (or we need to read the full thread) and the mod is marked as updated ...

orban
07-25-2007, 07:04 PM
It would be easier if you read the first line.

RS_Jelle
07-25-2007, 07:44 PM
It would be easier if you read the first line.

I'm sorry, I missed that line :)