|
|

08-20-2010, 09:08 AM
|
|
Member
|
|
Join Date: Dec 2008
Posts: 10
|
|
[Resolved] XCache: PHP Out of memory if cache size > 64M
Hi all,
I have an IPB3 forum running on the following hardware:
- 8 core Intel i7 2.67 GHz
- 12 GB RAM
- 2x SATA HDDs
And software:
- LiteSpeed 4.0.16 (4-cpu license)
- PHP 5.3.3
The forum online user count usually ranges from 500-1200.
I tried to use eAccelerator first, but it had some big issues (100% cpu usage sometimes, never seen the load avg so high) and had to drop it. Now I'm trying XCache and I must say I already like it MUCH better than eAccelerator.
I'm using these settings:
Code:
xcache.size="64M"
xcache.count="8"
xcache.ttl="300"
xcache.var_size="8M"
xcache.var_count="8"
xcache.var_ttl="300"
xcache.stat="Off"
The problem is the cache gets filled after a few minutes and I get a lot of OOMs on the admin page. So I should increase the cache size, however I get loads of PHP out of memory errors if I set it to anything over 64M:
Code:
[STDERR] PHP Fatal error: Out of memory (allocated 14417920) (tried to allocate 32 bytes)
[STDERR] PHP Fatal error: Out of memory (allocated 13631488) (tried to allocate 83 bytes)
[STDERR] PHP Fatal error: Out of memory (allocated 13631488) (tried to allocate 3 bytes)
Here are my sysctl values:
Code:
# sysctl -a |grep shm
kernel.shmmax = 1073741824
kernel.shmall = 262144
kernel.shmmni = 4096
vm.hugetlb_shm_group = 0
Adding xcache.gc_interval="120" does help as seldomly accessed scripts are removed from the cache and memory is freed, however I still would like to increase my cache size.
Any clues?
Thanks
Last edited by NiteWave; 08-23-2010 at 07:39 PM..
|

08-21-2010, 12:53 AM
|
|
LiteSpeed Staff
|
|
Join Date: Sep 2009
Posts: 2,226
|
|
|
assume php in non-suExec mode? php in suExec mode not utilize opcode cache efficiently.
what's the memory limit setting for a php process? it can set in php.ini like normal php, also there are "Memory Soft/Hard Limit" setting for lsphp.
How about try APC? performance-wise, APC should not be worse than XCache or even better. If APC can set shared memory > 64M or 128M without any problem, you can get quick answer to your question.
Last edited by NiteWave; 08-21-2010 at 06:53 AM..
|

08-23-2010, 06:45 AM
|
|
Member
|
|
Join Date: Dec 2008
Posts: 10
|
|
Quote:
Originally Posted by NiteWave
assume php in non-suExec mode? php in suExec mode not utilize opcode cache efficiently.
|
No, php is not running in suExec mode.
Quote:
Originally Posted by NiteWave
what's the memory limit setting for a php process? it can set in php.ini like normal php, also there are "Memory Soft/Hard Limit" setting for lsphp.
|
You mean memory_limit in php.ini? It's set to 128M. Should this setting be raised to include the cache memory size?
Settings for lsphp are 250M soft and 300M hard.
Quote:
Originally Posted by NiteWave
How about try APC? performance-wise, APC should not be worse than XCache or even better. If APC can set shared memory > 64M or 128M without any problem, you can get quick answer to your question.
|
I just installed APC and I get the same thing, cache size up to 64M is ok, more than that PHP Out of Memory errors all over the log.
Thanks for your time!
|

08-23-2010, 08:34 AM
|
|
LiteSpeed Staff
|
|
Join Date: May 2003
Location: New Jersey
Posts: 7,590
|
|
Quote:
Originally Posted by gmichels
You mean memory_limit in php.ini? It's set to 128M. Should this setting be raised to include the cache memory size?
|
Yes, that's correct.
|

08-23-2010, 08:58 AM
|
|
Member
|
|
Join Date: Dec 2008
Posts: 10
|
|
Quote:
Originally Posted by mistwang
Yes, that's correct.
|
Increased memory_limit to 256M and cache size to 128M, still got out of memory errors. However I tried the cache size at 96M and it is working now, so indeed increasing the limit seems to be the solution.
Should I still increase the memory_limit and cache size until I don't get 100% cache usage? Is there any danger in doing so? I do use TTLs for deleting unused scripts.
Thanks
|

08-23-2010, 10:57 AM
|
|
LiteSpeed Staff
|
|
Join Date: May 2003
Location: New Jersey
Posts: 7,590
|
|
|
For running PHP without suEXEC, you can set cache memory size high as one group PHP processes only use one copy of cache. It is up to you and the available memory of your server.
|

08-23-2010, 06:21 PM
|
|
Member
|
|
Join Date: Dec 2008
Posts: 10
|
|
I increased memory_limit to 512M but I still can't go over 96M for cache size. I have also posted [1] this same problem on xcache's forum and one user there had xcache working with cache size 256M and php memory_limit 128M, so it seems increasing memory_limit is not the solution.
Unfortunately I don't know what else to do 
[1] I can't post links as I don't have enough posts to do so
|

08-23-2010, 07:02 PM
|
|
LiteSpeed Staff
|
|
Join Date: May 2003
Location: New Jersey
Posts: 7,590
|
|
|
You need to increase the memory limits of lsphp5 external app from LSWS web console as well.
|

08-23-2010, 07:30 PM
|
|
Member
|
|
Join Date: Dec 2008
Posts: 10
|
|
Quote:
Originally Posted by mistwang
You need to increase the memory limits of lsphp5 external app from LSWS web console as well.
|
That's it, you nailed it. Process limit was at 250/300MB, increased it to 500/600MB and now I can increase the cache size without issues.
Thanks a lot for your help.
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 01:06 PM.
|
|