I had a PHP application that was performing poorly. I investigated the situation and determined that APC cache will filling up constantly. I increased the size of the apc cache so that I don't get any full cache events, and the app is performing nicely.
However...
I was bothered by the fact that that application needed to have so much memory set aside for apc. I have other applications that are very similar and they're running just fine with a default setting of 64M. (I had to go up to 400M to make this app work properly)
So, I dug deeper using apc.php and I saw something very strange. Two different applications, both using the same shared library were reporting drastically different memory usage numbers for the apc cache...
from an app that doesn't have the problem
Filename: tessituraLoginEx2.php Size: 16592
And the app that is using all the extra RAM
Filename: tessituraLoginEx2.php Size: 2717488
Two different applications, both using the same shared library, application A uses 16k of RAM for a file, while applicaiton B uses 2.7MB for the exact same file.
Anybody have any idea why Application A and B would consume such drastically different sizes for the exact same file?
Additional Info
I was able to workaround the issue by changing how the problematic files were being required into the project. The projects both use a framework, calling a helper method that eventually does the require_once of the proper files from the proper directory.
I changed the app to explicitly do a require_once without using the framework and the bloated apc ram usage went away. Still no idea why apc is having this problem when the require happens in a more compex/dynamic way. Luckily we no longer have a need for that complex logic wrapped around the require_once, so this workaround will allow me to go back to reasonable memory allocation to apc.
And to clarify... Both applications were using the same complex logic to do the require_once, but only one has the bloat problem.