-
Notifications
You must be signed in to change notification settings - Fork 1
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
Help wanted: very slow queries in production #1
Comments
Amphp mysql client single query can not be fast then PDO, because it's C implement, and amphp mysql is php implement. Even so, there is no obvious performance difference in a single query. Infact, in my actual use, in most cases it is faster than PDO. What is your php version, what linux distribution and version you used, how did you install your php (apt, docker, or complie from source yourself), what event loop extension you used (event, ev, uv, or native php select)? |
Hey thanks for the quick reply! I'm using a custom Docker image I built from the official I'm aware of the performance difference but except from connecting (which is taking 10s) I did find Amp Mysql reasonably fast, as you said faster than PDO when running concurrent queries. Sync queries are taking 20% to 30% more time than PDO in my tests with Doctrine DBAL using Amp Mysql DBAL. My performance issues starts when I use this with Eloquent, each connection does takes 10s to connect but the queries take a long time to run, some take 3 times more than PDO some almost 2 minutes. Which is really weird because de difference to Amp MySQL with Doctrine ORM to Eloquent is really big. I will have to start digging tomorrow so if you have some tips it would save me much time. I hope I can make a PR if I ever find out any issues. |
Why did your query used seconds? In my tests, even through an external network connection, the response was only milliseconds. And 10s is unacceptable. How long do your connections and queries take when using PDO? |
I have test in php:8.3 with native PHP select docker image, it's pretty fast. But I found that amphp mysql can not reuse 1 connection in the first two queries at the beginnin. In most times, it create two connections at least. After two connections created, and reused connection query, the difference between a single query and PDO at most is only about 10 milliseconds. Keep trying to dig.. |
With PDO they connect in milliseconds too. It takes more than I'd like because Digital Ocean's App Platform requires me to route my database connections through outside the VPC, meaning backend server (client) and database server connections are routed through the internet. But still, even if connection takes 10 seconds the queries using Amp without Eloquent are really fast too, taking milliseconds as well, it is only when using Amp through Eloquent we notice slowness. |
Uhmm got it, I'll try inspecting the connections and the pool as well. I believe you tested it locally and I must say, locally this thing is blazing fast, it is crazy how it behaves differently in a different server even though it is the same Docker image. |
I test on my local computer connect to cloud server, pretty fast. Can you show the simplified code you're having trouble with? |
I didn't use react adapter and DBAL. This my composer info:
|
Hello! First thanks for this library, it is really useful. After a few changes I was able to configure this in my project and it works really well locally.
When I deployed this to production my queries became slower than they were, and I mean a lot slower. I know Amp implementation is slower than PDO's but I do have a comparison to this Eloquent adapter using Doctrine and it runs almost at the same speed it runs with PDO, meaning Amp implementation is not the issue, but this conector/adapter.
I'd like to have some ideas or tips on how can I debug the bad performance of my application when using this library.
Thanks in advance!
The text was updated successfully, but these errors were encountered: