I am writing an an Akka Http service (v2.4.2) service for talking to a cassandra instance. Running the service on my laptop, it appears not to scale with the number of simultaneous connections.
~/workspace/wrk $ ./wrk -t8 -c32 -d30s -s random-object.lua http://localhost:8080/buckets/newbucket
Running 30s test @ http://localhost:8080/buckets/newbucket
8 threads and 32 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 14.23ms 29.40ms 304.93ms 91.78%
Req/Sec 703.35 226.18 1.31k 75.40%
165252 requests in 30.03s, 27.74MB read
Requests/sec: 5503.64
Transfer/sec: 0.92MB
~/workspace/wrk $ ./wrk -t8 -c64 -d30s -s random-object.lua http://localhost:8080/buckets/newbucket
Running 30s test @ http://localhost:8080/buckets/newbucket
8 threads and 64 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 20.66ms 37.87ms 676.67ms 90.45%
Req/Sec 0.86k 288.76 2.09k 72.99%
199623 requests in 30.09s, 33.51MB read
Requests/sec: 6633.58
Transfer/sec: 1.11MB
~/workspace/wrk $ ./wrk -t8 -c128 -d30s -s random-object.lua http://localhost:8080/buckets/newbucket
Running 30s test @ http://localhost:8080/buckets/newbucket
8 threads and 128 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 27.52ms 35.14ms 506.00ms 88.56%
Req/Sec 0.87k 275.83 2.36k 72.13%
207498 requests in 30.08s, 34.83MB read
Socket errors: connect 0, read 96, write 2, timeout 0
Requests/sec: 6897.64
Transfer/sec: 1.16MB
Actually just noticed the socket errors once I break 64 connections. All Akka configs are default. If I look at the stats in visual VM, akka creates a bunch of new dispatchers to handle the load, but 90% of cpu time is spent here in akka code (it appears):
"metadata-service-akka.actor.default-dispatcher-62" #101 prio=5 os_prio=31 tid=0x00007fc261a7f800 nid=0xa503 waiting on condition [0x0000700003f50000]
java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)
- parking to wait for <0x00000006c0098818> (a akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinPool)
at scala.concurrent.forkjoin.ForkJoinPool.scan(ForkJoinPool.java:2075)
at scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
at scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
Locked ownable synchronizers:
- None