• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

PHP 5.4 and APC

Moshe1010

Well-known member
#1
Since the stable version (3.1.9) doesn't work with PHP 5.4 (gives segmentation fault while trying to run php command on the server), is their any problem runnning APC 3.1.13 Beta with PHP 5.4?

Thanks.
 

CTXMedia

Formerly CyclingTribe
#2
I'm using 3.1.13 with PHP 5.4.11 and the only issue I had was with apc.stat - I had to keep it set to the default value of 1 (check all files for changes each time they're requested).
 

Moshe1010

Well-known member
#4
Yes, apc.stat is 1 at my server.
I have a lot Fragmentation (12%), but I guess it's because of my crappy Wordpress. Is there a way to separate APC from different domains on the same VPS? I mean, showing different stats for each on of my domains on the server.
 

Teapot

Well-known member
#6
What are the advantages?
Here's a good overview of the relative merits straight from the horse's mouth: https://wiki.php.net/rfc/optimizerplus

Notably:

Advantages of Optimizer+ over APC
  1. Performance. Zend Optimizer+ has a consistent performance edge over APC, which, depending on the code, can range between 5 and 20% in terms of requests/second. See Benchmarks section below.
  2. Availability for new PHP versions. Optimizer+ is typically fully compatible with PHP releases even before they come out; While this advantage was rarely realized because of the closed-source nature of the component, once open-source, both Zend and the community will help ensure that it’s always fully compatible with every element of the PHP language, avoiding any lags.
  3. Reliability. Optimizer+ has optional corruption detection capabilities that can prevent a server-wide crash in case of data corruption (e.g. from a faulty implementation of a PHP function in C). This handles one of the very few downsides of using a shared-memory-based-opcode-cache - introducing a shared resource that - if corrupted - could bring down an entire server.
  4. Better compatibility. We strived to make Optimizer+ work with any and all constructs supported by PHP, in exactly the same way they’d behave without it.
Advantages of APC over Optimizer+
  1. Has a data caching API. APC has a data caching API which Optimizer+ does not have.
  2. APC can reclaim memory of old invalidated scripts. APC uses a memory manager and can reclaim memory associated with a script that is no longer in use; Optimizer+ works differently, and marks such memory as ‘dirty’, but never actually reclaims it. Once the dirty percentage climbs above a configurable threshold - Optimizer+ restarts itself. Note that this behavior has both stability advantages and disadvantages.
 

Arantor

Active member
#9
Considering that it's an opcode cache only, it doesn't do data caching (unlike APC which does), it would seem that no configuration is actually needed...
 

Moshe1010

Well-known member
#10
Considering that it's an opcode cache only, it doesn't do data caching (unlike APC which does), it would seem that no configuration is actually needed...
If I would like Zend Optimizer+ to do data caching, would the configuration be on the server level or XF level (config.php? or anything else) or both?
 

Moshe1010

Well-known member
#14
It's an opcode cache, not a data cache. It's opcode cache is better than APCs.
So the question is how the benchmark would look like if APC would work with data cache and opcode versus ZO+ with opcode cache alone. Are there any benchmarks like that somewhere?
 

Jeremy P

Well-known member
#15
So the question is how the benchmark would look like if APC would work with data cache and opcode versus ZO+ with opcode cache alone. Are there any benchmarks like that somewhere?
Not that I know of but you can use something like memcached for data cache and ZO+. No reason to sacrifice data cache just for ZO+.

I personally use Redis for data caching in PHP apps but XenForo doesn't support this in the core (yet).
 

Moshe1010

Well-known member
#16
Not that I know of but you can use something like memcached for data cache and ZO+. No reason to sacrifice data cache just for ZO+.

I personally use Redis for data caching in PHP apps but XenForo doesn't support this in the core (yet).
memcached should be configured on the server level or/and Xenforo level? I saw some lines that are one should add to the config.php file once memcached installed, but other then that, is there anything else?

I guess data cache isn't relevant for small boards? (500K posts)?
 

Moshe1010

Well-known member
#20
OK, I got it. ZO+ is only for php 5.2, 5.3 and currently 5.5 (beta/alpha). If you have PHP 5.4 on your server, it's recommended to use Zend Guard instead, which sucks most of the time.

It looks like APC 3.1.13 isn't stable with PHP 5.4, but I'm not sure if it's a local problem on my server due to configuration or something that other people experience.