Answer the question
In order to leave comments, you need to log in
PHP and high load. What is the limit?
Hello!
Tell me if it makes sense to use php for high-load projects, for example, for an online game with frequent updates of the states of the playing field, for example, like here: vk.com/app3144697 (players sit at the table and spin the bottle.)
And how would you describe the tasks, under which php for a high load came up and did not fit?
Thank you. I apologize for the amateurish description of the question))
Answer the question
In order to leave comments, you need to log in
for this, of course, it’s more convenient to take node.js + socket.io, but you can also use php (with reactphp). In terms of loads, it will take you more time to deliver data than to process it, so an efficient server is needed here. in node.js it is quite efficient out of the box, but in reactphp it is a little slower (although if you put libevent in addition, then it’s normal).
Load determination method:
- We determine the number of users online.
- Knowing the number of users online, we determine how many requests per second will be.
- Using xdebug, we measure the average execution time of scripts.
- Multiply the average script execution time by the number of requests per second.
- If the resulting time is within 2 seconds, then everything is fine. Otherwise, either not php, or optimization.
Regarding the choice of php:
- PHP is very well suited for high-load projects, if you minimize the work with external data (database and memcached).
php + nginx-push-stream-module is fine for your task.
PHP has problems with horizontal scaling, but they are also solved through optimization, connecting caches and various accelerators.
PHP is bad where you need to maintain a persistent connection, although there are enough tools that allow you to use PHP in this mode as well.
In your example, as far as I understood from a quick look, a permanent connection is not supported, and it is not particularly necessary for such functionality.
PHP is the most proven and up-to-date solution for heavy workload at the moment. Most of the major sites on the Internet are spinning on it. So your question about the limit is incomprehensible :)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question