Problems with APC, possible cache-corruption?

Problems with APC, possible cache-corruption?

am 22.06.2009 01:56:22 von James Mclean

(Resend from around 1 week ago, because of no responses)

Hi All,

Over the weekend I setup a test of APC intending to benchmark a Moodle
installation with various APC settings to see how well I could get it
to perform. I successfully installed Moodle 1.9 and 2.0 under Apache
2.2.3 (installed via apt on Ubuntu 9.04), and with PHP 5.2.9 compiled
from source. I should note, that Ubuntu had an older version of PHP
installed from apt with Suhosin hardened PHP built in. Moodle 2.0
required at least PHP 5.2.8, so I uninstalled the original PHP module
before compiling and installing the 5.2.9.

No issues there; PHP worked well and performance was (mostly) acceptable.

Progressed onto installing APC, firstly by downloading the APC 3.1.2
source from PECL and following the usual 'phpize, configure, make,
make install' process which worked as expected, stop and start Apache
and APC was present in my phpinfo();. I started with the reccomended
PHP config exept with error_display turned on and E_ALL | E_STRICT
enabled, and also the reccomended APC config also.

I copied the 'apc.php' from the source tree to my webroot and changed
the password as suggested.

The issue arose when I attempted to benchmark my Moodle install with
'ab' (I realise it only downloads the single page, but it's good
enough for what I need for now though) and the result was no different
to before I had installed APC. View the apc.php page, and the only
page cached is apc.php itself.. Certainly not what I've witnessed in
the past. Then what would happen was if I viewed my seperate info.php
page containing simply the opening PHP tag and a single line with
phpinfo(); in the file - the cache would appear to reset, and it would
firstly not load the info.php into the cache, it would reset the
counter on the apc.php file back to 0.

Through all of this, there was no errors displayed on the screen and
no errors listed in the Apache error log either. Increased the Apache
log level up to Debug, and no related information was displayed.
Moodle itself worked as expected with no errors, and on a seperate
RHEL installation I have Moodle working with APC and it is caching all
it's files as expected.

At this point, I thought it may be an issue with the module I compiled
myself. I backed up the module, and allowed PECL to install the
module, it installed 3.0.19. Restarted Apache and verified the version
was as PECL had built and installed.

This had no effect, and yeilded the same behaviour.

I'm stumped as to what the issue could be, however I did see this
issue of APC not caching files on an installation of Red Hat
Enterprise Linux in the past - however at the time we assumed it was
an issue with the framework we were using and due to time constraints
simply ran without APC and didn't investigate further.

Has anyone seen this issue in the past and perhaps even rectified it?

Any information would be appreciated.

Cheers,

James

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Problems with APC, possible cache-corruption?

am 22.06.2009 02:10:04 von Nathan Nobbe

--000325579fd62f946d046ce4b229
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

On Sun, Jun 21, 2009 at 5:56 PM, James McLean wrote:

> (Resend from around 1 week ago, because of no responses)
>
> Hi All,
>
> Over the weekend I setup a test of APC intending to benchmark a Moodle
> installation with various APC settings to see how well I could get it
> to perform. I successfully installed Moodle 1.9 and 2.0 under Apache
> 2.2.3 (installed via apt on Ubuntu 9.04), and with PHP 5.2.9 compiled
> from source. I should note, that Ubuntu had an older version of PHP
> installed from apt with Suhosin hardened PHP built in. Moodle 2.0
> required at least PHP 5.2.8, so I uninstalled the original PHP module
> before compiling and installing the 5.2.9.
>
> No issues there; PHP worked well and performance was (mostly) acceptable.
>
> Progressed onto installing APC, firstly by downloading the APC 3.1.2
> source from PECL and following the usual 'phpize, configure, make,
> make install' process which worked as expected, stop and start Apache
> and APC was present in my phpinfo();. I started with the reccomended
> PHP config exept with error_display turned on and E_ALL | E_STRICT
> enabled, and also the reccomended APC config also.
>
> I copied the 'apc.php' from the source tree to my webroot and changed
> the password as suggested.
>
> The issue arose when I attempted to benchmark my Moodle install with
> 'ab' (I realise it only downloads the single page, but it's good
> enough for what I need for now though) and the result was no different
> to before I had installed APC. View the apc.php page, and the only
> page cached is apc.php itself.. Certainly not what I've witnessed in
> the past. Then what would happen was if I viewed my seperate info.php
> page containing simply the opening PHP tag and a single line with
> phpinfo(); in the file - the cache would appear to reset, and it would
> firstly not load the info.php into the cache, it would reset the
> counter on the apc.php file back to 0.
>
> Through all of this, there was no errors displayed on the screen and
> no errors listed in the Apache error log either. Increased the Apache
> log level up to Debug, and no related information was displayed.
> Moodle itself worked as expected with no errors, and on a seperate
> RHEL installation I have Moodle working with APC and it is caching all
> it's files as expected.
>
> At this point, I thought it may be an issue with the module I compiled
> myself. I backed up the module, and allowed PECL to install the
> module, it installed 3.0.19. Restarted Apache and verified the version
> was as PECL had built and installed.
>
> This had no effect, and yeilded the same behaviour.
>
> I'm stumped as to what the issue could be, however I did see this
> issue of APC not caching files on an installation of Red Hat
> Enterprise Linux in the past - however at the time we assumed it was
> an issue with the framework we were using and due to time constraints
> simply ran without APC and didn't investigate further.
>
> Has anyone seen this issue in the past and perhaps even rectified it?
>
> Any information would be appreciated.


did you take a look at the size of the cache you created ? also, arent you
planning to cache php opcodes, so if you load up the page, index.html, i
would expect to see a bunch of php files mentioned in the apc cache.. if
apc has support for output caching, ive not yet used it so im not sure how
much i could help there (sort of sounds like youre shooting for output
caching the way you describe things above).

maybe you could dump out your ini settings for apc and share them here?

-nathan

--000325579fd62f946d046ce4b229--

Re: Problems with APC, possible cache-corruption?

am 22.06.2009 02:17:50 von James Mclean

On Mon, Jun 22, 2009 at 9:40 AM, Nathan Nobbe wrote=
:
> On Sun, Jun 21, 2009 at 5:56 PM, James McLean
> wrote:
> did you take a look at the size of the cache you created ?

Yes. Tried multiple segments and single, with cache size values
between 128mb and 256mb. Also tried with stat on and off.

> also, arent you planning to cache php opcodes, so if you load up the page=
, index.html, i
> would expect to see a bunch of php files mentioned in the apc cache..

Well, index.html wouldn't be cached because it's not parsed by the PHP
engine. But yes, if it were index.php for example each compiled PHP
file is then cached in the opcode cache - include files and
everything. This is how it works on every other APC installation i've
tried :)

This installation is not doing that, even though this is the default behavi=
our.

> if apc has support for output caching, ive not yet used it so im not sure=
how
> much i could help there (sort of sounds like youre shooting for output
> caching the way you describe things above).

No, i'm not looking for output caching. Apologies if my original email
was poorly worded.

> maybe you=A0 could dump out your ini settings for apc and share them here=
?

No need. they're all default as reccomended by PHP and APC.

Thanks,

James

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Problems with APC, possible cache-corruption?

am 22.06.2009 02:32:15 von Jonathan Tapicer

Can you do a phpinfo(); and tell us the value of the setting
apc.filters (or every apc.* if you can)? Just curious, but I've seen
apps set that setting to avoid APC opcode caching.

Jonathan

On Sun, Jun 21, 2009 at 8:56 PM, James McLean wrote:
> (Resend from around 1 week ago, because of no responses)
>
> Hi All,
>
> Over the weekend I setup a test of APC intending to benchmark a Moodle
> installation with various APC settings to see how well I could get it
> to perform. I successfully installed Moodle 1.9 and 2.0 under Apache
> 2.2.3 (installed via apt on Ubuntu 9.04), and with PHP 5.2.9 compiled
> from source. I should note, that Ubuntu had an older version of PHP
> installed from apt with Suhosin hardened PHP built in. Moodle 2.0
> required at least PHP 5.2.8, so I uninstalled the original PHP module
> before compiling and installing the 5.2.9.
>
> No issues there; PHP worked well and performance was (mostly) acceptable.
>
> Progressed onto installing APC, firstly by downloading the APC 3.1.2
> source from PECL and following the usual 'phpize, configure, make,
> make install' process which worked as expected, stop and start Apache
> and APC was present in my phpinfo();. I started with the reccomended
> PHP config exept with error_display turned on and E_ALL | E_STRICT
> enabled, and also the reccomended APC config also.
>
> I copied the 'apc.php' from the source tree to my webroot and changed
> the password as suggested.
>
> The issue arose when I attempted to benchmark my Moodle install with
> 'ab' (I realise it only downloads the single page, but it's good
> enough for what I need for now though) and the result was no different
> to before I had installed APC. View the apc.php page, and the only
> page cached is apc.php itself.. Certainly not what I've witnessed in
> the past. Then what would happen was if I viewed my seperate info.php
> page containing simply the opening PHP tag and a single line with
> phpinfo(); in the file - the cache would appear to reset, and it would
> firstly not load the info.php into the cache, it would reset the
> counter on the apc.php file back to 0.
>
> Through all of this, there was no errors displayed on the screen and
> no errors listed in the Apache error log either. Increased the Apache
> log level up to Debug, and no related information was displayed.
> Moodle itself worked as expected with no errors, and on a seperate
> RHEL installation I have Moodle working with APC and it is caching all
> it's files as expected.
>
> At this point, I thought it may be an issue with the module I compiled
> myself. I backed up the module, and allowed PECL to install the
> module, it installed 3.0.19. Restarted Apache and verified the version
> was as PECL had built and installed.
>
> This had no effect, and yeilded the same behaviour.
>
> I'm stumped as to what the issue could be, however I did see this
> issue of APC not caching files on an installation of Red Hat
> Enterprise Linux in the past - however at the time we assumed it was
> an issue with the framework we were using and due to time constraints
> simply ran without APC and didn't investigate further.
>
> Has anyone seen this issue in the past and perhaps even rectified it?
>
> Any information would be appreciated.
>
> Cheers,
>
> James
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Problems with APC, possible cache-corruption?

am 22.06.2009 02:37:34 von James Mclean

On Mon, Jun 22, 2009 at 10:02 AM, Jonathan Tapicer wrote:
> Can you do a phpinfo(); and tell us the value of the setting
> apc.filters (or every apc.* if you can)? Just curious, but I've seen
> apps set that setting to avoid APC opcode caching.

Certainly, however it will have to wait until I am home and have
access to that machine again. Though I'm not sure that would be the
case as APC is caching all Moodle files on my development server here.
That being said I'll grep the codebase anyway to see if it's setting
any filters.

Thanks.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Problems with APC, possible cache-corruption?

am 22.06.2009 22:47:57 von Nathan Nobbe

--00221532ca24377a26046cf5fd54
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit

On Sun, Jun 21, 2009 at 6:17 PM, James McLean wrote:

> On Mon, Jun 22, 2009 at 9:40 AM, Nathan Nobbe
> wrote:
> > On Sun, Jun 21, 2009 at 5:56 PM, James McLean
> > wrote:
> > did you take a look at the size of the cache you created ?
>
> Yes. Tried multiple segments and single, with cache size values
> between 128mb and 256mb. Also tried with stat on and off.
>
> > also, arent you planning to cache php opcodes, so if you load up the
> page, index.html, i
> > would expect to see a bunch of php files mentioned in the apc cache..
>
> Well, index.html wouldn't be cached because it's not parsed by the PHP
> engine. But yes, if it were index.php for example each compiled PHP
> file is then cached in the opcode cache - include files and
> everything. This is how it works on every other APC installation i've
> tried :)
>
> This installation is not doing that, even though this is the default
> behaviour.
>
> > if apc has support for output caching, ive not yet used it so im not sure
> how
> > much i could help there (sort of sounds like youre shooting for output
> > caching the way you describe things above).
>
> No, i'm not looking for output caching. Apologies if my original email
> was poorly worded.
>
> > maybe you could dump out your ini settings for apc and share them here?
>
> No need. they're all default as reccomended by PHP and APC.


hmm, 2 other thoughts i have..

.. long shot, but do you have apc.php installed on a diff domain than the
moodle app (not sure but i suspect apc.php only shows cached values for the
domain in which its currently running (i know this is something eaccelerator
does).

.. as a test, perhaps setup a simple test site, w/ 2 files, apc.php and one
index.php file on this rhel box. if things are working (index.php cached w/
apc.php), it would seem something goofy is going on indside the moodle app.

-nathan

--00221532ca24377a26046cf5fd54--

Re: Problems with APC, possible cache-corruption?

am 23.06.2009 02:04:24 von James Mclean

On Tue, Jun 23, 2009 at 6:17 AM, Nathan Nobbe wrote=
:
> hmm, 2 other thoughts i have..
>
> . long shot, but do you have apc.php installed on a diff domain than the
> moodle app (not sure but i suspect apc.php only shows cached values for t=
he
> domain in which its currently running (i know this is something eaccelera=
tor
> does).

No. Same domain.

> . as a test, perhaps setup a simple test site, w/ 2 files, apc.php and on=
e
> index.php file on this rhel box.=A0 if things are working (index.php cach=
ed w/
> apc.php), it would seem something goofy is going on indside the moodle ap=
p.

The RHEL box works flawlessly, as has almost every other APC install
i've ever done. I simply used it as an example that Moodle likely
wasn't at fault, and I have since further proved this by grepping the
source - it isn't setting any of it's own apc filters as suggested
before.

On the APC install that is not working correctly, when I switch
between my info.php and apc.php files - the counter on the cached file
(apc.php) resets, and info.php is not cached. That was all outlined in
the original email.

I guess this is not a common issue, no one seems to have experienced it bef=
ore..

Cheers

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php