How can I run multiple PHP threads through Ruby through PHP? (Yes, PHP->Ruby->PHP)
I have a site heavily developed in PHP, but due to a lack of support for threading, I've decided to use Ruby.
I'd like to know the fastest way to execute a Ruby script and pass some data from PHP, that will in turn execute multiple PHP scripts fr开发者_StackOverflow中文版om Ruby, and pass the results back to the original PHP script.
I'm quite sure this will never net you any gain over a standard multiprocess model like Apache mod_php, and ruby does not seem like the optimal language to try. What do you gain by running something in threads? Basically you share the code, keep it in memory, and then you can hopefully saturate multiple processors by keeping busy during io-wait etc. But it requires certain safety measures (thread-safety). So the first question is how can you keep a bunch of PHP code in memory to serve multiple processes? Honestly I don't know enough about PHP internals to know how that would be possible, but I guess Zend Cache is where I would start investigating.
精彩评论