LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > External Applications > PHP > [Resolved] XCache: PHP Out of memory if cache size > 64M

Reply
 
Thread Tools Display Modes
  #1  
Old 08-20-2010, 09:08 AM
gmichels gmichels is offline
Member
 
Join Date: Dec 2008
Posts: 10
Default [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..
Reply With Quote
  #2  
Old 08-21-2010, 12:53 AM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,218
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..
Reply With Quote
  #3  
Old 08-23-2010, 06:45 AM
gmichels gmichels is offline
Member
 
Join Date: Dec 2008
Posts: 10
Quote:
Originally Posted by NiteWave View Post
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 View Post
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 View Post
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!
Reply With Quote
  #4  
Old 08-23-2010, 08:34 AM
mistwang mistwang is offline
LiteSpeed Staff
 
Join Date: May 2003
Location: New Jersey
Posts: 7,590
Quote:
Originally Posted by gmichels View Post
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.
Reply With Quote
  #5  
Old 08-23-2010, 08:58 AM
gmichels gmichels is offline
Member
 
Join Date: Dec 2008
Posts: 10
Quote:
Originally Posted by mistwang View Post
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
Reply With Quote
  #6  
Old 08-23-2010, 10:57 AM
mistwang mistwang is offline
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.
Reply With Quote
  #7  
Old 08-23-2010, 06:21 PM
gmichels gmichels is offline
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
Reply With Quote
  #8  
Old 08-23-2010, 06:22 PM
gmichels gmichels is offline
Member
 
Join Date: Dec 2008
Posts: 10
Let's see if now I can post the topic link: http://forum.lighttpd.net/topic/100898#20348

Guess I can
Reply With Quote
  #9  
Old 08-23-2010, 07:02 PM
mistwang mistwang is offline
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.
Reply With Quote
  #10  
Old 08-23-2010, 07:30 PM
gmichels gmichels is offline
Member
 
Join Date: Dec 2008
Posts: 10
Quote:
Originally Posted by mistwang View Post
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.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 05:08 PM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.