dongxiane0395
2016-12-30 14:52
浏览 85
已采纳

每个用户都有ReactPHP http服务器,这个好主意吗?

ReactPHP http server for each user, Is this a good idea?

In my application:

  1. Each logged on user sends and receives data from server. In average one request per second.
  2. After server response, the server have some extra work to do, which is related to specific user.

I can simply build new ReactPHP http server for each user who logs, and release the server after the user log out.

Is this will work? Am i missing something ?

图片转代码服务由CSDN问答提供 功能建议

每个用户的ReactPHP http服务器,这是一个好主意吗?

在我的应用程序中:

  1. 每个登录的用户都会从服务器发送和接收数据。 平均每秒一个请求。
  2. 服务器响应后,服务器还有一些额外的工作要做,这与特定用户有关。

    我可以为每个登录用户构建新的ReactPHP http服务器,并在用户注销后释放服务器。

    这是否有效? 我错过了什么吗?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dsljpwi494719 2017-02-07 11:18
    已采纳

    No, it's not a good idea. You need a separate port per user in that case to route the user to the right server. That'd quickly exhaust your ports.

    If you have blocking tasks within the event loop and want to use multiple processes because of that, just stick to traditional PHP with mod_php or php-fpm and start a new event loop for each process, do your thing and then exit.

    If you don't have any blocking operations and everything is non-blocking, you can just use a single server and it handles all the things.

    点赞 评论

相关推荐 更多相似问题