Akka绝对启用反压,您只是没有利用它。您可以使用单个
Flow发送所有请求,而不必调度多个单个请求。从文档中:
final Flow<HttpRequest, HttpResponse, Future<OutgoingConnection>> connectionFlow = Http.get(actorSystem).outgoingConnection("127.0.0.1", 8082);然后,您可以使用此Flow处理
HttpRequest对象:
HttpRequest httpRequest = HttpRequest.GET("/test")//imitates your for-loop example of 100 requestsSource.from(() -> Collections.nCopies(100, httpRequest).iterator()) .via(connectionFlow) .runForeach(...)


