Welcome! Log In Create A New Profile

Advanced

Re: Can anyone *really* explain opcode caching with PHP?

Volodymyr Kostyrko
March 07, 2012 04:16AM
gcaplan wrote:
> Hi folks
>
> Thinking of abandoning mod_php for the wonderful world of nginx, but
> googling the issue of opcode caching with fastcgi is proving
> surprisingly confusing: there's a lot of conflicting information out
> there.
>
> My basic question is this: what is the most performant,
> memory-efficient, Slashdot resistant way to set up nginx for running a
> complex PHP app?
>
> More specifically:
>
> 1) Why cache? I understood that a fastcgi process compiles the app into
> memory, and serves it from there till it's recycled after max_requests.
> So what's the value of opcode caching? To speed up one request in 500?
> But I've seen benchmarks that claim an opcode cache with nginx offers
> 50% savings on memory and response time. Where would these savings be
> coming from? No one explains...

As far as I know you are wrong here. FastCGI is just another way of
running apps by making core process up, running and fully initialized.
Everything this process runs is still subject to opcode caching.

> 2) What cache? Nginx/PHP setup tutorials either omit opcode caching or
> recommend xcache, without explaining why. There's a lot of conflicting
> information about whether each process needs its own cache (very memory
> intensive?) or whether processes can share a cache. Some bloggers claim
> that Xcache handles this better than APC, but again, no one explains how
> or why. Can anyone offer an authoritative answer to this?

I don't like xcache much but for opcode caching it's my favorite choice:

1. Doesn't relies on IPC or file handlers by default. I seen
installations with APC where caching was done to disk due to extreme
size of files and that ruined whole caching thing. I also witnessed at
least one time APC deadlock due to process crash and other processes
stalling on IPC. IPC is very tricky thing, once you are in you should
measure every step. I really don't know how postgres works with IPC but
they are doing it well. I hadn't seen another app which can work with
IPC without messing things.

2. Security. By default if I set up two different php-fpm pools they
wouldn't share any cached code nor give access to any other. And I don't
need to write a single line in config about that.

3. Faster.

> So is opcode caching effective with fastcgi? If so, how does it work,
> and what setup plays best with nginx? I would be more than grateful if
> anyone can make sense of this. Also, can I please suggest this as a
> candidate for the nginx FAQs? Judging by what I've been reading, I'm not
> the only one who'se confused by this...

Maybe you can look on uWSGI also? That one is better by desing then FastCGI.

--
Sphinx of black quartz judge my vow.

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Can anyone *really* explain opcode caching with PHP?

gcaplan March 06, 2012 10:13PM

Re: Can anyone *really* explain opcode caching with PHP?

Volodymyr Kostyrko March 07, 2012 04:16AM

Re: Can anyone *really* explain opcode caching with PHP?

gcaplan March 07, 2012 05:10AM

Re: Can anyone *really* explain opcode caching with PHP?

gcaplan March 07, 2012 05:16AM

Re: Can anyone *really* explain opcode caching with PHP?

roberto March 07, 2012 05:32AM

Re: Can anyone *really* explain opcode caching with PHP?

roberto March 07, 2012 05:34AM

Re: Can anyone *really* explain opcode caching with PHP?

Volodymyr Kostyrko March 07, 2012 07:52AM

Re: Can anyone *really* explain opcode caching with PHP?

gcaplan March 07, 2012 09:13AM

Re: Can anyone *really* explain opcode caching with PHP?

roberto March 07, 2012 04:48AM

Re: Can anyone *really* explain opcode caching with PHP?

Rainer Duffner March 07, 2012 05:12AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 68
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready