-
I wrote a sample WebFlux application, which read just some data from redis and do small cpu job(md5 calculation), repeats several time. It use spring data redis reactive
Codes that connects redis is like this.
redis server runs at localhost
Full codes , you can find it here https://github.com/mouse500/redperf It's a simple codes And for test, I call API (/wredis) with Jmeter to loadtest Problem that I think is... this application doesn't reach maximum TPS, It reaches CPU around 40% on my local PC. Even though it has more room of CPU, it doesn't work any harder Why doesn't it use resource fully? In case of some other method to connect redis, (I put connection proxy ,written in nodejs) It showed much much higher CPU and got much more TPS. So I don't think it is not about Redis server performance. Problem seems issue at "calling Redis from WebFlux application with lettuce" How can I make this sample application show a maximum TPS ( CPU reach 100%) ? What option can I try? |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 1 reply
-
This is a duplicate of #1292. Avoid high CPU workloads on I/O threads. |
Beta Was this translation helpful? Give feedback.
-
Thank you for your answer. Avoiding CPU workloads is not my test situation. Even though I put some CPU workload, it still has CPU room to work more. ( CPU level is not full, but just 40%) Or, |
Beta Was this translation helpful? Give feedback.
-
Avoiding cpu workload from I/O thread was a good clue to me But, What resource could be a bottleneck ? ( this sample prj is quite simple) |
Beta Was this translation helpful? Give feedback.
-
On a modern multi-core CPU, you won't see 100% usage when a single core is busy with CPU-bound workloads. The underlying issue is that when running CPU-heavy operations on I/O threads, then the threads are busy with your workload instead of communicating with Redis. A single connection is tied to a single I/O thread and a thread can do only one thing at a time. |
Beta Was this translation helpful? Give feedback.
-
Thank you very much for your valuable explanation. I think we have some confusion about CPU workload, What if I remove CPU workload? Experiment(, I just did) shows no change at TPS (with or without CPU workload) "On a modern multi-core CPU, you won't see 100%" => this cannot be reasonable, Computer Science need to show optimal performance if all other resource is enough, I think the lettuce need to show maximum performance at CPU 100%. For comparison, when I test similar situation with only http outer call(WebClient accessing some nodejs service and that service accessing Redis with node's redis lib) , It shows maximum performance, WebFlux with WebClient + nodesjs accessing Redis => shows maximum TPS and it touches CPU 100%. It seems there is some other bottleneck resource, I'm not sure as of now whether it is about lettuce thread or not. btw, at that point(while load test), its thread dump shows....
and the "lettuce-epollEventLoop-5-1" is like this....
Can it be some clue for investigating situation? |
Beta Was this translation helpful? Give feedback.
-
I'm back again. Still I'm curious about achieving CPU max utilzation, but "avoiding CPU load from I/O thread" has good performance gain even though it is not maximum expected. I'm quite happy with this valuable conversation. |
Beta Was this translation helpful? Give feedback.
This is a duplicate of #1292. Avoid high CPU workloads on I/O threads.