XCache


#1

Hi, I’m about to start testing XCache on my DreamHost PS to see if it helps to reduce resource utilisation on one of my websites.

I’ve flicked the switch on the ‘Manage Domains’ set-up. Do I need to do anything else to make this work and how do I view the XCache Administration Page for my domain? (where I can see stats regarding caching etc).

Sorry if these are basic questions. Any tips appreciated.

Jon


#2

Sorry to bump this. I’m re-visiting setting up XCache after more than a year since the last time I looked at it, but I am still coming across the same issue: How do you enable XCache on a PS?

The DreamHost wiki article - http://wiki.dreamhost.com/XCache says “If you can view XCache through phpinfo(), then you can configure it through a custom PHP.ini file by using the following settings:…”

However, there is no XCache section in my phpinfo.

The ‘Manage Domains’ section on the DreamHost panel makes it look like all you have to do is check the ‘XCache’ checkbox for your domain, and it will then be enabled, but this doesn’t seem to be true unless I am missing something?


#3

Your choice, but cancel XCache and go with W3 Total Cache.
ONLY with W3 do not use the minify option, or test it 1 plugin at a time.

For the rest W3 is great.


#4

Thanks for the reply, but this is something for PHP (it’s not a WordPress site). I’m wanting to use XCache to reduce resource utilisation on my VPS, but I am a bit confused by the set-up.


#5

Sorry that goes beyond my knowledge. Hope someone else helps you out.


#6

As far as I know you enable it in the configure PS section, then check the domain settings too and see if its listed there too.

Then restart the PS and it should be in phpinfo(); if not contact support through control panel.

To see the admin pages I had to install the admin folder into my web folder and set up a user name password in the php.ini file in the xcache settings.


#7

Thanks Finglor, seems to make sense. Seems obvious now, but I missed that setting.

Just out of interest, did you notice much difference on your PS in terms of performance, memory usage etc after making this change? I’m not sure what I’m expecting at the moment…


#8

Xcache definitely speeds up the execution time of php scripts I haven’t noticed any change in my memory usage.


#9

thanks, time to give it a try :slight_smile:


#10

OK, I’ve now enabled XCache on my PS, and it all appears fine (& working) in phpinfo().

However, if I go the XCache administration pages, only the admin pages appear to be caching and nothing else on my server!

I’m wondering if this might be something to do with needing a particular FastCGI config on each domain. Here’s my FastCGI config:

.htaccess:
#— DH-PHP handlers —
AddHandler fastcgi-script fcg fcgi fpl
AddHandler php-fastcgi .php
Action php-fastcgi /cgi-bin/dispatch.fcgi

dispatch.fcgi:
#!/bin/sh
export PHPRC=/
export PHP_FCGI_CHILDREN=2
exec /dh/cgi-system/php5.cgi $*

I’m not sure if anyone else has a similar set-up and has got this working? My domain is using the FastCGI ‘PHP mode’ (from the DreamHost panel) and has XCache enabled, but nothing seems to be caching for that site (according to the admin stats).


#11

I’ve now figured out why the stats weren’t showing and it was because I’d copied the XCache admin folder to a separate location outside of my website, which was using a different instance of PHP (doh!)

I’ve now copied the XCache admin folder beneath my root web and I am now seeing cache activity. So, this is just a heads up for anyone else as stupid as me!


#12

Please use the configuration described here for custom PHP.ini:

The “dispatch.fcgi” setup you’re using is no longer recommended.


#13

Hi, thanks for the advice. This domain is still using PHP 5.2. I’m also using memcached and it was a bit of a saga to get everything working together, so I might leave things as they are for the moment (as it seems to be working/performing ok).


#14

I’ve just tried to change the domain from the DreamHost panel to use PHP 5.3 (because of the issue you’ve raised), but a message says that XCache is “not currently available with PHP 5.3.x”. So I can either change the domain to use PHP 5.3 (and not use XCache), or keep the domain on PHP 5.2 and have XCache support.


#15

Just a further note on this, I’m now using PHP 5.3 but noticing I’m using a lot more memory on my PS.

I’m wondering what the recommended configuration for FastCGI should be on PHP 5.3 if we should not be using the “dispatch.fcgi” setup?

On PHP 5.2, there were some recommendations listed here: http://wiki.dreamhost.com/PHP.ini#Set_up_your_domain_for_FastCGI

However, there is no suggested FastCGI configuration information in the Wiki for PHP 5.3 domains and, consequently, I have no config for FastCGI in my .htaccess etc. Is this right, or should I being doing something here? (sorry, it’s not very clear from the Wiki).

( My memory usage has increased quite a lot so I’m keen to make some tweaks! :wink: )

Jon


#16

Use the default configuration for PHP 5.3. The proliferation of setups for PHP 5.2 were all a result of the fact that PHP 5.2 didn’t support custom PHP.ini files; nothing of the sort is necessary for PHP 5.3.


#17

Thanks andrewf. Just so that I understand, the default setup of PHP 5.3 means I don’t need to do anything?

Should there be any FastCGI config in the .htaccess file? (I’ve got no ‘handlers’ there any more). The only entries in my phprc file are unrelated settings to do with PHP (the rest is inherited from the default config). My memory usage seems higher than it was on PHP 5.2, so I was just concerned I was missing something.


#18

to explain why I’m using more memory, I seem to have quite a lot of php53.cgi processes running, and I thought one of the main benefits of FastCGI was that it didn’t generate so many.


#19

As long as you’ve got PHP set to FastCGI in the panel, what you’ll end up with is internally the exact same as PHP 5.2 with FastCGI (except it’s running the PHP 5.3 interpreter instead). I’m not aware of any reason that you’d end up with more processes running if you were just switching between those two settings.

The advantage of FastCGI, incidentally, is less that it doesn’t generate so many processes and more that it reuses those processes instead of creating one for each request and destroying it when the request is complete. The FastCGI module we use (mod_fcgid) has some internal logic to decide when to reuse an existing process and when to create a new one; it’s imperfect, but generally reasonable.


#20

thanks. Just so long as it’s working as it’s supposed to, that’s fine.

(I might edit the Wiki for FastCGI under PHP 5.3 to make it a bit clearer that you don’t need to do anything.)