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)
-   -   Board Optimization - datastore cache to XCache - boost your vBulletin (https://vborg.vbsupport.ru/showthread.php?t=141005)

phpxcache 03-02-2007 10:00 PM

datastore cache to XCache - boost your vBulletin
 

(note: do not apply this patch on vBulletin 3.7 as it's included already)
This patch allow you to use XCache as a datastore cache in vBulletin. This is definitely your choice if you have installed and enabled XCache on you server already.

Take care that this is a beta version and was not heavily tested. And i'm not familiar with vBulletin source code as i just started reading it today, but i don't have any difficulty reading it thanks to my years of php skill :)

Take aware that some vB plugin is not compatible with vB_datastore_*, not just vB_datastore_XCache. So, in case you find vB_datastore_XCache won't work, you'd better try datastore to file or memcache. If one of the others works but not vB_datastore_XCache, do report it to me so i can fix it.

Pre-requirement
Install the modification
for those of you who can't run "patch", u may patch the file manually
  • download Attachment 61372 (class_datastore_xcache.php)
  • save the file as vBulletin.3.6/upload/includes/class_datastore_xcache.php
  • open vBulletin.3.6/upload/includes/class_datastore.php in your favor editor
  • add a line in class_datastore.php (see below)
  • update upload/includes/config.php to enable it (see below)

example class_datastore.php after modification:
PHP Code:

        }
        return 
true;
    }
}

// add class_datastore_xcache, enable it in config.php
require_once(DIR '/includes/class_datastore_xcache.php');

/*======================================================================*\
|| ####################################################################
|| # Downloaded: 12:33, Fri Mar 2nd 2007
|| # CVS: $RCSfile$ - $Revision: 15474 $
|| ####################################################################
\*======================================================================*/ 

example config.php after modification:
PHP Code:


    
// vB_Datastore_Filecache  - for using a cache file
// $config['Datastore']['class'] = 'vB_Datastore_Filecache';
$config['Datastore']['class'] = 'vB_Datastore_XCache';
    
// vB_Datastore_Memcached - for using a Memcache server
    // It is also necessary to specify the hostname or IP address and the port the server is listening on 

Trouble Shooting
q. i have multiple vBulletin instance installed, the seems to mix data after install this plugin
a. this applies to apc too because, if you wanna fix it, try
open class_core.php, look for:
$this->prefix =& $this->registry->config['Datastore']['prefix'];
and modify to:
$this->prefix = $this->registry->config['Datastore']['prefix'] . $_SERVER['SERVER_NAME']; // or HTTP_HOST

q. Warning: unserialize() expects parameter 1 to be string, array given in $a.php on line $b
a. upgrade your plugin/hack that $a.php belongs to, e.g. vbjournal/vbgallery etc. OR open $a.php and locate at line $b, remove unserialize call, e.g.:
replace $var = unserialize($this->data);
with $var = $this->data;
be careful do not remove the whole line, just the unseralize( and )

Mudvayne 03-03-2007 04:28 AM

w00t :D. I 'll try this as soon as I'm home :D. Clicked install :D.

Edit: Installed. 2 query reduced at forum home. Works like a charm. Screenshot added.

Zia 03-03-2007 05:53 AM

Man..what u have done ?
Simply tremendous..........

Xcache rocks............

sure it will work better than others..
Xcache is working simply good......in my vb board...even it works better than eAcc.
it reduced my server load more....

can u say how much ram will be needed for using this? min.requirments?

Thanx......

Zia 03-03-2007 06:28 AM

Hope to get it with in vb at next release...

i gez after install it we wont need memcache any more ????

bashy 03-03-2007 06:47 AM

Sorry, all this talk is way over my head, can someone explain what this is about in laymans terms please?

Do i need to install this?

Zia 03-03-2007 07:04 AM

helo bashy..

like; some of us using eAcc or APC or Xcache for php accleration.
If u have Xcache installed on ur box for php cache/optimize u can install it for datastore cache.

atm we are on Xcache and it really works nice than eAcc.And it reduce more serverload than eAcc.

Xcache is perfectly working with php5.2.* series.
http://trac.lighttpd.net/xcache/
Xcache have option to cache php & variable.....to enable datastore cache for vb+xcache.
Gonna install this patch for data-store cache.

bashy 03-03-2007 07:12 AM

Ah right ok thanks Zia i understand now :)

Zia 03-03-2007 07:18 AM

:) Just curious bashy...
which cacher/acclereator do u use?

jedisct1 03-03-2007 07:50 AM

Reserved, thanks.

bluechris 03-03-2007 11:12 AM

Sorry if i am sound stupid but i dont know how to apply the patch... i have xcache allready in the box with php 5.2 (2k3 box) and im little confused cause i never applied a patch in my vb.

Can someone explain?

lendy 03-03-2007 11:31 AM

edit file includes/class_datastore.php
at th end (above ?>)
add nether php code
PHP Code:


/**
* Class for fetching and initializing the vBulletin datastore from XCache
*
* @package    vBulletin
* @version    $Revision: $
* @date        $Date: $
*/
class vB_Datastore_XCache extends vB_Datastore
{
    
/**
    * Indicates if the result of a call to the register function should store the value in memory
    *
    * @var    boolean
    */
    
var $store_result false;

    
/**
    * Fetches the contents of the datastore from XCache
    *
    * @param    array    Array of items to fetch from the datastore
    *
    * @return    void
    */
    
function fetch($itemarray)
    {
        if (!
function_exists('xcache_get'))
        {
            
trigger_error('XCache not installed'E_USER_ERROR);
        }

        if (!
ini_get('xcache.var_size'))
        {
            
trigger_error('XCache variable data cache is not enabled, please set xcache.var_size in php.ini'E_USER_ERROR);
        }

        
$db =& $this->dbobject;

        
$itemlist = array();

        foreach (
$this->defaultitems AS $item)
        {
            
$this->do_fetch($item$itemlist);
        }

        if (
is_array($itemarray))
        {
            foreach (
$itemarray AS $item)
            {
                
$this->do_fetch($item$itemlist);
            }
        }

        
$this->store_result true;

        
// some of the items we are looking for were not found, lets get them in one go
        
if (!empty($itemlist))
        {
            
$this->do_db_fetch(implode(','$itemlist));
        }

        
$this->check_options();

        
// set the version number variable
        
$this->registry->versionnumber =& $this->registry->options['templateversion'];
    }

    
/**
    * Fetches the data from shared memory and detects errors
    *
    * @param    string    title of the datastore item
    * @param    array    A reference to an array of items that failed and need to fetched from the database
    *
    * @return    boolean
    */
    
function do_fetch($title, &$itemlist)
    {
        
$ptitle $this->prefix $title;

        if ((
$data xcache_get($ptitle)) === null)
        { 
// appears its not there, lets grab the data, and put it in
            
$itemlist[] = "'" $this->dbobject->escape_string($title) . "'";
            return 
false;
        }
        
$this->register($title$data);
        return 
true;
    }

    
/**
    * Sorts the data returned from the cache and places it into appropriate places
    *
    * @param    string    The name of the data item to be processed
    * @param    mixed    The data associated with the title
    *
    * @return    void
    */
    
function register($title$data)
    {
        if (
$this->store_result === true)
        {
            
$this->build($title$data);
        }
        
parent::register($title$data);
    }

    
/**
    * Updates the appropriate cache file
    *
    * @param    string    title of the datastore item
    * @param    mixed    The data associated with the title
    *
    * @return    void
    */
    
function build($title$data)
    {
        
$ptitle $this->prefix $title;

        
xcache_unset($ptitle);
        
xcache_set($ptitle$data);
    }

}

// ############################################################################# 

and edit includes/config.php
add or edit
$config['Datastore']['class'] = 'vB_Datastore_XCache';

precondition:
you must install xcache,and set xcache.var_size not 0,same as xcache.size in php.ini

Mudvayne 03-03-2007 12:06 PM

Quote:

Originally Posted by jedisct1 (Post 1194687)
Reserved

Why & what for? :S LOL

Deimos 03-03-2007 12:45 PM

I assume we put the "vB_Datastore_XCache" File in the includes/datastore directory?

vBB-vietnam 03-03-2007 01:28 PM

My server OS window 2003 . .Apache v2.0.59 , PHP 4.4.5
Can i use it .
sorry for my bad english

MikeWarner 03-03-2007 01:39 PM

Quote:

Originally Posted by lendy (Post 1194773)
precondition:
you must install xcache,and set xcache.var_size not 0,same as xcache.size in php.ini

Eh? My var size is 0. You saying I have to set this to the same as what the xcache.size is? (100mb). Really? That much?

More info on this woul be good. I just tried to install this and got errors. I didn;t change the var size from 0, plus I assumed the location of the attached php file.

Please can more details be added to this hack as I would like to use it.

Thanks.

phpxcache 03-03-2007 01:50 PM

i have updated the topic again.
setting "xcache.var_size not 0" is same as "xcache.size"
xcache.var_size = 10M or so is fine, just resize it for to fit your needs.

you gotta copy the content of the whole php file i attached into class_datastore.php, there's no new file is created or added

Zia 03-03-2007 03:23 PM

Quote:

Originally Posted by vBB-vietnam (Post 1194831)
My server OS window 2003 . .Apache v2.0.59 , PHP 4.4.5
Can i use it .
sorry for my bad english

I gez u can ..i gez
to use this(this thread) mods..u must have Xcache install in ur box
Quote:

Download Win32AutoBuilds at here/XCache-VERSION-php-x.y.x-Win32-rREV.zip. This is an official SvnSnapShots autobuild, but NOT release version.
Check InstallingAsPhpExtension for instructions. (the doc is not updated for win32 yet)
It can be very hard to compile for Win32. If you're gonna do it yourself, Cygwin is required, and check the simple README to accomplish the complex job.

Disassembler is avaiable in source but missing one file due to license problem, so not built into win32 binary package. btw, disassembler isn't designed to work with commercal encoders/encrypters.
http://trac.lighttpd.net/xcache/wiki/Win32AutoBuilds

(The Author phpxcache can explain u better)
After u got xcache installed on ur Box..U can use this mods for datastore cache.

Zia 03-03-2007 03:31 PM

Quote:

Originally Posted by MikeWarner (Post 1194838)
Eh? My var size is 0. You saying I have to set this to the same as what the xcache.size is? (100mb). Really? That much?
More info on this woul be good. I just tried to install this and got errors. I didn;t change the var size from 0, plus I assumed the location of the attached php file.
Please can more details be added to this hack as I would like to use it.
Thanks.

Thanks for ur interest. I will try to provide u some info..see it it helps u a bit..

See bellow xcache.ini of our box

Quote:

; select low level shm/allocator scheme implemenation
xcache.shm_scheme = "mmap"
xcache.size = 64M
xcache.count = 4
xcache.slots = 8K
xcache.ttl = 0
xcache.gc_interval = 0

; same as aboves but for variable cache
xcache.var_size = 64M
xcache.var_count = 4
xcache.var_slots = 8K
; default ttl
xcache.var_ttl = 0
xcache.var_maxttl = 0
;xcache.var garbage collect interval set to 6 hour.
xcache.var_gc_interval = 21600
Pls follow the red color text
xcache.size & xcache.var_size both set to 64Mb .
And ur using 100 Mb for xcache.size . :confused: did u really need that much memory ?:eek: we set 64MB.33Mb used and still 31MB is free out of 64Mb. when vbplaza on it just consume 3~4Mb more + few more php cached.

check ur xcache admin cp & if needed reduce allocated memory OR if u got enugh memory at ur box/server ..then u can use 100MB+100 Mb.

Point is that u have to put same MB of memory at xcache.size & xcache.var_size

php file in the attachmnet
Quote:

you gotta copy the content of the whole php file i attached into class_datastore.php, there's no new file is created or added

MikeWarner 03-03-2007 03:38 PM

No - I need 100mb. I have tried to reduce it, but was getting ooms using 90mb. I'll give it a try later. Thanks.

MikeWarner 03-03-2007 03:54 PM

Quote:

Originally Posted by phpxcache (Post 1194847)
you gotta copy the content of the whole php file i attached into class_datastore.php, there's no new file is created or added

So I need to replace the class_datastore.php file with the included file (renamed)?

Zia 03-03-2007 03:56 PM

Quote:

Originally Posted by MikeWarner (Post 1194908)
No - I need 100mb. I have tried to reduce it, but was getting ooms using 90mb. I'll give it a try later. Thanks.

ag OOMS ..thet u obiviously need 100 MB..(wondering how many things ur using)
then did u try 10 or 20 Mb for xcache.var_size ?

bluechris 03-03-2007 06:50 PM

Thx guys for the reply... i got it working now.. is there anyway that i can see stats of the site how is it going... what is cached etc?

bluechris 03-03-2007 07:33 PM

Nevermind i got the admin page working and i see the statistics... the point is i dont see cache working really... or i am mistaken.... see my php.ini settings

Code:

[xcache]
xcache.shm_scheme =        "mmap"
xcache.size  =                32M
xcache.count =                2
xcache.slots =                8K
xcache.ttl  =                0
xcache.gc_interval =          0

xcache.var_size  =            32M
xcache.var_count =            2
xcache.var_slots =            8K
xcache.var_ttl  =            0
xcache.var_maxttl  =          0
xcache.var_gc_interval =    300

xcache.test =                Off

xcache.readonly_protection = Off
xcache.mmap_path =    "c:/temp"

xcache.coredump_directory =  ""


xcache.cacher =              On
xcache.stat  =              On
xcache.optimizer =            On

[xcache.coverager]
xcache.coverager =          Off
xcache.coveragedump_directory = ""


Also in admin page of xcache i see this results in the attached gif.

the only 4 hits that had cached is the pages from admin of xcache, do i need to do something extra in my VB? or anywhere else?

shifangjumie 03-03-2007 11:01 PM

国内的兄弟??

Zia 03-04-2007 01:50 AM

Quote:

Originally Posted by bluechris (Post 1195052)
Nevermind i got the admin page working and i see the statistics... the point is i dont see cache working really... or i am mistaken.... see my php.ini settings

Code:

[xcache]
xcache.shm_scheme =        "mmap"
xcache.size  =                32M
xcache.count =                2
xcache.slots =                8K
xcache.ttl  =                0
xcache.gc_interval =          0

xcache.var_size  =            32M
xcache.var_count =            2
xcache.var_slots =            8K
xcache.var_ttl  =            0
xcache.var_maxttl  =          0
xcache.var_gc_interval =    300

xcache.test =                Off

xcache.readonly_protection = Off
xcache.mmap_path =    "c:/temp"

xcache.coredump_directory =  ""


xcache.cacher =              On
xcache.stat  =              On
xcache.optimizer =            On

[xcache.coverager]
xcache.coverager =          Off
xcache.coveragedump_directory = ""


Also in admin page of xcache i see this results in the attached gif.

the only 4 hits that had cached is the pages from admin of xcache, do i need to do something extra in my VB? or anywhere else?

Ur on win server?
seemed that ur cache is working...

i m confused ur var.cache is working or not :confused: .....did u follow all the steps properly to enable var.cache?

phpxcache 03-04-2007 01:57 AM

Quote:

Originally Posted by bluechris (Post 1195052)
Nevermind i got the admin page working and i see the statistics... the point is i dont see cache working really... or i am mistaken.... see my php.ini settings
the only 4 hits that had cached is the pages from admin of xcache, do i need to do something extra in my VB? or anywhere else?

i assume you're usig windows, can u tell me how is your php installed? not the installtion steps, but about how it looks like. iis? apache? mod_fastcgi or not?


See Faq: Why is my cache being cleared?

bluechris 03-04-2007 04:35 AM

I use IIS with php 5.2.1 ... but i got the big picture from the links and other search i did on web...
I think the problem is that i use fast-cgi..... this dont not work good in windows cause caching programs cannot share among many worker processes that windows run for each user ... my 2 options now is run as isapi i suppose or w8 for something else...... i dont know what else i can do.

Quote:

Originally Posted by Zia (Post 1195202)
Ur on win server?
seemed that ur cache is working...

i m confused ur var.cache is working or not :confused: .....did u follow all the steps properly to enable var.cache?

Yeap i got same statistics for var cache... says that hasn't cached anything.

MikeWarner 03-04-2007 06:39 AM

Getting this error:
Fatal error: Cannot redeclare class vb_datastore:vb_datastore_xcache in /home/migweb/public_html/forums/includes/class_datastore_xcache.php on line 14

I double checked everything.

phpxcache 03-04-2007 06:56 AM

Quote:

Originally Posted by MikeWarner (Post 1195307)
Getting this error:
Fatal error: Cannot redeclare class vb_datastore:vb_datastore_xcache in /home/migweb/public_html/forums/includes/class_datastore_xcache.php on line 14

I double checked everything.

you gotta remove the old patch that you applied (inserted) to use the new installtion way.

search includes/* for string "vB_Datastore_XCache" (without the quotes)

MikeWarner 03-04-2007 07:51 AM

Hmmm... now getting:
Fatal error: XCache variable data cache is not enabled, please set xcache.var_size in php.ini in /includes/class_datastore_xcache.php on line 39

xcahce.var_size is set to 10 and is showing in the xcache cp.

phpxcache 03-04-2007 08:10 AM

as i said, set it to 10M or so, not 10

rjmjr69 03-04-2007 08:18 AM

Looks nice I'll keep watch see if there are any bugs

MikeWarner 03-04-2007 08:38 AM

Sorry, typo. I am running 10M.

Just spotted something. I'm using 3.6.4. Is that ok?

Thanks.

phpxcache 03-04-2007 08:55 AM

the php cache part and the size of var cache looks good. but var cache is not caching anything in your case. did u request the vBulletin first to let it cache something in?

Zia 03-04-2007 09:16 AM

Quote:

Originally Posted by MikeWarner (Post 1195357)
Sorry, typo. I am running 10M.

Just spotted something. I'm using 3.6.4. Is that ok?

Thanks.

as per screenshot...u set xcache.count = 4 (ur processor count) & xcache.var_count = 1?

seemd ur var.cache isnt working.....
ask phpxcache .. diff. of xcache.count & xcache.var count will be a probs or not...

vb3.6.4 or 3.6.5 wont be a problem

viyanali 03-04-2007 02:26 PM

thx *installed*
(works nice) :)

Zia 03-04-2007 02:42 PM

viyanali yea..should be...one of the koolest thing..this is
even Xc consume less memory than eAcc or APC

bluechris 03-04-2007 03:42 PM

phpxcache sorry m8 but i uninstalled it cause with it vbgooglemaphse & vbgooglemapme stopped working... they produced a white page without errors or anything..

I stay with xcache for template caching

IrPr 03-04-2007 03:42 PM

I'm currently using APC on my major vB forum
do u suggest me to switch to XCache ?

Zia 03-04-2007 04:27 PM

Quote:

Originally Posted by bluechris
phpxcache sorry m8 but i uninstalled it cause with it vbgooglemaphse & vbgooglemapme stopped working... they produced a white page without errors or anything..
I stay with xcache for template caching

dont get ur word..that means after install this data store cache modification u faced mentioned error?
i would like to request u to provide as much as info possible for u to provide phpxcache for proper diagonisis & soltion...
or if u face error with Xcache drop ur issue http://trac.lighttpd.net/xcache/newticket .Soon..very soon u will get the reply..


Quote:

Originally Posted by IrPr (Post 1195537)
I'm currently using APC on my major vB forum do u suggest me to switch to XCache ?

like wise i was on eAcc and then i moved to Xcache & suggest every one to switch to Xcache.
Do u know why? Coz,this is really too kool it works gr8 with less memory consumption even it makes my forum more faster than before.
and the main reason is that the author is very much agger to digg any bug & solve it ASAP.
wich i didnt get in eAcc or APC.

dicission is urs.


All times are GMT. The time now is 04:54 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.01663 seconds
  • Memory Usage 1,896KB
  • 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
  • (3)bbcode_php_printable
  • (16)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)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