[akka-user] Re: [akka-http 1.0-M2] Trying to add backpressure

2015-02-03 Thread Luis Ángel Vicente Sánchez
As usual... after asking a question, you find the answer yourself. The tool 
I'm using, was keeping the same connection alive; therefore all requests 
from that connection were handle by the same branch.

El martes, 3 de febrero de 2015, 19:57:04 (UTC), Luis Ángel Vicente Sánchez 
escribió:

 Dear hakkers,

 I have been trying to add back pressure to an akka-http application using 
 a transformation Stage and I have found something... unexpected. I have 
 created a SafetyStage that buffers up to a maximum number of elements:


 https://github.com/lvicentesanchez/random/blob/master/src/main/scala/io/github/lvicentesanchez/streams/stage/SafetyStage.scala

 I have also simulated a random failure with a simple random number 
 generator.

 Instead of handling akka-http connections using the method handleWith of 
 the ServerBinding object, I'm creating the following FlowGraph:


 https://github.com/lvicentesanchez/random/blob/master/src/main/scala/io/github/lvicentesanchez/Boot.scala#L56

 The connection Source is transformed using the SafetyStage. If the maximum 
 capacity, or a random error happens, a Left object is created; if not, a 
 Right object is created. A FlexiRoute sends the Left requests to a sink 
 that handles every failed/discarded connnection (it completes them with 
  503 error); Right requests go to a sink that handles them using an 
 akka-http router.

 In my tests, once one of the Sink handles the first IncomingConnnection, 
 all future connections are handled using the handler of that Sink. I.e. 
 if the random number generator decided that the first connection suffered 
 an error, all future connections would also be completed with a 503 error.

 I guess what I'm trying to do is fundamentally wrong, but I still don't 
 understand why the transformation stage is completely ignored once the 
 first connection is handled.

 Regards,

 Luis


-- 
  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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] Re: [akka-http 1.0-M2] Trying to add backpressure

2015-02-03 Thread Viktor Klang
The best kids of bugs are the non-bugs :)

On Tue, Feb 3, 2015 at 9:06 PM, Luis Ángel Vicente Sánchez 
langel.gro...@gmail.com wrote:

 As usual... after asking a question, you find the answer yourself. The
 tool I'm using, was keeping the same connection alive; therefore all
 requests from that connection were handle by the same branch.

 El martes, 3 de febrero de 2015, 19:57:04 (UTC), Luis Ángel Vicente
 Sánchez escribió:

 Dear hakkers,

 I have been trying to add back pressure to an akka-http application using
 a transformation Stage and I have found something... unexpected. I have
 created a SafetyStage that buffers up to a maximum number of elements:

 https://github.com/lvicentesanchez/random/blob/master/src/main/scala/io/
 github/lvicentesanchez/streams/stage/SafetyStage.scala

 I have also simulated a random failure with a simple random number
 generator.

 Instead of handling akka-http connections using the method handleWith of
 the ServerBinding object, I'm creating the following FlowGraph:

 https://github.com/lvicentesanchez/random/blob/master/src/main/scala/io/
 github/lvicentesanchez/Boot.scala#L56

 The connection Source is transformed using the SafetyStage. If the
 maximum capacity, or a random error happens, a Left object is created; if
 not, a Right object is created. A FlexiRoute sends the Left requests to a
 sink that handles every failed/discarded connnection (it completes them
 with  503 error); Right requests go to a sink that handles them using an
 akka-http router.

 In my tests, once one of the Sink handles the first IncomingConnnection,
 all future connections are handled using the handler of that Sink. I.e.
 if the random number generator decided that the first connection suffered
 an error, all future connections would also be completed with a 503 error.

 I guess what I'm trying to do is fundamentally wrong, but I still don't
 understand why the transformation stage is completely ignored once the
 first connection is handled.

 Regards,

 Luis

  --
  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 http://groups.google.com/group/akka-user.
 For more options, visit https://groups.google.com/d/optout.




-- 
Cheers,
√

-- 
  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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.


Re: [akka-user] Re: [akka-http 1.0-M2] Trying to add backpressure

2015-02-03 Thread Viktor Klang
The best typo as well.

s/kids/kinds

On Tue, Feb 3, 2015 at 9:16 PM, Viktor Klang viktor.kl...@gmail.com wrote:

 The best kids of bugs are the non-bugs :)

 On Tue, Feb 3, 2015 at 9:06 PM, Luis Ángel Vicente Sánchez 
 langel.gro...@gmail.com wrote:

 As usual... after asking a question, you find the answer yourself. The
 tool I'm using, was keeping the same connection alive; therefore all
 requests from that connection were handle by the same branch.

 El martes, 3 de febrero de 2015, 19:57:04 (UTC), Luis Ángel Vicente
 Sánchez escribió:

 Dear hakkers,

 I have been trying to add back pressure to an akka-http application
 using a transformation Stage and I have found something... unexpected. I
 have created a SafetyStage that buffers up to a maximum number of elements:

 https://github.com/lvicentesanchez/random/blob/master/src/main/scala/io/
 github/lvicentesanchez/streams/stage/SafetyStage.scala

 I have also simulated a random failure with a simple random number
 generator.

 Instead of handling akka-http connections using the method handleWith of
 the ServerBinding object, I'm creating the following FlowGraph:

 https://github.com/lvicentesanchez/random/blob/master/src/main/scala/io/
 github/lvicentesanchez/Boot.scala#L56

 The connection Source is transformed using the SafetyStage. If the
 maximum capacity, or a random error happens, a Left object is created; if
 not, a Right object is created. A FlexiRoute sends the Left requests to a
 sink that handles every failed/discarded connnection (it completes them
 with  503 error); Right requests go to a sink that handles them using an
 akka-http router.

 In my tests, once one of the Sink handles the first IncomingConnnection,
 all future connections are handled using the handler of that Sink. I.e.
 if the random number generator decided that the first connection suffered
 an error, all future connections would also be completed with a 503 error.

 I guess what I'm trying to do is fundamentally wrong, but I still don't
 understand why the transformation stage is completely ignored once the
 first connection is handled.

 Regards,

 Luis

  --
  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 http://groups.google.com/group/akka-user.
 For more options, visit https://groups.google.com/d/optout.




 --
 Cheers,
 √




-- 
Cheers,
√

-- 
  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 http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.