Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix http benchmark. Wasn't correctly dispatching.

  • Loading branch information...
commit 65ec2d5db4901c45b028fbbf543d3a397076f368 1 parent abaab2c
@ry ry authored
Showing with 10 additions and 5 deletions.
  1. +10 −5 benchmark/static_http_server.js
View
15 benchmark/static_http_server.js
@@ -1,9 +1,11 @@
var concurrency = 30;
-var nrequests = 700;
var port = 8000;
-var completed_requests = 0;
+var n = 700;
var bytes = 1024*5;
+var requests = 0;
+var responses = 0;
+
var body = "";
for (var i = 0; i < bytes; i++) {
body += "C";
@@ -21,10 +23,12 @@ server.listen(port);
function responseListener (res) {
res.addListener("complete", function () {
- //puts("response " + completed_requests + " from client " + res.client.id);
- if (completed_requests++ < nrequests) {
+ if (requests < n) {
res.client.get("/").finish(responseListener);
- } else {
+ requests++;
+ }
+
+ if (++responses == n) {
server.close();
}
});
@@ -35,5 +39,6 @@ function onLoad () {
var client = node.http.createClient(port);
client.id = i;
client.get("/").finish(responseListener);
+ requests++;
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.