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

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > Install/Configuration > PHP LsPCI and APC ? ==> PHP LSAPI and APC ?

Reply
 
Thread Tools Display Modes
  #1  
Old 01-13-2013, 09:59 AM
Monarobase Monarobase is offline
Senior Member
 
Join Date: Jan 2013
Posts: 95
Default PHP LsPCI and APC ? ==> PHP LSAPI and APC ?

Edit : Sorry about the title, obviously not LSPCI but LSAPI !

Hello,

We're looking into purchasing a LSWS licence for our new server configuration and I've read your documentation about APC and am not sure which is the best configuration for this.

We run cPanel serveurs with CloudLinux 6 + CageFS.

I've already read this :

http://www.litespeedtech.com/support...p:opcode_cache

But have also read that Litespeed 4.2 added suexec support.

This is what we are lookind for :

1) PHP to be run with the same user as the FTP user (I've read that some hosts dont want this but we do because our customers like being able to run updates and installs without playing with chmods).

2) To have a single APC cache per user shared by multiple children.

3) To be sure that cache is not accessible between different user accounts.

Before looking at litespeed we looked at PHP-FPM but PHP-FPM's pools did not prevent users from accessing each other's cache and it was too complicated to run multiple instances of PHP-FPM (one instances with one pool per user).

Is Litespeed the miraculous solution to my problem ?

Thanks !

Last edited by NiteWave; 01-14-2013 at 06:24 PM..
Reply With Quote
  #2  
Old 01-13-2013, 05:24 PM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,220
in lsws admin console,
Server->General->Cloud Linux
there are 4 choices:
Disabled
LVE
CageFS
CageFS without suEXEC

"CaseFS" can meet your requirement 1)

however 2) 3)
is not possible in shared host environment which may have thousands of user accounts -- at the time being.

there is a workaround to meet the requirements closely. choose xcache instead of apc, while one copy of opcode cache is shared by all accounts, only admin can see the cache's content.
Reply With Quote
  #3  
Old 01-14-2013, 12:33 AM
Monarobase Monarobase is offline
Senior Member
 
Join Date: Jan 2013
Posts: 95
Quote:
By using the PHP_LSAPI_CHILDREN method, only a single APC shared memory slice will be created and shared by all children.
Does this mean that multiple children are allowed but all run from the root user so APC stores can communicate between each other ?

Does XCache have an object cache like APC ? If so would it be secured between users ?

Lots of scripts are compatible with APC, I'm not sure how many can nativly use Xcache object caching
Reply With Quote
  #4  
Old 01-14-2013, 01:06 AM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,220
xcache has opcode cache as well as variable cache, like apc.
xcache is popular and famous enough, no less than apc.

Quote:
APC stores can communicate between each other ?
how can they communicate with each other (account?), can you give example?

it's like all accounts may store php session in /tmp, but it's regarded safe enough - php script can't make use of it to see other account's data.
Reply With Quote
  #5  
Old 01-14-2013, 07:06 AM
Monarobase Monarobase is offline
Senior Member
 
Join Date: Jan 2013
Posts: 95
Thanks

Will XCache prevent users from accessing each others Object cache code ?

Also

Quote:
however 2) 3)
is not possible in shared host environment which may have thousands of user accounts -- at the time being.
Does Litespeed have a list of features that are planned for the next major release ? If not is this a feature that's being concidered ?

And is there some form of ETA for this feature ?
Reply With Quote
  #6  
Old 01-14-2013, 08:06 AM
Monarobase Monarobase is offline
Senior Member
 
Join Date: Jan 2013
Posts: 95
Quote:
how can they communicate with each other (account?), can you give example?
Here's an example :
With APC and PHP-FPM, APC is launched at the startup of PHP when it is owned by root so when PHP-FPM forks an instance of PHP this instance accesses a global instance of APC.

If the unix user : UserA runs

apc_store ('foo', 'hello world');

Then unix user: UserB runs :

print apc_fetch('foo');

It will output 'hello world'

If unix user UserB then runs :

apc_store('foo', 'Goodbye world');

UserA expects the value to be Hello world but when he runs :

apc_fetch('foo');

it outputs 'Goodbye World'
Reply With Quote
  #7  
Old 01-14-2013, 10:46 AM
Monarobase Monarobase is offline
Senior Member
 
Join Date: Jan 2013
Posts: 95
I've just read that xcache caches per process just like APC.

If xcache has no protection to prevent users from accessing each other's cache set with xcache_set() and retrieved with xcache_get() then xcache has exactly the same problem as APC.

As far as I can see the only solution here to use Xcache or APC would be to either run one PHP process per user and fork this process for that user (Fastcgi can do this but fcgid can't from what I've understood LSAPI can't either
Reply With Quote
  #8  
Old 01-14-2013, 03:45 PM
waski waski is offline
Member
 
Join Date: Jan 2013
Posts: 19
Quote:
Originally Posted by NiteWave View Post
however 2) 3)
is not possible in shared host environment which may have thousands of user accounts -- at the time being.
I thought that your suexec deamon support opcache sharing along process as per you blog:

"In suEXEC daemon mode, all PHP worker processes are forked off the same parent process running as root, PHP opcode cache memory are shared by all PHP processes, and it won’t be flushed as long as the parent process still running. "

http://blog.litespeedtech.com/2012/09/
Reply With Quote
  #9  
Old 01-14-2013, 05:37 PM
NiteWave NiteWave is offline
LiteSpeed Staff
 
Join Date: Sep 2009
Posts: 2,220
sorry for confusion.
Quote:
however 2) 3)
is not possible in shared host environment which may have thousands of user accounts -- at the time being.

there is a workaround to meet the requirements closely. choose xcache instead of apc, while one copy of opcode cache is shared by all accounts, only admin can see the cache's content.
should add lsphp suEXEC daemon mode:

lsphp suEXEC daemon mode + xcache will meet the requirement closely.

however, it's close, not exactly as 2) + 3). since
Quote:
2) To have a single APC cache per user shared by multiple children.
it's per user; while for lsphp + suEXEC daemon, all users share one lsphp parent process. assume there are 1 thousand users, 2) means need 1000 parent php process; while there is only 1 parent lsphp process in lsphp + suEXEC daemon.

Quote:
If xcache has no protection to prevent users from accessing each other's cache set with xcache_set() and retrieved with xcache_get() then xcache has exactly the same problem as APC.
if this is confirmed, then there's really a problem in lsphp + suEXEC daemon mode regarding variable cache(or object cache).

however, there is no problem for opcode cache since the php scripts under each account has different path, so the opcode cache can't be accessed each other.
Reply With Quote
  #10  
Old 01-15-2013, 01:48 AM
waski waski is offline
Member
 
Join Date: Jan 2013
Posts: 19
Quote:
Originally Posted by NiteWave View Post
if this is confirmed, then there's really a problem in lsphp + suEXEC daemon mode regarding variable cache(or object cache).
Would you mind to confirm/deny that ? It might be quite an issue in case of security.
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 08:26 PM.



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