1 year ago
#370794
MJey
Akka Http: How to handle high throughput through a proxy?
I would like to handle 3.000 requests per second via proxy usage.
The following code without proxy works without problems and can handle 3.000 requests per second with an average send-response time of ~50MS per request:
Http(context.system)
.singleRequest(request) // live without proxies -> speed boost by over 100%
.flatMap(_.toStrict(2.seconds)) // locally it might take longer than 2 seconds
.flatMap { resp =>
Unmarshal(resp.entity).to[String].map((resp.status, _))
}
But now I would like to archive the same but via Proxy usage:
val httpsProxyTransport = ClientTransport.httpsProxy(InetSocketAddress.createUnresolved("proxyip", 8888))
val settings: ConnectionPoolSettings = ConnectionPoolSettings(context.system)
.withTransport(httpsProxyTransport)
.withMaxRetries(0)
.withMaxConnectionBackoff(2.seconds)
Http(context.system)
.singleRequest(request, settings = settings)
.flatMap(_.toStrict(2.seconds))
.flatMap { resp =>
Unmarshal(resp.entity).to[String].map((resp.status, _))
}
Problem is that the proxy version:
- 1.000 requests / second -> average send-response time of ~50MS per request just like the solution without proxy
- 1.500 requests / second -> average send-response time of ~80MS per request
- 2.000 requests / second -> average send-response time of ~150MS per request
The proxy version gets worse in terms of average response time the more I try to send through. I doubt the problems lies on the end of the proxy, as I've also tried to use 3 different proxies at the same time to balance like 1.000 requests per proxy, but it showed the same increase in average response time.
Any ideas, what could under the hood limit the https proxy requests?
(It feels kind of as if the proxy version isn't using multiple cores in parallel.)
host-connection-pool {
max-connections = 650
max-retries = 0
max-open-requests = 1024
idle-timeout = 5 s
}
dispatcher-io {
type = Dispatcher
executor = "thread-pool-executor"
thread-pool-executor {
fixed-pool-size = 350
keep-alive-time = 60s
allow-core-timeout = on
}
shutdown-timeout = 60s
throughput = 1
}
scala
proxy
akka
akka-http
http-proxy
0 Answers
Your Answer