Hi Leonti,

Akka Http Client uses connection pooling for the Request-Level Client API 
and the default number of connections to a single host is 4. My guess is 
that this results in the limitation you are experiencing. Try to increase 
the max-connections configuration parameter and see if that helps. For more 
details, have a look at the reference configuration 
<http://doc.akka.io/docs/akka/2.4.9/scala/http/configuration.html#akka-http-configuration>
 
in the documentation 
<http://doc.akka.io/docs/akka/2.4.9/scala/http/client-side/index.html#http-client-side>.
 
Hope this helps.

Kind regards,
Jan-Pieter

Op zaterdag 27 augustus 2016 20:01:39 UTC+2 schreef Leonti Bielski:
>
> Hi! I'm trying to load test my application using Akka Http client but 
> failing to execute more than 4 requests in parallel.
> The steps of the test:
> 1. Create a user
> 2. Authenticate the user
> 3. Prepare a request and create a sequence of it to execute in parallel.
>
> Here is the code of the function doing the upload:
>
>
> def upload() = {
>   val username = "ci_user_" + java.util.UUID.randomUUID()
>   val createUserRequest = CreateUserRequest(username, "password")
>
>   val toReceiptRequest: (MessageEntity, String, String) => HttpRequest = 
> (requestEntity, userId, accessToken) => {
>     HttpRequest(method = HttpMethods.POST,
>       uri = s"http://localhost:9000/user/${userId}/receipt";,
>       entity = requestEntity,
>       headers = List(Authorization(OAuth2BearerToken(accessToken))))
>   }
>
>   val uploadReceipt: (HttpRequest) => Future[StatusCode] = request => {
>     val start = System.currentTimeMillis()
>     println("Starting to upload receipt")
>
>     Http().singleRequest(request).map(response => {
>       println(response.status)
>       val end = System.currentTimeMillis()
>       println(s"Receipt uploaded in ${(end - start)}ms")
>       response.status
>     })
>   }
>
>   val requests: Future[Seq[HttpRequest]] = for {
>     userInfo: UserInfo <- createUser(createUserRequest)
>     accessToken: OAuth2AccessTokenResponse <- authenticateUser(userInfo)
>     requestEntity: MessageEntity <- createImageFileContent()
>   } yield Seq.fill(10)(toReceiptRequest(requestEntity, userInfo.id, 
> accessToken.accessToken))
>
>   val result: Future[Seq[StatusCode]] = requests.flatMap(requests => 
> Future.sequence(requests.map(request => uploadReceipt(request))))
>   result
> }
>
>
> I'm doing this at the top of the class, so I should have 200 threads 
> available:
>
> implicit val ec = ExecutionContext.fromExecutor(Executors.
> newFixedThreadPool(200))
>
>
>
> The full code is here if it might hold a clue:
> http://pastebin.com/iYsyu0En
>
> How can I make it execute requests in parallel?
>
> Thanks!
> Leonti
>

-- 
>>>>>>>>>>      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.

Reply via email to