3 ms·
PHP needs an opcache because its standard behaviour is to discard all state after each request - including all compiled bytecode - kind of emulating the CGI mod
by Freaky 11y ago
PHP needs an opcache because its standard behaviour is to discard all state after each request - including all compiled bytecode - kind of emulating the CGI model.
Ruby web apps on the other hand tend to be run in a loop - the script never exits after a request, it just goes back to the top of the loop to accept the next request to serve.
e.g. https://github.com/rack/rack/blob/master/lib/rack/handler/fastcgi.rb#L27 https://github.com/rack/rack/blob/master/lib/rack/handler/fa...
FCGI.each { |request|
serve request, app
}
It's nice because it completely decouples your app's startup time from request processing time, so you can do expensive setup stuff up-front without slowing down each request. The disadvantage to that is there's not much pressure to keep startup time low, since it's only happening once.
- juliangregorian 11y agoYeah man, PHP makes scaling easy, it's shared nothing by default, do you even web scale bro? /s