-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Any suggestions for significant performance boost under high load? #14646
Comments
Thank you for your question. We advise you to use our community driven resources: If you are confident that there is a bug in the framework, feel free to provide information on how to reproduce it. This issue will be closed for now. This is an automated comment, triggered by adding the label |
PHP has to initialize everything on each request so 5000 rps sounds OK. phpdaemon and php-pm could be used with Yii but I can't say it's easy. |
@samdark I see. Well, then I'll just go with node/express for this project. |
I've linked to websocket ext. not because it's about websockets but because it uses PhpDaemon. |
What steps will reproduce the problem?
Writing a basic API ping action, like
with token-authentication filter behind it. MySQL and Redis involved in proccess, typical User model.
That doesn't really matter, everything is quite basic.
What is the expected result?
I want to be able to serve as much requests per second as possible. At least 10k rps.
What do you get instead?
I am getting closely to 5k rps.
If I'll try to increase the load, response times become slower and slower, giving me even less count of succesfully handled requests.
Additional info
It must be a REST API, so no assets factor. My machine is quite powerful with 16 CPU cores. I've spent a lot of time tunning configurations for nginx, PHP-FPM, MySQL and Redis. Also made some Linux kernel settings optimization. I've also read this tutorial:
enableSchemaCache
helped a LOT, really. Dumping composer autoload also helped. Opcache is enabled. I haven't had a chance to upgrade to php 7.1, I know that will give a slight performance boost, and I also know, that it won't help significantly. But I'll do it.Otherwise, I am pretty sure that everything is well-configured and optimized.
I've then built a Node.js/Express application with similar action and authentication step on each request. And I have to say, that node app was much-much faster, serving a lot more times of requests, almost out of the box, without any optimizations.
MySQL (after schema caching enabled) and Redis are definitely not the source of the problem - from the monitoring, I can see that they use a very small amount of resources under high load. I think that problem is framework bootstraping on every request. So I found this concept of using bootstraped daemons listening for new requests, like in
https://github.com/php-pm/php-pm
https://github.com/PHPFastCGI/FastCGIDaemon
But I am not sure if those libraries could be integrated easily with Yii2. I think they could really help. What do you guys think?
P.S. Sorry for posting a question here.
The text was updated successfully, but these errors were encountered: