Now, it's time to discuss the performance of our server. We use an HTTP benchmarking tool such as wrk (https://github.com/wg/wrk) by Will Glozer to help us in our investigation. To avoid confusion, we will take the simplest version of our server, as follows:
import 'dart:io'; main() { HttpServer .bind(InternetAddress.ANY_IP_V4, 8080) .then((server) { server.listen((HttpRequest request) { // Response back to client request.response.write('Hello, world!'); request.response.close(); }); }); }
We use this code with a benchmarking tool and keep the 512 concurrent connections open for 30 seconds, as shown in the following code:
./wrk -t1 –c256 -d30s http://127.0.0.1:8080
Here is the result of the preceding code:
Running 30s test @ http://127.0.0.1:8080 1 threads and 256 connections Thread Stats Avg Stdev Max +/- Stdev Latency 33.89ms 24.51ms 931.37ms 99.76% Req/Sec 7.63k 835.29 9.77k 89.93% 225053 requests in...