I'm writing a network intensive WebFlux application. When receiving request, application requests and recieves something with another external server and then reply to original requester. I'm talking about the WebFlux application, and I'm using WebClient when call to external server.
Application's performance is not that satisfiable. I think it should touch the maximum of CPU resource, maximum TPS at maximum CPU. But it shows low tps, cpu is just at 30 or 40%. Why it does not use CPU any more to get more TPS, even though it has more room to execute more requests.
And I compared it with a task with no external call(WebClient), it shows full TPS at maximum of CPU resource usage.
====
Sample codes : https://github.com/mouse500/perfwebf
perfwebf sample project for WebClient performance
/workloadwexcall : workload using external call
/workloadwoexcall : workload using only cpu job(but with 1ms delay)
external call is implemented with simple node server inside prj includes everything.
You can build Dockerfile and run with docker
and prepare jmeter or something,
test1 : call /workloadwexcall api with more than 200 threads => shows 30~40% cpu level at perfwebf server
test2 : call /workloadwoexcall api with more than 200 threads => shows almost 100% cpu level at perfwebf server with m
======
Observation so far,
I ran test at AWS EC2 (8 core, 16 G Mem),
I think external server is enough simple and powerful to react
when test1,
high number of threads of the server waits at
{
"threadName": "reactor-http-epoll-3",
"threadId": 20,
"blockedTime": -1,
"blockedCount": 8,
"waitedTime": -1,
"waitedCount": 0,
"lockName": null,
"lockOwnerId": -1,
"lockOwnerName": null,
"inNative": true,
"suspended": false,
"threadState": "RUNNABLE",
"stackTrace": [
{
"methodName": "epollWait",
"fileName": "Native.java",
"lineNumber": -2,
"className": "io.netty.channel.epoll.Native",
"nativeMethod": true
},
{
"methodName": "epollWait",
"fileName": "Native.java",
"lineNumber": 148,
"className": "io.netty.channel.epoll.Native",
"nativeMethod": false
},
{
"methodName": "epollWait",
"fileName": "Native.java",
"lineNumber": 141,
"className": "io.netty.channel.epoll.Native",
"nativeMethod": false
},
{
"methodName": "epollWaitNoTimerChange",
"fileName": "EpollEventLoop.java",
"lineNumber": 290,
"className": "io.netty.channel.epoll.EpollEventLoop",
"nativeMethod": false
},
{
"methodName": "run",
"fileName": "EpollEventLoop.java",
"lineNumber": 347,
"className": "io.netty.channel.epoll.EpollEventLoop",
"nativeMethod": false
},
{
======
I have no idea,
netty epoll not meet hard situation?
docker net mechanism not meet? ( I also tested without docker, same result)
Linux kernel not meet hard situatin?
AWS EC2 has low performance of network bandwidth?
Question is, why it does not use CPU any more to get more TPS, even though it has more room to execute more requests.
Hope finding some solution for this...