Re: [PHP] XCache, APC, Memcached... confused

2008-10-23 Thread ceo

 First of all you need to get it clear in your head what an opcode cache 

 is actually doing. It does not cache the website, it caches the 

 compiled version of the PHP scripts such that PHP doesn't need to 

 recompile each file every time it's included which is the default way 

 PHP works.



And, to be really clear, the savings in compile time is gravy.



The REAL savings is not hitting that slow-spinning disk drive to LOAD the PHP 
script into RAM.



You'd get very similar performance boost if the opcode cache simply cached the 
PHP source.



But it's just as easy to cache the compiled version, and that saves a few more 
microseconds/milliseconds.



Depends how big/long/convoluted the PHP source is, but, really, it rarely is 
that big of a file.



I doubt that 2 opcode caches can run in parallel, as they both hook into the 
same line of code in PHP.  And if they did run in parallel, the second one 
would not help in the least, and would actually just be more overhead for zero 
gain.



PS

All the opcode caches have a strategy for unloading less-used scripts if RAM is 
full, so don't sweat it unless you have crazy number of scripts.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] XCache, APC, Memcached... confused

2008-10-22 Thread Martin Zvarík

Hi,
I became confused after an hour trying to understand the PHP cache 
solutions.


XCache, APC, eAccelerator and others are opcode cache systems... is 
memcache in the same category? or is it completely different?


If I install for example XCache, set it for certain directory... it will 
automatically cache the website into the memory. What happens if the 
memory will get full?


Thanks for explanation,
Martin

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] XCache, APC, Memcached... confused

2008-10-22 Thread Stut

On 22 Oct 2008, at 22:19, Martin Zvarík wrote:
I became confused after an hour trying to understand the PHP cache  
solutions.


XCache, APC, eAccelerator and others are opcode cache systems... is  
memcache in the same category? or is it completely different?


Memcache is completely different in that it's not an opcode cache,  
it's an in-memory volatile cache for arbitrary key = value data with  
a client-server API.


If I install for example XCache, set it for certain directory... it  
will automatically cache the website into the memory. What happens  
if the memory will get full?



First of all you need to get it clear in your head what an opcode  
cache is actually doing. It does not cache the website, it caches  
the compiled version of the PHP scripts such that PHP doesn't need to  
recompile each file every time it's included which is the default way  
PHP works.


Secondly, if you run out of memory you buy more!! But seriously, you'd  
need a very very very big site to have this problem. An opcode cache  
of a PHP script will generally take less space than the script itself.  
So if you're worried about it simply get the total size of all the PHP  
scripts in your site and you'll see that even on modest hardware  
you'll have a lot of headroom. Obviously you need to take other users  
of the server into account, especially if you're on a shared hosting  
account, but in most cases you won't have a problem.


-Stut

--
http://stut.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] XCache, APC, Memcached... confused

2008-10-22 Thread Martin Zvarík

Thanks for reply Stut.

So, the APC, XCache etc. doesn't work as FileCache and also doesn't 
decrease the number of database queries, since it is not caching the 
content...


I see now, it is obvious that it would be very hard to run out of memory.

--
Martin



Stut napsal(a):

On 22 Oct 2008, at 22:19, Martin Zvarík wrote:
I became confused after an hour trying to understand the PHP cache 
solutions.


XCache, APC, eAccelerator and others are opcode cache systems... is 
memcache in the same category? or is it completely different?


Memcache is completely different in that it's not an opcode cache, 
it's an in-memory volatile cache for arbitrary key = value data with 
a client-server API.


If I install for example XCache, set it for certain directory... it 
will automatically cache the website into the memory. What happens if 
the memory will get full?



First of all you need to get it clear in your head what an opcode 
cache is actually doing. It does not cache the website, it caches 
the compiled version of the PHP scripts such that PHP doesn't need to 
recompile each file every time it's included which is the default way 
PHP works.


Secondly, if you run out of memory you buy more!! But seriously, you'd 
need a very very very big site to have this problem. An opcode cache 
of a PHP script will generally take less space than the script itself. 
So if you're worried about it simply get the total size of all the PHP 
scripts in your site and you'll see that even on modest hardware 
you'll have a lot of headroom. Obviously you need to take other users 
of the server into account, especially if you're on a shared hosting 
account, but in most cases you won't have a problem.


-Stut



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] XCache, APC, Memcached... confused

2008-10-22 Thread Martin Zvarík
I am looking at the eAccelerator's website and I realize what got me 
confused:


there is a function for OUTPUT CACHE, so it actually could cache the 
whole website and then run out of memory I guess...


that means I would be able to store anything into the memory and 
reference it by a variable? are the variables accessible across the 
whole server? I still don't really understand, but I am trying...




Stut napsal(a):

On 22 Oct 2008, at 22:19, Martin Zvarík wrote:
I became confused after an hour trying to understand the PHP cache 
solutions.


XCache, APC, eAccelerator and others are opcode cache systems... is 
memcache in the same category? or is it completely different?


Memcache is completely different in that it's not an opcode cache, it's 
an in-memory volatile cache for arbitrary key = value data with a 
client-server API.


If I install for example XCache, set it for certain directory... it 
will automatically cache the website into the memory. What happens if 
the memory will get full?



First of all you need to get it clear in your head what an opcode cache 
is actually doing. It does not cache the website, it caches the 
compiled version of the PHP scripts such that PHP doesn't need to 
recompile each file every time it's included which is the default way 
PHP works.


Secondly, if you run out of memory you buy more!! But seriously, you'd 
need a very very very big site to have this problem. An opcode cache of 
a PHP script will generally take less space than the script itself. So 
if you're worried about it simply get the total size of all the PHP 
scripts in your site and you'll see that even on modest hardware you'll 
have a lot of headroom. Obviously you need to take other users of the 
server into account, especially if you're on a shared hosting account, 
but in most cases you won't have a problem.


-Stut



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] XCache, APC, Memcached... confused

2008-10-22 Thread Stut

On 23 Oct 2008, at 00:04, Martin Zvarík wrote:
I am looking at the eAccelerator's website and I realize what got me  
confused:


there is a function for OUTPUT CACHE, so it actually could cache the  
whole website and then run out of memory I guess...


that means I would be able to store anything into the memory and  
reference it by a variable? are the variables accessible across the  
whole server? I still don't really understand, but I am trying...


Having never used eAccelerator I can only guess, but it sounds like  
it's a way to cache HTML output. As for how accessible that is I have  
no idea. I suggest you find the eAccelerator mailing list, subscribe  
to that and ask your question there.


-Stut

--
http://stut.net/


Stut napsal(a):

On 22 Oct 2008, at 22:19, Martin Zvarík wrote:
I became confused after an hour trying to understand the PHP cache  
solutions.


XCache, APC, eAccelerator and others are opcode cache systems...  
is memcache in the same category? or is it completely different?
Memcache is completely different in that it's not an opcode cache,  
it's an in-memory volatile cache for arbitrary key = value data  
with a client-server API.
If I install for example XCache, set it for certain directory...  
it will automatically cache the website into the memory. What  
happens if the memory will get full?
First of all you need to get it clear in your head what an opcode  
cache is actually doing. It does not cache the website, it caches  
the compiled version of the PHP scripts such that PHP doesn't need  
to recompile each file every time it's included which is the  
default way PHP works.
Secondly, if you run out of memory you buy more!! But seriously,  
you'd need a very very very big site to have this problem. An  
opcode cache of a PHP script will generally take less space than  
the script itself. So if you're worried about it simply get the  
total size of all the PHP scripts in your site and you'll see that  
even on modest hardware you'll have a lot of headroom. Obviously  
you need to take other users of the server into account, especially  
if you're on a shared hosting account, but in most cases you won't  
have a problem.

-Stut



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php