[akka-user] Some questions about ConsistentHashingPool and PinnedDispatcher

2017-12-28 Thread Leon Ma
Hi, I have some general questions regarding ConsistentHashingPool and PinnedDispatcher 1. If my message (request id based) processing logic is CPU intensive. Will ConsistentHashingPool have better performance/throughput than 1 single actor? (considering multiple core CPU ) 2. Will

Re: [akka-user] [akka-http] How many stream/graph instances will be materialized when binding to Http?

2015-11-26 Thread Leon Ma
ot as fast yet as it can be. > Luckily, this is exactly what we are working on, as 2.0 will allow fusing > graphs into one actor instead of N. > > -Endre > > On Thu, Nov 26, 2015 at 8:18 AM, Leon Ma <tutu...@gmail.com > > wrote: > >> Just worry about the cost of th

Re: [akka-user] [Akka-stream] question about building graph

2015-11-26 Thread Leon Ma
Ah, got it! Thanks a lot for the explanation! Leon 在 2015年11月26日星期四 UTC-8上午1:23:04,Akka Team写道: > > > > On Thu, Nov 26, 2015 at 8:30 AM, Leon Ma <tutu...@gmail.com > > wrote: > >> I don't quite catch the word "inline" >> > > I answered to y

Re: [akka-user] [Akka-stream] Will Broadcast + merge keep the message order?

2015-11-26 Thread Leon Ma
; Hi Leon, > > On Thu, Nov 26, 2015 at 8:51 AM, Leon Ma <tutu...@gmail.com > > wrote: > >> Let me make it a little complex: >> >> Assuming I have a source, for each element A of the source: >> >> if(A.property1 == 1) goes to flow1 + flow2 + flow3 >&g

Re: [akka-user] [Akka-stream] Will Broadcast + merge keep the message order?

2015-11-25 Thread Leon Ma
o someStuff > else do otherStuff > } > > The question that you need to ask yourself is exactly the same as with > actors: "do I need a separate actor for this (to exploit parallelism, or > for isolation) or I can execute this as part of this actor?" > >

Re: [akka-user] [akka-http] How many stream/graph instances will be materialized when binding to Http?

2015-11-25 Thread Leon Ma
Leon 在 2015年11月25日星期三 UTC-8上午2:41:39,Akka Team写道: > > Ok, then the answer is that one stream will be materialized for each > incoming connection sharing the lifecycle of the connection. > > Why does this matter btw? > > -Endre > > On Wed, Nov 25, 2015 at 9:02 AM,

Re: [akka-user] [Akka-stream] question about building graph

2015-11-25 Thread Leon Ma
d try to use it inline? > > -Endre > > On Wed, Nov 25, 2015 at 10:09 AM, Leon Ma <tutu...@gmail.com > > wrote: > >> Hi, >> >> I have some questions regarding below code: >> >> val myFlow: Flow[A, B, Any] = >> Flow.fromGraph(FlowGraph

[akka-user] [Akka-stream] Will Broadcast + merge keep the message order?

2015-11-25 Thread Leon Ma
Hi, I have below stream: broadcast ~> filter1 ~> flowA ~> flowB ~> merge broadcast ~> filter2 ~> flowC ~> merge Assuming filter1 and filter2 are exclusive, which means my input element will either go upper flow or go down flow. How can I guarantee the order? Say I have a source of X, Y,

[akka-user] [Akka-stream] question about building graph

2015-11-25 Thread Leon Ma
Hi, I have some questions regarding below code: val myFlow: Flow[A, B, Any] = Flow.fromGraph(FlowGraph.create() { implicit b => import akka.stream.scaladsl.FlowGraph.Implicits._ val broadcast = b.add(Broadcast[A](2)) val merge = b.add(Merge[B](2)) val flow1 =

Re: [akka-user] [akka-http] How many stream/graph instances will be materialized when binding to Http?

2015-11-25 Thread Leon Ma
Hi, Endre The code snippet is copied from akka.http.scaladsl.Http.scala 在 2015年11月24日星期二 UTC-8上午6:14:30,Akka Team写道: > > Hi Leon, > > On Tue, Nov 24, 2015 at 2:38 PM, Leon Ma <tutu...@gmail.com > > wrote: > >> Hi, >> >> Checking below code

[akka-user] [akka-stream] How to monitor metrics of a running stream

2015-11-24 Thread Leon Ma
Hi. Is there any way I can inspect metrics of a running stream with something like a stream monitor. For example, I'd like to see average processing time for each element of each stage, or the average/max buffered element count for each stage. Those statistics might help me to improve the

[akka-user] [akka-http] How many stream/graph instances will be materialized when binding to Http?

2015-11-24 Thread Leon Ma
Hi, Checking below code: bind(interface, port, settings, httpsContext, log) .mapAsyncUnordered(settings.maxConnections) { connection ⇒ handleOneConnection(connection).recoverWith { // Ignore incoming errors from the connection as they will cancel the binding.

[akka-user] [akka-stream] Is there any way I can do "conditional" Balance

2015-11-20 Thread Leon Ma
Hi, I'd like to apply different sub flows against attributes of input elements. For example, for my source of HttpRequest: if (contains HttpHeader A) then go thru flowA if (contains HttpHeader B) then go thru flowB else go thru flowC I got some ideas from thread:

[akka-user] [akka-stream] How does akka-stream handle source with single element?

2015-11-19 Thread Leon Ma
Hi, Assuming I do this: Source.single(A).via(flow1).via(flow2) via(flowN).toSink(Sink.head) How does the ActorMmaterializer implement this internally ? Will it create 1 actor per flow (N actors) and only process 1 element for each actor? Thanks Leon -- >> Read the

Re: [akka-user] [akka-stream] Parallel flow merge

2015-11-19 Thread Leon Ma
t; i.e. you broadcast A, then you calculate B and C in parallel, then you > wait on both (ZipWith) to calculate D. > > -Endre > > On Thu, Nov 19, 2015 at 7:34 AM, Leon Ma <tutu...@gmail.com > > wrote: > >> Hi, >> >> Assuming I have a Source A which co

Re: [akka-user] [akka-stream] How does akka-stream handle source with single element?

2015-11-19 Thread Leon Ma
ntrol where you > want your actor boundaries, declaratively. I.e. you will be able to run > your N-length flow in one actor if that is what you need. > > -Endre > > > On Thu, Nov 19, 2015 at 10:48 AM, Leon Ma <tutu...@gmail.com > > wrote: > >> Hi, >> &g

Re: [akka-user] [akka-stream] how to control the throughput of a certain flow

2015-11-18 Thread Leon Ma
. > Regards, > Patrik > > On Wed, Nov 11, 2015 at 4:13 AM, Leon Ma <tutu...@gmail.com > > wrote: > >> Hi, >> >> Assuming I have below flows: >> >> Source(..).via(flow1).via(flow2).via(flow3).to(...) >> >> >> questions: >> 1.

[akka-user] [akka-stream] Parallel flow merge

2015-11-18 Thread Leon Ma
Hi, Assuming I have a Source A which contains elements A1, A2 And I'd like to build flow like this: 1. A1 --> B1, A1 --> C1 For an element A1 , I can call some services (time consuming) to transform it into B1 and C1 respectively, and they're independent transformation which can run

[akka-user] [akka-stream] some questions about error handling

2015-11-10 Thread Leon Ma
Hi, Assuming I have below flow: Source(..).via(flow1).via(flow2).via(flow3)...via(flowN).toSink(..) I'd like to model the stream that any exception happens will lead the elements go to the very last flowN. (like a guardian fanalizer) For example, when processing elementA in flow2, we got

[akka-user] [akka-stream] how to control the throughput of a certain flow

2015-11-10 Thread Leon Ma
Hi, Assuming I have below flows: Source(..).via(flow1).via(flow2).via(flow3).to(...) questions: 1. how many actors will be created when run this flow? 1 actor for 1 flow? 2. if I found that flow2 is slower than others (bottle neck), Can I enlarge capacity for it? for example, use some router

[akka-user] [Akka-http] using akka-stream to process request

2015-10-27 Thread Leon Ma
Hi, I'd like to process the http request with a bunch of flows like this: val bindingFuture = Http().bindAndHandleAsync({ request => Source.single(request) .via(flow1) .via(flow2) .via(flowN) .runWith(Sink.head) }, interface =

[akka-user] Re: [Akka-stream] How to do flow shortcut

2015-09-02 Thread Leon Ma
Thanks a lot! It's really helpful! Leon 在 2015年9月1日星期二 UTC-7上午11:54:48,Lance Arlaus写道: > > Leon- > > There's a couple of ways to solve this, but one simple solution is to use > a combination of Broadcast, filter, and Merge. > 1. Broadcast the elements to two branches and filter each branch.

[akka-user] [Akka-http] How to create a chunked Response with Source backed by an actor

2015-08-31 Thread Leon Ma
Hi, I have below Actor which can return a chunked response: class DemoActor extends Actor { override def receive: Receive = { case req: HttpRequest => val source = Source(List(Chunk("Hello"), Chunk("World"), LastChunk)) sender() ! HttpResponse(entity =

[akka-user] [Akka-stream] How to do flow shortcut

2015-08-31 Thread Leon Ma
Hi, I have below flow setup: Source ---> FlowA ---> FlowB ---> FlowC > Sink I'd like to do some checking on elements out of FlowA, if some criteria matches, shortcut FlowB and directly pipe to FlowC. I'm not sure whether I should use something like FlexiRoute like: Source >

[akka-user] [Akka-http] Using Flow to transform HttpRequest into HttpResponse

2015-08-28 Thread Leon Ma
Hi, Assuming I have below definitions: val flow : Flow[HttpRequest, HttpResponse, Unit] = ??? val request : HttpRequest = ??? It seems I can get a Future[Response] by doing: val response = Source.single(request).via(flow).runWith(Sink.head) I have some questions: 1. Any other ways to get

[akka-user] Re: [akka-http] Some questions about akka-http

2015-08-25 Thread Leon Ma
use case? Cheers, André On Tuesday, August 25, 2015 at 9:21:46 AM UTC+2, Leon Ma wrote: Hi, I have some general questions about akka-http: 1. Is there any concrete samples that illustrate how to return chunked response with akka-http? 2. Does Route/Directives (high-level api) supports

[akka-user] [akka-http] Some questions about akka-http

2015-08-25 Thread Leon Ma
Hi, I have some general questions about akka-http: 1. Is there any concrete samples that illustrate how to return chunked response with akka-http? 2. Does Route/Directives (high-level api) supports chunked response? Thanks Leon -- Read the docs: http://akka.io/docs/ Check the

[akka-user] akka http marshalling/unmarshalling

2015-06-19 Thread Leon Ma
Hi, I just checked some code on 2.3-dev branch: https://github.com/akka/akka/blob/release-2.3-dev/akka-http-marshallers-java/akka-http-jackson/src/main/scala/akka/http/javadsl/marshallers/jackson/Jackson.scala

Re: [akka-user] Re: Too many scan calls when profiling my akka application

2015-06-08 Thread Leon Ma
Got it , thanks a lot! 在 2015年6月7日星期日 UTC-7上午4:42:52,Akka Team写道: Hi Leon, The scan method of FJP will very likely be your top method unless you have very favorable load patterns for FJP. I wouldn't worry about it, unless you see a performance problem with your application. -Endre On

[akka-user] Re: include external conf

2015-04-07 Thread Leon Ma
! On Friday, April 3, 2015 at 4:00:53 AM UTC+2, Leon Ma wrote: Hi, In my application.conf, I'd like to include another conf from a dependent jars. Shall I just do include abc.conf or include classpath(abc.conf) Thanks Leon -- Read the docs: http://akka.io/docs/ Check

[akka-user] include external conf

2015-04-02 Thread Leon Ma
Hi, In my application.conf, I'd like to include another conf from a dependent jars. Shall I just do include abc.conf or include classpath(abc.conf) Thanks Leon -- Read the docs: http://akka.io/docs/ Check the FAQ: http://doc.akka.io/docs/akka/current/additional/faq.html

[akka-user] When to use thread-pool-executor

2014-12-25 Thread Leon Ma
Hi, In most cases, fork-join-executor is better than thread-pool-executor, however I'm wondering what's the best scenario to use thread-pool-executor. Thanks Leon -- Read the docs: http://akka.io/docs/ Check the FAQ:

Re: [akka-user] Using akka-stream to build async pipeline

2014-12-01 Thread Leon Ma
Thank you so much for your detailed answers, I'll try to look into it deeper :) Leon 在 2014年11月28日星期五UTC-8上午2时10分36秒,Patrik Nordwall写道: On Thu, Nov 27, 2014 at 10:44 AM, Leon Ma tutu...@gmail.com javascript: wrote: Hi, Konrad I have some common questions regarding akka stream. Say I

Re: [akka-user] Using akka-stream to build async pipeline

2014-11-27 Thread Leon Ma
and please look forward to our 1.0 release which is coming soon (then, with docs!). On Mon, Nov 17, 2014 at 10:10 AM, Leon Ma tutu...@gmail.com javascript: wrote: Hi, I'm wondering if akka-stream is a good candidate for creating an async pipeline for data processing. Take http request

[akka-user] Using akka-stream to build async pipeline

2014-11-17 Thread Leon Ma
Hi, I'm wondering if akka-stream is a good candidate for creating an async pipeline for data processing. Take http request as example, I'd like the request go thru a series of pipeline handlers 1 by 1 asynchronously and finally get a response. More over, I'd like to see it's capable to jump

Re: [akka-user] Using akka-stream to build async pipeline

2014-11-17 Thread Leon Ma
-stream-tests%2Fsrc%2Ftest%2Fscala%2Fakka%2Fstream%2Fscaladslsa=Dsntz=1usg=AFQjCNFqMXzxZAhy9dxEgPnDHh6I1Spf1A Happy hakking and please look forward to our 1.0 release which is coming soon (then, with docs!). On Mon, Nov 17, 2014 at 10:10 AM, Leon Ma tutu...@gmail.com javascript: wrote: Hi

Re: [akka-user] Using EventStream in non-actor context

2014-07-21 Thread Leon Ma
Nice! Let me try it. Thanks a lot! Leon 在 2014年7月18日星期五UTC-7上午4时58分22秒,Konrad Malawski写道: Hello again, yeah, it would be a different stream, so you loose any ordering guarantees. But how about spinning up an Actor, that will serve as an adapter for your “non actors” to talk with the

Re: [akka-user] Using EventStream in non-actor context

2014-07-18 Thread Leon Ma
other EventBus? You can create your own buses very easily, like that: http://doc.akka.io/docs/akka/2.3.4/scala/event-bus.html On Thu, Jul 17, 2014 at 2:45 PM, Leon Ma tutu...@gmail.com javascript: wrote: Hi, I'd like to use EventStream to send my specific messages and I have my own

Re: [akka-user] AOP in Akka

2014-06-05 Thread Leon Ma
Hi, Ivan I guess you must be very familiar with both aspectj and scala, could you help me on below question? I'm trying to do some experimental point cut on scala.concurrent.Future, something like: @Aspect class FutureAspect { @Around(value = execution (*

Re: [akka-user] AOP in Akka

2014-06-04 Thread Leon Ma
by and when I say all events I'm including future's body/callbacks and actor supervision messages, not just regular tell I happened to see your project has dependencies on aspectj, right? Are you using AOP to intercept some akka classes like LocalActorRef? I'm just curious that which weaver

Re: [akka-user] AOP in Akka

2014-05-30 Thread Leon Ma
My case is actually to pass some information like Mapped Diagnostic Context. Some of my legacy java code is using threadlocal to carry on those MDC information, that's why I need a way to: intercept tell : collect threadlocal information and do some wrapping like MDCCtx(mymessage,

[akka-user] AOP in Akka

2014-05-28 Thread Leon Ma
Hi, Assuming I want to do some aop advice against some of the actor method like ask , tell, etc like: @Around(value = execution (* akka.actor.ScalaActorRef.$bang(..)) args(message,sender), argNames = jp,message,sender) def handle(jp: ProceedingJoinPoint, message: AnyRef, sender: ActorRef) {

[akka-user] get messages back in actor test

2014-05-23 Thread Leon Ma
Hi, Usually I do: actorRef ! SomeRequest expectMsg(SomeResponse) However I'd like to know whether I can get the last response message object like this: actorRef ! SomeRequest val resp = lastMsg() resp.propA should be (...) resp.StringProp contains mysubstring should be(true) Is it doable?

Re: [akka-user] Which concurrent map to use in scala

2014-05-14 Thread Leon Ma
Snapshotshttp://lampwww.epfl.ch/~prokopec/ctries-snapshot.pdf B/ On 14 May 2014 at 07:05:42, Leon Ma (tutu...@gmail.com javascript:) wrote: Hi, Any suggestions on how to choose concurrent map impl in scala? java's ConcurrentHashMap or scala's TrieMap? Any performance comparison? Thanks

Re: [akka-user] Question about thread safe in actor

2014-05-14 Thread Leon Ma
and processes the messages one by one from it. We guarantee that fields are properly visible, even if the actor jumps around threads - no need for CHM in the actor On Thu, May 15, 2014 at 7:31 AM, Leon Ma tutu...@gmail.com javascript:wrote: Hi, Assuming I have an actor which hold a map M

[akka-user] Is there any max task queue settings for default scheduler?

2014-05-13 Thread Leon Ma
I would do below in my code: context.system.scheduler.scheduleOnce(duration, self, action) I guess there must be some task queue to hold the deferred task, any size limitation? Will the above call throw some reject exception said exceed max size? Thanks Leon -- Read the docs:

[akka-user] About actor creation

2014-05-07 Thread Leon Ma
Hi, I have some questions regarding to akka actor creation.(I'm using akka 2.2.3) I'm expecting below 2 statements have same effect: (according to some document) context.actorOf(Props(classOf[MyClass], myParam)) context.actorOf(Props(new MyClass(myParam))) However, the 2nd code complains