3

this is the current apc.ini

extension=apc.so
apc.enabled=1
apc.ttl=86400
apc.user_ttl=86400
apc.shm_segments=1
apc.shm_size=64

which gives me

1 Segment(s) with 64.0 MBytes 
(mmap memory, pthread mutex locking)

the funny thing is that according to this only 32M should be possible..

cat /proc/sys/kernel/shmmax
33554432

if i increase the segments, it has just no effect, but visible in apc.php if i raise shm_size above 64 (regardless of the segments setting) i get the following error:

[apc-error] apc_mmap: mmap failed: No space left on device

i need about 90M of opcache so from my understanding given the shmmax setting i would go for 2x32M segments...

anyone can think of a reason why multiple segments wont work? any idea why 64M is working altough the shmmax limit is 32M?

APC Version 3.0.19
PHP Version 5.2.0-8+etch16

and system (lenny)...

uname -a
Linux vs210044.vserver.de 2.6.9-023stab052.4-smp #1 SMP Tue May 11 19:21:39 MSD 2010 x86_64 GNU/Linux

and yes i know its outdated, didnt get the chance to upgrade yet, its a bit complicated...

The Shurrican
  • 2,240
  • 7
  • 39
  • 60

4 Answers4

2

Looks like some versions of APC (3.0.14 in my case) seems to ignore the value of apc.shm_segments and go with the apc.shm_size, and also it accepts values larger than the maximum allowed size for each segment. Just as in your case. When you allocate more the 32M apache should hang, at least it does in my case.

Why don't you just increase shmmax size in /etc/sysctl.conf to 90M? It solved my problems...

bas
  • 158
  • 1
  • 5
  • yeah, i saw that too. it even throws the error message "ignoring ...." in my apache log, weird why i didnt see that before... thing is i want to mess as little as possible with the system config as the app should be easily deployed to a lot of nodes. problem was jut on a developement server on a staging server it accepts 90m even with 30M limit in sysconfig... works fine. has low priority now, will deal with it later. – The Shurrican Sep 13 '10 at 19:46
0

I had the same issue. You need to define the memory in the format of 64M, instead of just the numeric value (see the default value in the manual).:

apc.shm_size=64M
styu
  • 101
  • 2
0

Remove unused libraries from /etc/php5/apache2/conf.d. Probably you don't need pdo.ini and pdo_mysq.ini or mysqli.ini This will save few Mega of Ram

mazgalici
  • 257
  • 2
  • 5
  • 11
0

do you use apc with mmap? then you cant use multiple segments.

the 32M of /proc/sys/kernel/shmmax are debian default. you can raise them with:

1) file: /etc/sysctl.conf
2) value: kernel.shmmax=134217728
3) save for reboots: sysctl -p

if the system is virtualized - you also should check the openvz, vmware etc limits.

if you dont raise the systemlimits - apc is running out of space with: [apc-error] apc_mmap: mmap failed: No space left on device

I hope that helps - I've seen a lot of threads around the internet with the same problem.