These are good tips and to be honest I've considered them.  But it doesn't 
really answer my question -- why is back pressure not working in my 
example?  Do I need additional configuration?  Limit buffer size?  

On Saturday, December 12, 2015 at 7:17:20 PM UTC-5, matheus...@gmail.com 
wrote:
>
> Maybe better in this case you use plain actors to handle the requests. 
> Yout Flow becomes Flow[Message].mapAsyncUnorered(8)(actor ? _)
> In a heavy load some request will timeout, but this is better entire 
> service goes down. Another point is create multiple futures specifying the 
> paralllism factor (8, as in the above example), this helps to increase 
> throughput.
> I hope this tips help you.
>
> On Saturday, December 12, 2015 at 9:14:26 PM UTC-2, Bill Donn wrote:
>>
>> Its just an artificial, simple way to model a slow process for the 
>> benefit of this example.
>>
>> On Saturday, December 12, 2015 at 3:26:05 PM UTC-5, matheus...@gmail.com 
>> wrote:
>>>
>>> Why you are using Thread.sleep?
>>>
>>> On Saturday, December 12, 2015 at 5:33:16 PM UTC-2, Bill Donn wrote:
>>>>
>>>> I can't seem to get back pressure working on a web socket server.
>>>>
>>>> I'm using the example off the akka docs.
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>> *val requestHandler: HttpRequest ⇒ HttpResponse = {      case req @ 
>>>> HttpRequest(GET, Uri.Path("/greeter"), _, _, _) ⇒        
>>>> println(req.headers.mkString)        req.header[UpgradeToWebsocket] match 
>>>> {          case Some(upgrade) ⇒             upgrade.handleMessages(*
>>>>
>>>>
>>>>
>>>>
>>>> * Flow[Message].mapAsyncUnordered(1)(takeItSlow) )          case 
>>>> None          ⇒ HttpResponse(400, entity = "Not a valid websocket 
>>>> request!")        }      case _: HttpRequest ⇒ HttpResponse(400, entity = 
>>>> "Unknown resource!")    }*
>>>>
>>>> My flow handler is a simple and highly contrived future designed to 
>>>> consume  time:
>>>>
>>>>
>>>>
>>>>
>>>> *def takeItSlow(m : Message) : Future[Message] = {             case 
>>>> message  => Future(Thread.sleep(1000);  TextMessage(message))    }*
>>>>
>>>> I can call this just fine, and am able to create a web socket and send 
>>>> several thousand messages, and get back a smaller number (most - I guess - 
>>>> are sleeping) , but then it crashes from out of memory.  Clearly there is 
>>>> no back pressure.  What am I doing wrong?
>>>>
>>>>
>>>>
>>>>

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