Jump to content

Xcache vs. other solutions

Featured Replies

Posted

Hi,

We use Xcache on our installation.

On another topic, Grumpy recommended:

  • Installing php opcache (like zend opcache)
  • Installing user cache (like APCu)

Xcache is already a PHP code optimizer, PHP code cache, and PHP variable cache. I wonder if Xcache alone is enough of if I should replace it with other solutions. Your thoughts?

Thanks,

Gabriel.

I recommend zend opcache over alternatives because of vast performance improvement. apc & xcache is roughly equal. zend opcache like... blows them out. In terms of performance, it's not even a competition. It will win by such a big margin no matter what kind of data sample you give (or at least all the samples tried...).

On the user cache side, it matters less, it seems. Whether you use apcu/acp/xcache, shouldn't matter much. Just be sure to turn off the opcache portion so that it doesn't conflict with zend opcache. From php5.5+, zend opcache is built in, and only need to be turned on in php configuration to use. It's really the only future at this point. xcache & apc's developments are dead mostly now.

  • Author

Thank you for the prompt reply, will play with this right away!

would be interested in seeing someones php.ini opcode_cache settings.

or did this one use a conf file? I don't remember right now.

using xcache now but with it built in to 5.5 was planning on using it.

  • Author

Dmacleo,

It is configured at php.ini. On PHP <5.5 you can download and compile it, with PHP 5.5 the only difference is that you add --enable-opcache at the ./configure line to compile the module together with PHP. You still need to add the zend_extension = /path/to/opcache.so in the php.ini file as you would on PHP < 5.5.

Gabriel.

 


would be interested in seeing someones php.ini opcode_cache settings.

or did this one use a conf file? I don't remember right now.

using xcache now but with it built in to 5.5 was planning on using it.

Here's the full config with descriptions.

zend opcache is for opcode caching only and not for data also as the APC.

 

Dmacleo,

It is configured at php.ini. On PHP <5.5 you can download and compile it, with PHP 5.5 the only difference is that you add --enable-opcache at the ./configure line to compile the module together with PHP. You still need to add the zend_extension = /path/to/opcache.so in the php.ini file as you would on PHP < 5.5.

Gabriel.

yup, I am compiled with it and disabled in php.ini right now.

 

Here's the full config with descriptions.

I have seen that, should have clarified I was meaning what people are actually running.

I had issues with xcache and this and didn't get a chance to troubleshoot (was about 2 months ago or so) so disabled this for now.

pretty sure its one of the options I just need to see what one, wondering if anyone running xcache and this together.

  • Author

Yes, I am running Xcache and the Zend Opcode together here without any issues. However, you need to disable the optimizer and the code cacher from Xcache, leaving enabled only the var cache. This can be accomplished by changing those settings on php.ini:

xcache.size = 0 (disables code caching)

xcache.optimizer = Off (disables code optimizer)

Make sure you have the variable cache enabled, though:

xcache.var_size = 8M
xcache.var_count = 8
xcache.var_slots = 8K
(These are the values I use here and work fine)
Gabriel.

that makes sense, I suspected it was code cache part of xcache doing it but had not had a chance to look deeply.

either of you use any webgui to monitor?

  • Author

Thanks for sharing. I will try them out.

 

either of you use any webgui to monitor?

Yep, I used the very same script you linked. It works wonderfully.

The visualize partition option is utterly awesome as well.

the realtime on this one is pretty cool

https://github.com/amnuts/opcache-gui

have not done much tweaking but do have a 99.5% hit rate so far, xcache enabled also as discussed few posts up. do also have mod_pagespeed running (minimal tweaking) and stuff seems to work ok.

I do know I need to reduce some image sizes and stuff on main content page for initial visit speeds but all in all its still decent.

forum index, with lot of hooks and stuff, loads quick.

the few ads actually to seem to be the slow downs, not much I can do there.

~98.36% hit rate for me,

opcache_enabled true
cache_full true
restart_pending false
restart_in_progress false
used_memory 125.41 MB
free_memory 13.23 kB
wasted_memory 2.58 MB
current_wasted_percentage 2.01%
num_cached_scripts 1694
num_cached_keys 1725
max_cached_keys 7963
hits 124062964
start_time Sun, 06 Jul 14 16:19:17 -0400
last_restart_time Sun, 06 Jul 14 18:53:56 -0400
oom_restarts 1
hash_restarts 0
manual_restarts 0
misses 2070255
blacklist_misses 0
blacklist_miss_ratio 0.00%
opcache_hit_rate 98.36%

mines not been running long (90 min or so) so I need to watch but I think I can dump memory down a lot, will know more tomorrow

 

Used Memory 56.2M
Free Memory 959.7M
Wasted Memory 8.1M
Current Wasted Percentage 0.8

Num Cached Scripts 610
Num Cached Keys 659
Max Cached Keys 7963
Hits 56414
Oom Restarts 0
Hash Restarts 0
Manual Restarts 0
Misses 655
Blacklist Misses 0
Blacklist Miss Ratio 0
Opcache Hit Rate 98.9

@Kirito, can you give opcache any more memory? You had an OOM restart within two days of starting, so can probably increase the hit rate with a little more memory and avoid the cold cache reload on each restart.

With IPS and Drupal on the server:

 

opcache_enabled true

cache_full false

restart_pending false

restart_in_progress false

used_memory 120.81 MB

free_memory 123.74 MB

wasted_memory 11.45 MB

current_wasted_percentage 4.47%

buffer_size 8388608

used_memory 8.00 MB

free_memory 40 bytes

number_of_strings 159896

num_cached_scripts 1757

num_cached_keys 1797

max_cached_keys 7963

hits 36009458

start_time Mon, 30 Jun 14 11:43:02 -0500

last_restart_time Mon, 30 Jun 14 21:45:53 -0500

oom_restarts 0

hash_restarts 0

manual_restarts 1

misses 25378

blacklist_misses 0

blacklist_miss_ratio 0.00%

opcache_hit_rate 99.93%

 

Yes, I am running Xcache and the Zend Opcode together here without any issues. However, you need to disable the optimizer and the code cacher from Xcache, leaving enabled only the var cache. This can be accomplished by changing those settings on php.ini:

xcache.size = 0 (disables code caching)

xcache.optimizer = Off (disables code optimizer)

Make sure you have the variable cache enabled, though:

xcache.var_size = 8M
xcache.var_count = 8
xcache.var_slots = 8K
(These are the values I use here and work fine)
Gabriel.

are these the only xcahce settings you have?

 

@Kirito, can you give opcache any more memory? You had an OOM restart within two days of starting, so can probably increase the hit rate with a little more memory and avoid the cold cache reload on each restart.

Yeah, I'll up it to 192MB later tonight and see how that goes, thanks for the tip.

  • Author
 

are these the only xcahce settings you have?

[xcache]

xcache.shm_scheme = "mmap"
xcache.size = 0
xcache.var_size = 8M
xcache.var_count = 8
xcache.var_slots = 8K
xcache.var_ttl = 0
xcache.var_maxttl = 0
xcache.var_gc_interval = 300
xcache.var_namespace_mode = 0
xcache.var_namespace = ""
xcache.readonly_protection = Off
xcache.mmap_path = "/dev/zero"
xcache.coredump_directory = ""
xcache.disable_on_crash = Off
xcache.experimental = Off
xcache.cacher = On
xcache.stat = On
xcache.optimizer = Off
[xcache.coverager]
xcache.coverager = Off
xcache.coverager_autostart = On
xcache.coveragedump_directory = ""
I also have the GUI installed, so with that you can monitor for any OOMs and readjust as necessary.
Thanks for mentioning mod_pagespeed, I didn't know this one, I will take a look at it.
Gabriel

those look (going off memory right now) similar to my settings, thanks.

still playing around with pagespeed settings but once I learn it all can post my configs for you.

need to make changes, test and evaluate on some items, then change back as needed LOL

  • Author

I will open a new topic on pagespeed... Too many options there...

yup lot of way to screw things up too, and since I am using directadmin its also a pita to update which I see I need to do LOL

Archived

This topic is now archived and is closed to further replies.

Recently Browsing 0

  • No registered users viewing this page.