I am recently working on a simple HTTP server project using C++ and epoll facility running on Ubuntu in WSL2. Is this the right performance if I implement epoll facility correctly in this context? Or it is much lower than the expected performance, which means I did something wrong.
Here is my laptop specification: Processor 12th Gen Intel(R) Core(TM) i7-1255U Installed RAM 16.0 GB (15.7 GB usable) Edition Windows 11 Pro Version 23H2
I implement non-blocking sockets. There are ten working threads that read the request and write the response. I don't do any parse so far. So the server just sends a char array directly every time whatever it receives. There is also a main thread receiving events from epoll_wait and put events on a queue.
I test it by artillery running in WSL2 too on the same laptop. I close all other software. The test script is:
config:
target: http://127.0.0.1:8086
phases:
- duration: 1
arrivalRate: 10010
name: Sustained peak load
plugins:
apdex: {}
apdex:
threshold: 100
scenarios:
- flow:
- loop:
- get:
url: "/"
count: 40
The result is:
All VUs finished. Total time: 31 seconds
--------------------------------
Summary report @ 14:22:39(-0800)
--------------------------------
apdex.frustrated: .............................................................. 0
apdex.satisfied: ............................................................... 397875
apdex.tolerated: ............................................................... 2525
http.codes.200: ................................................................ 400400
http.downloaded_bytes: ......................................................... 86486400
http.request_rate: ............................................................. 14877/sec
http.requests: ................................................................. 400400
http.response_time:
min: ......................................................................... 0
max: ......................................................................... 300
mean: ........................................................................ 29.4
median: ...................................................................... 26.8
p95: ......................................................................... 48.9
p99: ......................................................................... 80.6
http.responses: ................................................................ 400400
vusers.completed: .............................................................. 10010
vusers.created: ................................................................ 10010
vusers.created_by_name.0: ...................................................... 10010
vusers.failed: ................................................................. 0
vusers.session_length:
min: ......................................................................... 175.2
max: ......................................................................... 2414.5
mean: ........................................................................ 1230.5
median: ...................................................................... 1176.4
p95: ......................................................................... 1720.2
p99: ......................................................................... 2101.1
Apdex score: 0.996846903096903 (excellent)
The code is long so it will take much time to read. But if it is necessary, I can put the code here.