I tried the following POC to check how to get high concurrency
implicit def executionContext = context.system.dispatchers.lookup("async-futures-dispatcher") implicit val timeout = 10 seconds val contestroute = "/contestroute" { get { respondWithMediaType(`application/json`) { dynamic { onSuccess( Future { val start = System.currentTimeMillis()
My configuration:
async-futures-dispatcher {
however, when I run the apache scanner as follows:
ab -n 200 -c 50 http:
Results:
Server Software: Apache-Coyote/1.1 Server Port:erred: 37500 bytes HTML transferred: 10350 bytes Requests per second: 4.31 [#/sec] (mean) Time per request: 34776.278 [ms] (mean) Time per request: 231.842 [ms] (mean, across all concurrent requests) Transfer rate: 1.05 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 5 406 1021.3 7 3001 Processing: 30132 30466 390.8 30308 31231 Waiting: 30131 30464 391.8 30306 31231 Total: 30140 30872 998.9 30353 33228 8080 Document Path: /contestroute Document Length: 69 bytes Concurrency Level: 150 Time taken for tests: 34.776 seconds Complete requests: 150 Failed requests: 0 Write errors: 0 Non-2xx responses: 150 Total transferred: 37500 bytes HTML transferred: 10350 bytes Requests per second: 4.31 [#/sec] (mean) Time per request: 34776.278 [ms] (mean) Time per request: 231.842 [ms] (mean, across all concurrent requests) Transfer rate: 1.05 [Kbytes/sec] received Connection Times (ms) min mean[+/-sd] median max Connect: 5 406 1021.3 7 3001 Processing: 30132 30466 390.8 30308 31231 Waiting: 30131 30464 391.8 30306 31231 Total: 30140 30872 998.9 30353 33228
Did I miss something big? What do I need to change so that my spray and futures use all the streams associated with it?
(add that I am running on top of tomcat servlet 3.0)
scala akka spray
Jas
source share