A weird case with 190k req/sec and dropping with mysql query involved #722
Replies: 14 comments 4 replies
-
It is normal that the operation of the database will affect the system throughput. Because reading and writing the database is a time-consuming operation |
Beta Was this translation helpful? Give feedback.
-
Yes I did exactly that, and marked the sweet spot as 2x the available CPU cores. I'm not looking to optimize this, I'm looking at how to find the exact bottleneck and may be possibly apply an enhancement. Its saddening that the throughput decreases to less than %10 of what possible with the introduction of a single database query. So far, I believe its the network/db blocking IO is from the driver. I was also thinking about the possibility that |
Beta Was this translation helpful? Give feedback.
-
Using |
Beta Was this translation helpful? Give feedback.
-
Yes that would be interesting, especially, with how the PHP interpreter is getting blazing fast and lightweight more every day. I did an strace on all 4 workerman workers I have, while hitting with 1,000 concurrent requests for 10 seconds and here's what I got.
What could be my options? I want to squeeze more juice out of this before I give up 🤔 |
Beta Was this translation helpful? Give feedback.
-
Alright I'll have it tested. Not sure what will it do. I assume workerman's workers each have a single live connection with the database. What could Swoole's DB pool doing differently 🤔 !? |
Beta Was this translation helpful? Give feedback.
-
Okay, so I've gone through the swoole's mysql conn pool and its results are promising. So for now, assuming I have the following workerman code, how can I create a pool per each worker to use ?!
|
Beta Was this translation helpful? Give feedback.
-
Sorry, but do you think that a request with a database call will not affect the request time ?? |
Beta Was this translation helpful? Give feedback.
-
Swoole don't have a connection pool to the database. Like I said before in this repo, async or not async the time to receive data from the database is the same !!! |
Beta Was this translation helpful? Give feedback.
-
I have use amphp async mysql component with wind-framework, It's non-blocking, and have connection pool, got very good performance. |
Beta Was this translation helpful? Give feedback.
-
For what it's worth, I've tried Swoole's pdo pool and it's almost the same result. @xpader wind-framework is on my today's testing list on how to get out of this bottleneck situation. |
Beta Was this translation helpful? Give feedback.
-
If you use swoole, amp, ... async or not async, or any other language. When you call a database the req/s will drop drastically. Using the Thechempower benchmark data
And the same using Rust, Java, .... |
Beta Was this translation helpful? Give feedback.
-
So, it appears...
I read before here somewhere in the issues how people are wondering how Thanks @walkor for the PDOPool sample code. |
Beta Was this translation helpful? Give feedback.
-
It's normal this drop when using any TCP connection. And happen with any language. I think that you must read this comment #694 (comment) |
Beta Was this translation helpful? Give feedback.
-
Did you test with another mysql server, maybe it's mysql configuration issue, like max_connections, or other. |
Beta Was this translation helpful? Give feedback.
-
Hi @walkor
I'm halving this weird case where on my test machine I am getting around
~130k req/seq
when runningworkerman
plain simple, yet, once I add a single query to a MariaDB InnoDB table this drops down to~10k req/seq
.I am doing proper connection pooling and even tested with
webman
.The query is a simple select with a single where condition and its properly indexed, also the table got no more than 10,000 records.
The machine CPU/memory utilization very low.
I tried with normal driver,
libevent
,libev
and even tried the 5.0 tree as well as the stable one and still got the same results.I know this is not a
workerman
issue per se but I'd like your involvement in knowing the bottleneck here.I suspect the mysql driver but not sure.
Any ideas?
Beta Was this translation helpful? Give feedback.
All reactions