ReactPHP http server for each user, Is this a good idea?
In my application:
- Each logged on user sends and receives data from server. In average one request per second.
- 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 ?
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
orphp-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.