Getting IP is slow
Hi, I'm UltimateExpress creator. I've decided to move this to a separate issue.
Here's a benchmark of UltimateExpress that returns "Hello world":
```
wrk http://localhost:13333/ -d 30 -t 1 -c 200
Running 30s test @ http://localhost:13333/
1 threads and 200 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 2.84ms 512.94us 26.13ms 94.46%
Req/Sec 70.91k 5.30k 83.20k 87.00%
2115784 requests in 30.01s, 415.66MB read
Requests/sec: 70504.66
Transfer/sec: 13.85MB
```
And here's same thing but with IP being read once using `getRemoteAddress()`:
```
wrk http://localhost:13333/ -d 30 -t 1 -c 200
Running 30s test @ http://localhost:13333/
1 threads and 200 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 3.40ms 488.65us 27.40ms 93.50%
Req/Sec 59.16k 3.65k 67.21k 88.00%
1765220 requests in 30.01s, 400.66MB read
Requests/sec: 58822.26
Transfer/sec: 13.35MB
```
Around 12k req/sec reduction.
And when using `getRemoteAddressAsText()`, it's even worse:
```
wrk http://localhost:13333/ -d 30 -t 1 -c 200
Running 30s test @ http://localhost:13333/
1 threads and 200 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 3.49ms 565.67us 23.14ms 93.83%
Req/Sec 57.65k 4.07k 66.79k 90.67%
1721099 requests in 30.02s, 359.46MB read
Requests/sec: 57336.60
Transfer/sec: 11.98MB
```
关闭于 2026-03-20 14 条评论