I want to write non-blocking applications. I use apache2, but I was reading about nginx and its advantage with respect to apache processes. I am considering changing out apache for nginx. My question is, is it possible to write non-blocking web applications with php and nginx?.
Or is a better idea to try and do this with python, using some reverse proxy like uwsgi or gunicorn with nginx? Or is the solution to learn nodejs?
Writing non blocking applications in php is possible, but it's probably not the best environment to do so, as it wasn't created keeping that in mind! You get a pretty decent control over your child processes using the process control library PCNTL but it obviously won't ever offer you same ease of use that other environments can give you!
I don't know python very well but personally I'd recommended you go with nodejs! It's a fairly new technology, that's true, but everything is non blocking there and it's meant to be that way! Basically what you have is a single thread (which you can extend however you want in this news versions) and literally everything (except you tell it to do differently) is going to be event-driven, leaving space to proceed on the process queue as expected!
Nodejs is really easy to learn, if you ever stumbled upon web applications, you know javascript anyways! it is still not hugely documented, but there are many ready to use modules you can download and use straight away!