thanks for your reply ~
i changed my code like this , it works well when i set the `max-connections 
= 10`

```

(1 to 500).foreach{idx=>
  val futureResponse = 
Source.single(httpRequest->1).via(poolFlow).runWith(Sink.head).map(_._1).flatMap(Future.fromTry)
  futureResponse.andThen{
    case Success(response) =>
      *response.entity.dataBytes.runWith(Sink.ignore)*
      println(s"${atomicLong.incrementAndGet()} -> 
${Thread.currentThread().getName} ")
    case Failure(e) =>
      e.printStackTrace()
      println(s"error ${e.getMessage}")
  }

```

but when i enlarge the `max-connections = 100` ,  the errors occured again, 
only 2/3 of the request was excuted ~

the debug exception info as belows:

```
[DEBUG] [07/22/2016 10:21:31.279] 
[httpClient-akka.actor.default-dispatcher-15] 
[akka://httpClient/user/SlotProcessor-53] Slot 53 disconnected after 
java.util.concurrent.TimeoutException: No elements passed in the last 1 
minute.
[DEBUG] [07/22/2016 10:21:31.279] 
[httpClient-akka.actor.default-dispatcher-7] 
[akka://httpClient/user/StreamSupervisor-0/flow-78-0-unknown-operation] 
Aborting tcp connection because of upstream failure: No elements passed in 
the last 1 minute.
akka.stream.impl.Timers$IdleTimeoutBidi$$anon$7.onTimer(Timers.scala:160)
akka.stream.stage.TimerGraphStageLogic.akka$stream$stage$TimerGraphStageLogic$$onInternalTimer(GraphStage.scala:1125)
akka.stream.stage.TimerGraphStageLogic$$anonfun$akka$stream$stage$TimerGraphStageLogic$$getTimerAsyncCallback$1.apply(GraphStage.scala:1114)
akka.stream.stage.TimerGraphStageLogic$$anonfun$akka$stream$stage$TimerGraphStageLogic$$getTimerAsyncCallback$1.apply(GraphStage.scala:1114)
akka.stream.impl.fusing.GraphInterpreter.runAsyncInput(GraphInterpreter.scala:572)
akka.stream.impl.fusing.GraphInterpreterShell.receive(ActorGraphInterpreter.scala:419)
akka.stream.impl.fusing.ActorGraphInterpreter.akka$stream$impl$fusing$ActorGraphInterpreter$$processEvent(ActorGraphInterpreter.scala:603)
akka.stream.impl.fusing.ActorGraphInterpreter$$anonfun$receive$1.applyOrElse(ActorGraphInterpreter.scala:618)
akka.actor.Actor$class.aroundReceive(Actor.scala:484)
akka.stream.impl.fusing.ActorGraphInterpreter.aroundReceive(ActorGraphInterpreter.scala:529)
akka.actor.ActorCell.receiveMessage(ActorCell.scala:526)
akka.actor.ActorCell.invoke(ActorCell.scala:495)
akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257)
akka.dispatch.Mailbox.run(Mailbox.scala:224)
akka.dispatch.Mailbox.exec(Mailbox.scala:234)
scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
```

Another info to be mentioned , as begining,everything works well as 
expected, 100 request was excuted at once . 
but after that ,  the output is more and more slower, the following diagram 
show that the threads was blocked ~
i want to know what cause this ~

thanks again ~


<https://lh3.googleusercontent.com/-tMXx2XzJVt0/V5GGzv57ulI/AAAAAAAAAAM/SukXkeX2TfUev3A1V1Pf2E5uzH0T1TBAQCLcB/s1600/00D8E1B4-9A83-48EA-A883-180BB91533EE.png>


在 2016年7月21日星期四 UTC+8下午4:10:58,Konrad Malawski写道:
>
> You're not using the data you've requested, thus stalling the connections. 
> This is by design. Akka HTTP is a *streaming* HTTP Client.
>
> Please read the docs about this: 
> http://doc.akka.io/docs/akka/2.4/scala/http/implications-of-streaming-http-entity.html
>
>
> -- 
> Konrad `ktoso` Malawski
> Akka <http://akka.io> @ Lightbend <http://lightbend.com>
>
> On 21 July 2016 at 10:09:56, lz...@vip.qq.com <javascript:> (
> lz...@vip.qq.com <javascript:>) wrote:
>
>
> *When I use the pool-client to issue some requests, *
>
> *the program seems only execute only 10 times ,just the value of 
> `max-connections` ,*
>
> *the remaining 90 requests didn't execute at all;*
>
> *And after a while, *
>
> *the connection in the connection pool are closed ,no more connection alive ~*
>
>
> *i don't know what happended, thansk for your help ~*
>
>
>
> ```the scala code ~
>
> val poolFlow = Http().newHostConnectionPool[Int]("www.baidu.com")
>
> (1 to 100).foreach{idx=>
>   val futureResponse = 
> Source.single(httpRequest->1).via(poolFlow).runWith(Sink.head).map(_._1).flatMap(Future.fromTry)
>   futureResponse.andThen{
>     case Success(_) =>
>       println(s"${atomicLong.incrementAndGet()} -> 
> ${Thread.currentThread().getName} ")
>     case Failure(e) =>
>       e.printStackTrace()
>       println(s"error ${e.getMessage}")
>   }
>
> }
>
> ```
>
>
> the application.conf
>
> ```
>
> http {
>   host-connection-pool {
>     max-connections = 10
>     min-connections = 10
>     max-retries = 0
>     max-open-requests = 1048576
>   }
> }
>
> ```
>
>
> --------
>
> the output :
>
> ```
>
> after pool ~
> after execute !
> 1 -> httpClient-akka.actor.default-dispatcher-2  
> 4 -> httpClient-akka.actor.default-dispatcher-19  
> 5 -> httpClient-akka.actor.default-dispatcher-12  
> 2 -> httpClient-akka.actor.default-dispatcher-13  
> 6 -> httpClient-akka.actor.default-dispatcher-10  
> 3 -> httpClient-akka.actor.default-dispatcher-8  
> 7 -> httpClient-akka.actor.default-dispatcher-13  
> 8 -> httpClient-akka.actor.default-dispatcher-4  
> 9 -> httpClient-akka.actor.default-dispatcher-4  
> 10 -> httpClient-akka.actor.default-dispatcher-15
>
> ```
>
>
> --
> >>>>>>>>>> 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 akka-user+...@googlegroups.com <javascript:>.
> To post to this group, send email to akka...@googlegroups.com 
> <javascript:>.
> Visit this group at https://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>
>

-- 
>>>>>>>>>>      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 akka-user+unsubscr...@googlegroups.com.
To post to this group, send email to akka-user@googlegroups.com.
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