Long Polling Options: Nginx, PHP, Node.js

前端 未结 2 2099
一整个雨季
一整个雨季 2021-02-09 01:17

I\'m designing a long-polling app to broadcast small changes very rapidly to, possibly, a large number of users. The app will run in tandem with a website running a fairly stand

2条回答
  •  南旧
    南旧 (楼主)
    2021-02-09 02:09

    I would use option C: and would suggest an option D:

    option D:

    • Keepalived with HAProxy for load balancing (LB)
    • Nginx for static and PHP scripts, using PHP-FPM, APC and Redis for caching
    • Node.js (and other Node modules) for dynamic, realtime content

    We currently use the first 2 parts of option D, coming from a LAMP background, and are currently implementing Node.js to serve some of our (system taxing) realtime apps. HAProxy does exactly that: proxies the traffic to all my backend servers, instead of having Nginx doing it. Reason for that, we have many backend HTTP/TCP/other servers and we require redundant and automatic failover to these servers. LB is simple to implement and works well.

    So far, excellent results. Personally, the Nodes learning curve has so far has been difficult due to lack of documentation, but there is a very dynamic community out there.

    Hope this helps.

提交回复
热议问题