Answer the question
In order to leave comments, you need to log in
Should I worry about scaling during development?
Often thinking about future workloads, I am visited by the thought of scaling my project. I use PHP WebSocket servers as daemons (I taught them to communicate with each other via Memcache), Memcache and MySQL, as well as file sessions.
What from this set can cause difficulties in the future when scaling horizontally and should I change something?
Answer the question
In order to leave comments, you need to log in
redis, it has a pub/sub interface so you can make daemons communicate through it, you can store sessions in it...
Then you should write load tests, and not philosophize about what else can be done just like that. In general, if you haven’t done kernel tuning, you will start having problems already at 1000 active users (by default, PHP cannot handle more than ~ 1024 file descriptors in stream_select, and the operating system by default limits the number of all file descriptors per process.
Horizontal scaling web socket servers is needed when we have the number of active users who simultaneously use the system comes closer to 10K or even more (load tests will show everything)
.What you are doing is called premature optimization.
At the very least, sessions on files don't scale very well, to put it mildly. It is also not clear how WebSockets servers communicate via Memcached, it would be more logical to use the same WebSockets to communicate with each other.
Just divide everything into separate servers and duplicate. Does it still work together as it should? So it's scalable.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question