vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Modification Graveyard (https://vborg.vbsupport.ru/forumdisplay.php?f=224)
-   -   Board Optimization - Plugin Based Template Cache (https://vborg.vbsupport.ru/showthread.php?t=121876)

mrcrx 10-12-2006 04:00 PM

Im very new at this so how do I chmod 777 a folder since my host said I have to do it. thanks.

orban 10-12-2006 04:04 PM

Do you have FTP or SSH access to your server?

FTP: Right click on the folder and select something like "Properties", "Options", "Permission" and set it to 777.

SSH: chmod 777 /path/to/the/folder

mrcrx 10-12-2006 04:22 PM

ok I did that and everything is working but the shoutbox. I did the mod to it but I dont understand where to put the shoutbox code within the forumhome templete. I would like it where it was on the top. thanks for the quick responce.

orban 10-12-2006 04:25 PM

Ask in the shoutbox thread I didn't make that mod :)

mrcrx 10-12-2006 04:28 PM

LOL thats not good. Whats the reason in post 34 to mod it? should I put it back or is this worth it to try and figure it out.

orban 10-12-2006 04:39 PM

Pardon?

mrcrx 10-12-2006 04:44 PM

Quote:

Originally Posted by orban
Glad to hear!

-----

vBShout:

https://vborg.vbsupport.ru/showthrea...hlight=vbshout

I assume you mean this vBShout version.

Edit the plugin "vBShout [Template Alteration]" and comment out this line:

Code:

$vbulletin->templatecache['FORUMHOME'] = str_replace($Position, $Position . ' $Shoutbox', $vbulletin->templatecache['FORUMHOME']);
Code:

/*$vbulletin->templatecache['FORUMHOME'] = str_replace($Position, $Position . ' $Shoutbox', $vbulletin->templatecache['FORUMHOME']);*/
Then modify the template "FORUMHOME" and add

Code:

$Shoutbox
where you want to have the shoutbox.

This of course disables the placement using the "vBShout Position" option in the admincp.


sorry my questions is, Is the above needed? Right now im running your code without it.

orban 10-12-2006 04:47 PM

If it works then you don't need it...?

Bulent Tekcan 10-16-2006 07:55 PM

Sometimes I received this error

Quote:

Warning: include(/home/xxxx/public_html/satforum/templates/8808.php) [function.include]: failed to open stream: No such file or directory in /includes/class_postbit.php(300) : eval()'d code(1) : eval()'d code on line 1

Warning: include() [function.include]: Failed opening '/home/xxxxx/public_html/satforum/templates/8808.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /includes/class_postbit.php(300) : eval()'d code(1) : eval()'d code on line 1
This error also create segfault in my system than after this error load goes high load.When this error occured manualy delete include /templates folder.

Normaly this error occured showthread pages...

Thanks

orban 10-16-2006 07:57 PM

Can you try to add a "slam protection"? Like a if (rand()<0.1) or something before locking and creating the file. Let me know if you want me to add it ;)

Might be too many users trying to create the file and/or users accessing parts of template cache when not all files are yet created.

This is of course not a real solution but will just lower the chance it will happen...

For a real solution...m..that's tough.

An option would be to limit the creating of template files to a certain userid, and then you just browse all the pages, so the cache gets created, and only then it will be available for all users....but it's kinda hard to browse all pages. I dunno :(

Line 51 to:

Code:

if (rand() < 0.1 && $vbulletin->options['pbtc_seperate'] && strlen($temp['template']) > intval($vbulletin->options['pbtc_limit']) && !in_array($temp['title'], $exclude)) {
Line 75-81:

Code:

                        if (rand() < 0.1)
                        {
                                $fp = fopen($templatefile, 'w+');
                                if ($fp && flock($fp, LOCK_EX))
                                {
                                        fwrite($fp, '<?php '.$cache_to_save.' ?>');
                                        flock($fp, LOCK_UN);
                                        fclose($fp);
                                }
                        }


Bulent Tekcan 10-16-2006 08:18 PM

Is this slam protection for APC (apc.slam_defense) ?

orban 10-16-2006 08:20 PM

No, for the template_cache.php, you have to modify it, see my edited post above. Can you apply those changes? If not I can upload you a new template_cache.php just for you.

Bulent Tekcan 10-16-2006 08:28 PM

OK...I'll test this code.

Thanks

rootnik 11-01-2006 01:53 AM

Just installed. I can not believe how well this works with eaccelerator. Thanks orban!

Kihon Kata 11-01-2006 02:40 AM

Quote:

Originally Posted by rootnik
Just installed. I can not believe how well this works with eaccelerator. Thanks orban!

amen! It even worked on things outside my forums.

jyajay 11-01-2006 08:56 PM

In the config.php there is datastore variable, should I put something in there If APC and your hack is installed?

Quote:

// $config['Datastore']['class'] = 'vB_Datastore_Filecache';

orban 11-01-2006 08:57 PM

It automatically gets filled. Or at least it should.

jyajay 11-02-2006 11:09 AM

The line is like this in my config.php, it is excluded. What should I put in there?

Paul Janowitz 11-07-2006 04:52 PM

Hello! Thanks for the great work!
Will this Hack work for a large board with a cluster of servers?
I have a load balancer with 1 server for MySQL and 3 Apache clients for the output, on each server located the vBulletin files.
Will this hack work for me, too?

orban 11-07-2006 04:56 PM

If the vBulletin files are located on each of the three Apache servers, and they got seperate file systems it should work without any problems. I don't know how well it works with shared file systems (it for example has to support file locking)....

Paul Janowitz 11-07-2006 08:44 PM

Quote:

Originally Posted by orban
If the vBulletin files are located on each of the three Apache servers, and they got seperate file systems it should work without any problems.

Will the cached files then be created on every server simultaneuously or will the cached files be created on each system on its own when the specific file is called on this system (what I suppose but want to be sure...)?

amcd 11-08-2006 05:37 AM

Quote:

Originally Posted by Paul Janowitz
Will the cached files then be created on every server simultaneuously or will the cached files be created on each system on its own when the specific file is called on this system (what I suppose but want to be sure...)?

each server will have its own set of cached files in the forums/templates directory

amcd 11-08-2006 05:39 AM

Quote:

Originally Posted by orban
If the vBulletin files are located on each of the three Apache servers, and they got seperate file systems it should work without any problems. I don't know how well it works with shared file systems (it for example has to support file locking)....

i haven't tried it but it should work with shared file systems also.

i use php-fcgi with lighttpd and have multiple instances of xcache running. earlier i was using APC. they share the files without any problems. so by extension, NFS should also work.

Anomalies 11-08-2006 11:27 PM

vbseo user here, this may very well come in handy.

dellow 11-11-2006 11:38 PM

Hello,

i just installed , but i recive this error :

Warning: fopen(/home/oni/public_html/363/templates1e2137b2098c25afd2ad803c81e66123.php) [function.fopen]: failed to open stream: Permission denied in /template_cache.php on line 75

the folder /templates is already 777

orban 11-11-2006 11:42 PM

Is PHP running in safe mode?

And why is the file in /363/templates1e2137b2098c25afd2ad803c81e66123.php and not /forums/templates/1e2137b2098c25afd2ad803c81e66123.php ?

Did you set a path in the options and forgot to add a trailing /?

dellow 11-11-2006 11:46 PM

ohh

i just fix it ,

actualy i was put the path (/home/oni/public_html/363/templates)

i just modify it by adding slash after templates/


Thank you problem resolved :)

orban 11-11-2006 11:47 PM

No problem.

nix 11-12-2006 11:12 PM

Quote:

Originally Posted by jyajay (Post 1108975)
In the config.php there is datastore variable, should I put something in there If APC and your hack is installed?

Any answer to this one? Like he said its commented out right now. Should we uncomment this? Or is this basically what the hack does?

Milez 11-12-2006 11:33 PM

This hack is giving me hope as my very large board often succumbs to slow page loads during very busy times. I just read thru every post in this thread as well as the old 3.5.x thread and there is not a whole lot of success stories listed.

Has anyone noticed significant speed ups on big boards? I would love to hear some specifics on this before I install. I am currently running eAccel so this hack might be a good fit for me.

BTW the support from orban is phenomenal. Props.

Milez 11-12-2006 11:43 PM

This hack is giving me hope as my very large board often succumbs to slow page loads during very busy times. I just read thru every post in this thread as well as the old 3.5.x thread and there is not a whole lot of success stories listed.

Has anyone noticed significant speed ups on big boards? I would love to hear some specifics on this before I install. I am currently running eAccel so this hack might be a good fit for me.

BTW the support from orban is phenomenal. Props.

orban 11-13-2006 04:37 AM

Quote:

Originally Posted by Milez (Post 1115835)
This hack is giving me hope as my very large board often succumbs to slow page loads during very busy times. I just read thru every post in this thread as well as the old 3.5.x thread and there is not a whole lot of success stories listed.

Has anyone noticed significant speed ups on big boards? I would love to hear some specifics on this before I install. I am currently running eAccel so this hack might be a good fit for me.

BTW the support from orban is phenomenal. Props.

I'm running a (rather) big board myself (1.5 million posts) and I did/do notice a huge performance improvement.

Quote:

Originally Posted by nix (Post 1115809)
Any answer to this one? Like he said its commented out right now. Should we uncomment this? Or is this basically what the hack does?

The datastore value in config.php has nothing to do with templates or this addon.

nix 11-13-2006 04:55 AM

Quote:

Originally Posted by orban (Post 1116037)



The datastore value in config.php has nothing to do with templates or this addon.

Do you think it would help/hurt to turn that on also?

amcd 11-13-2006 05:34 AM

Quote:

Originally Posted by nix (Post 1116048)
Do you think it would help/hurt to turn that on also?

it would certainly help

beano33 11-15-2006 01:44 PM

Quote:

Originally Posted by Milez (Post 1115849)
Has anyone noticed significant speed ups on big boards? I would love to hear some specifics on this before I install. I am currently running eAccel so this hack might be a good fit for me.

VERY nice, people. :) We run an extremely busy board, with 6 load-balanced webservers and frequently 2000+ visitors... Watching the slow query log on the MySQL server was painful, since the template query often took more than 6 seconds on a very fast server, and of course, that slowed things down significantly, even causing the SQL server to drop other connections, etc.

This "hack" has made our board a LOT faster, and it's really appreciated. We're running it over NFS, and at first, since NFS doesn't support file locks, we were having some problems, since 0-byte files were being created. However, I found that a crude hack to fix that problem worked well... And for others who have the same problem, here's the crude hack that will fix it:

Replace the following line (around line 29 in 1.03):
Code:

if (file_exists($templatefile))
with
Code:

if (file_exists($templatefile) && filesize($templatefile) != 0)
Pretty simple, but it works. Basically, if the file is a zero-byte file, it will recreate it. If it's not... It won't. :)

Anyhow, that will fix the little problem created by file-locking if you're running NFS and getting zero-byte files.

And I'd HIGHLY recommend this to anyone who's been watching their slow-query log on their SQL server and getting frustrated with how that damn "SELECT title, template" keeps showing up in their logs. Get it, install it, your worries are over.

As for the datastore, I'd highly recommend that you get memcached set up and installed, that will provide a HUGE boost as well. :)

Kihon Kata 11-15-2006 01:58 PM

Quote:

Originally Posted by beano33 (Post 1117932)
VERY nice, people. :) We run an extremely busy board, with 6 load-balanced webservers and frequently 2000+ visitors... Watching the slow query log on the MySQL server was painful, since the template query often took more than 6 seconds on a very fast server, and of course, that slowed things down significantly, even causing the SQL server to drop other connections, etc.

This "hack" has made our board a LOT faster, and it's really appreciated. We're running it over NFS, and at first, since NFS doesn't support file locks, we were having some problems, since 0-byte files were being created. However, I found that a crude hack to fix that problem worked well... And for others who have the same problem, here's the crude hack that will fix it:

Replace the following line (around line 29 in 1.03):
Code:

if (file_exists($templatefile))
with
Code:

if (file_exists($templatefile) && filesize($templatefile) != 0)
Pretty simple, but it works. Basically, if the file is a zero-byte file, it will recreate it. If it's not... It won't. :)

Anyhow, that will fix the little problem created by file-locking if you're running NFS and getting zero-byte files.

And I'd HIGHLY recommend this to anyone who's been watching their slow-query log on their SQL server and getting frustrated with how that damn "SELECT title, template" keeps showing up in their logs. Get it, install it, your worries are over.

As for the datastore, I'd highly recommend that you get memcached set up and installed, that will provide a HUGE boost as well. :)

Thanks Beano..

Orban, can you comment on this? ^^

orban 11-15-2006 02:16 PM

What you wanna know :)

The file_exist problem is just with NFS because it often doesn't support file locking.

The memcached datastore has nothing to do with this addon, but I'd recommend it, too.

ElForro 11-28-2006 09:48 AM

Ths is nice... I have only one problem... I use this: https://vborg.vbsupport.ru/showthread.php?t=122594

But with the PLugin Based Template Cache on, the table with the "users who read the thread" doesn't shows. Does anybody knows how could I use both plugins at the same time?

orban 11-28-2006 11:27 AM

You have to exclude SHOWTHREAD from being cached (in the options)

OR

edit the "showthread_getinfo [Display Thread Readers (3)]" plugin and change

$vbulletin->templatecache['SHOWTHREAD'] = str_replace($vbulletin->options['text_wrt'], $vbulletin->options['text_wrt'].$vbulletin->templatecache['Display_Readers'],$vbulletin->templatecache['SHOWTHREAD']);

to

eval('$wrt_template = "' . fetch_template('Display_Readers') . '";');

and then edit the "SHOWTHREAD" template and add

$wrt_template after

"<!-- end currently active users -->"

so you end up with

"<!-- end currently active users --> $wrt_template"

The second part is untested and if you don't know PHP/vB template system don't try this, but the performance will be a lot better.

ElForro 11-28-2006 12:04 PM

Thanks! I edited the plugin and SHOWTHREAD and works fine!


All times are GMT. The time now is 04:22 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.01380 seconds
  • Memory Usage 1,841KB
  • 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
  • (9)bbcode_code_printable
  • (14)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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