I’m creating a simple chat app. Have installed nginx on Ubuntu 11.10, with PHP via fast-cgi. To get a feel for performance, I made a simple PHP file that sleeps 10 seconds then reports the time. Calling this with several browser instances (different browsers, different machines) the response becomes sluggish after about 10 instances, a lot less than expected (was hoping to not see any deterioration until the hundreds, though that would not be practical using manual browser testing).
I’m a web-dev, not sys-admin, maybe out of my depth? Not looking for optimal solution (searching reveals nginx should be able to handle 10k per core), but a few hundred would be great.
There’s also the Nginx Push Stream Module, but I can’t figure out how to install it, and seems yet another technology to get to grips with. Should basic out of the box nginx be able to cope with my expectations, i.e. 100+ long-term connections using PHP?
The push stream module will technically do what you want it to do — set up a url in which you can push updates to that in turn can be polled by a pubsub in your client side code.
In order to install the push stream module, you need to get the latest source of nginx, get the source for that module, compile that, then recompile your nginx with the path to the new module source as one of the flags. See how i did that, here:
Recompiling nginx after using apt-get install nginx
If the restart of your nginx server does not list that module in the listed flags for the current instance, then you didn’t properly overwrite the nginx files during recompile. Make sure you include the
--sbin-pathflag to ensure overwriting to the correct directory.Once you’ve confirmed that it is in fact installed and running in nginx, then follow the steps provided by @baba