Skip to content

Commit

Permalink
README
Browse files Browse the repository at this point in the history
Slightly more resilient stress test
  • Loading branch information
Nick Kallen committed Mar 8, 2011
1 parent 99d4c64 commit 4edf502
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
12 changes: 12 additions & 0 deletions finagle-example/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# How to run the examples:

From the command line:

% sbt "project finagle-example" run

If the example requires a command line parameter, do this:

% sbt "project finagle-example" "run p1 p2"

If you are running a server and a client, start the server in one terminal, then start the client in another.

Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,16 @@ object Stress {
.build()


val completedRequests = new AtomicInteger(0)

val requests = Future.parallel(concurrency) {
Future.times(totalRequests / concurrency) {
client(request) onSuccess { response =>
responses(response.getStatus).incrementAndGet()
} onFailure { f =>
} handle { case e =>
errors.incrementAndGet()
} ensure {
completedRequests.incrementAndGet()
}
}
}
Expand All @@ -58,8 +62,9 @@ object Stress {
println("%20s\t%d".format(status, stat.get))
}
println("================")
println("%d requests completed in %dms (%2f requests per second)".format(
totalRequests, duration.inMilliseconds, totalRequests.toFloat / duration.inSeconds))
println("%d requests completed in %dms (%f requests per second)".format(
completedRequests.get, duration.inMilliseconds, totalRequests.toFloat / duration.inMillis.toFloat * 1000))
println("%d errors".format(errors.get))
}
}

Expand Down

0 comments on commit 4edf502

Please sign in to comment.