I'm trying to benchmark akka http client before adding it to one of my
projects.
It's making a series of outbound HTTP requests through a MergeHub to a
SuperPool. And, I'd like to be able to max out my laptops CPU usage but for
some reason it never passes 1700 requests per second or 14% cpu usage. I've
tried both the PinnedDispatcher and the blocking dispatcher from the
blocking I/O docks without making much of a difference.
The average latency per request is around 150ms
1700 cant be the maximum. Is there something I'm missing?
```
# The maximum number of parallel connections that a connection pool to a
# single host endpoint is allowed to establish. Must be greater than zero.
max-connections = 1024
# The minimum number of parallel connections that a pool should keep alive
("hot").
# If the number of connections is falling below the given threshold, new ones
are being spawned.
# You can use this setting to build a hot pool of "always on" connections.
# Default is 0, meaning there might be no active connection at given moment.
# Keep in mind that `min-connections` should be smaller than `max-connections`
or equal
min-connections = 128
# The maximum number of times failed requests are attempted again,
# (if the request can be safely retried) before giving up and returning an
error.
# Set to zero to completely disable request retries.
max-retries = 1
# The maximum number of open requests accepted into the pool across all
# materializations of any of its client flows.
# Protects against (accidentally) overloading a single pool with too many
client flow materializations.
# Note that with N concurrent materializations the max number of open request
in the pool
# will never exceed N * max-connections * pipelining-limit.
# Must be a power of 2 and > 0!
max-open-requests = 1024
```
```
pinned-dispatcher {
executor = "thread-pool-executor"
type = PinnedDispatcher
}
```
```
blocking-request-dispatcher = {
# Dispatcher is the name of the event-based dispatcher
type = Dispatcher
# What kind of ExecutionService to use
executor = "thread-pool-executor"
# Configuration for the thread pool
thread-pool-executor {
fixed-pool-size = 1024
# minimum number of threads to cap factor-based core number to
core-pool-size-min = 1024
# No of core threads ... ceil(available processors * factor)
core-pool-size-factor = 2.0
# maximum number of threads to cap factor-based number to
core-pool-size-max = 1024
}
# Throughput defines the maximum number of messages to be
# processed per actor before the thread jumps to the next actor.
# Set to 1 for as fair as possible.
throughput = 100
}
```
```
val throttleRate: Int = 500
val totalRequest: Int = 10000
Future {
Source(1 to totalRequest)
.map(MockRequestFactory.buildRawRequest)
.throttle(throttleRate, 1 second, throttleRate, ThrottleMode.Shaping)
.runWith(requestQueue.sink)
}
Future {
Source(1 to totalRequest)
.map(MockRequestFactory.buildRawRequest)
.throttle(throttleRate, 1 second, throttleRate, ThrottleMode.Shaping)
.runWith(requestQueue.sink)
}
```
```
val sink: MediationReqSink =
MergeHub.source[MediationRequestQueue](perProducerBufferSize =* 1024*)
.map[MediationRequestQueue] { requestAndResponse =>
val timer = ddMonitor.getTimer(s"$metricName.responseTime")
requestAndResponse._2.future.onComplete(x => timer.stop)
requestAndResponse
}
.via(Http().superPool[Promise[MediationResponse]]())
.withAttributes(
ActorAttributes.supervisionStrategy(decider)
).toMat(Sink.foreach({
case (Success(res: HttpResponse), p: Promise[MediationResponse]) =>
ddMonitor.increment(s"$metricName.responseCount[status: success]")
p.complete(LogTry(deserialize(res))).future
case (Failure(err: Throwable), _) =>
ddMonitor.increment(s"$metricName.responseCount[status: failure]")
Future.failed(err)
}))(Keep.left).run
```
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.