Discussion:
[dart-misc] http performance issue?
Erik Grimes
2016-10-13 19:19:49 UTC
Permalink
Hello all,

I'm seeing some excessive http response times between a dart client and a
dart server (sdk 1.19.1), both on my mac (os x 10.11.6). Here's some rough
code where I get the problem.


var client = new http.Client();

Stopwatch sw = new Stopwatch();
sw.start();

var response = await client.get(Uri.parse("http://localhost:10080"));

sw.stop();

print('response received ${sw.elapsedMilliseconds}');
client.close();



var handler = (Request r){
return new Response.ok("hello");
} ;

var server = await serve(const Pipeline()
.addMiddleware(logRequests())
.addHandler(handler), InternetAddress.ANY_IP_V4, 10080);

print('Serving at http://${server.address.host}:${server.port}');


It takes about 5 seconds to get a response from the server using the above
code. The same client code retrieves google.com in less than a second.
Thoughts?

Thanks,

Erik
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Erik Grimes
2016-10-13 19:25:42 UTC
Permalink
Chrome takes about 4ms to get the response back.
Post by Erik Grimes
Hello all,
I'm seeing some excessive http response times between a dart client and a
dart server (sdk 1.19.1), both on my mac (os x 10.11.6). Here's some rough
code where I get the problem.
var client = new http.Client();
Stopwatch sw = new Stopwatch();
sw.start();
var response = await client.get(Uri.parse("http://localhost:10080"));
sw.stop();
print('response received ${sw.elapsedMilliseconds}');
client.close();
var handler = (Request r){
return new Response.ok("hello");
} ;
var server = await serve(const Pipeline()
.addMiddleware(logRequests())
.addHandler(handler), InternetAddress.ANY_IP_V4, 10080);
print('Serving at http://${server.address.host}:${server.port}');
It takes about 5 seconds to get a response from the server using the above
code. The same client code retrieves google.com in less than a second.
Thoughts?
Thanks,
Erik
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Erik Grimes
2016-10-14 15:45:16 UTC
Permalink
Switching from "localhost" to "127.0.0.1" in the request url got the
response time back to normal. Bug filed:
https://github.com/dart-lang/http/issues/44
Post by Erik Grimes
Chrome takes about 4ms to get the response back.
Post by Erik Grimes
Hello all,
I'm seeing some excessive http response times between a dart client and a
dart server (sdk 1.19.1), both on my mac (os x 10.11.6). Here's some rough
code where I get the problem.
var client = new http.Client();
Stopwatch sw = new Stopwatch();
sw.start();
var response = await client.get(Uri.parse("http://localhost:10080"));
sw.stop();
print('response received ${sw.elapsedMilliseconds}');
client.close();
var handler = (Request r){
return new Response.ok("hello");
} ;
var server = await serve(const Pipeline()
.addMiddleware(logRequests())
.addHandler(handler), InternetAddress.ANY_IP_V4, 10080);
print('Serving at http://${server.address.host}:${server.port}');
It takes about 5 seconds to get a response from the server using the
above code. The same client code retrieves google.com in less than a
second. Thoughts?
Thanks,
Erik
--
For other discussions, see https://groups.google.com/a/dartlang.org/

For HOWTO questions, visit http://stackoverflow.com/tags/dart

To file a bug report or feature request, go to http://www.dartbug.com/new
---
You received this message because you are subscribed to the Google Groups "Dart Misc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to misc+***@dartlang.org.
Loading...