Isolates

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 ...

Get Dart: Scalable Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.