Re: [akka-user] Explaining AKKA Thread Pool Execturor Config parameters

2015-10-12 Thread Maatary Okouya
Oh thanks. Great material

On Mon, Oct 12, 2015 at 6:53 AM, Viktor Klang 
wrote:

>
>
> On Mon, Oct 12, 2015 at 12:44 PM, Maatary Okouya 
> wrote:
>
>> Just to be clear, the meaning of parallelism is not stricto sensus. In
>> other words, when i think  parallelism, i think parallel execution. While
>> given that we are not at 1 thread per OS reported processor, but 3, i
>> conclude that this is more like a concurrency factor. I mean concurrent is
>> not parallel.  That was the my original confusion i.e. understanding what
>> is meant by parallelism here.
>>
>> But i guess this is parallel in the loose sense, as in scala parallel
>> collection. They can be fully operated in parallel but r actually operated
>> concurrently.
>>
>> I just wanted to be clear on the semantic? Is my understanding right ? We
>> are talking of parallelism in a loose sense and not stricto sensus.
>>
>
> Id' recommend reading up on the following for understanding ForkJoinPool:
> https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ForkJoinPool.html
>
> We chose to use the same nomenclature (inventing our own would be weird,
> don't you agree?)
>
>
>> On Mon, Oct 12, 2015 at 6:26 AM, Maatary Okouya 
>> wrote:
>>
>>> Understood, Many thanks.
>>>
>>> On Mon, Oct 12, 2015 at 6:08 AM, Viktor Klang 
>>> wrote:
>>>


 On Mon, Oct 12, 2015 at 12:00 PM, Maatary Okouya <
 maatarioko...@gmail.com> wrote:

> Thank you victor.
>
> However,
>
> 1 - does it means that akka configuration is not related to the number
> of cores but the processor only ? So wether your processor has two cores 
> or
> 4 cores or just 1, is not taken into account at all, i.e. in deciding how
> much thread you would allocate in your thread pool?
>
>
 Or
>
> 2 - by processor u actually mean "a core" I.e in "4 processors" your
> actually mean a quad-core processor or dual-core processor hyper-threaded.
>
>
> Could you please clarify this "processor" thing in term of typical
> machine configuration ?
>

 No, it's about the number of processors available to the JVM. It's
 about what the OS reports.

 https://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html#availableProcessors()

 So for a computer with 2 CPU-slots with 4 cores each with
 HyperThreading, it would be 2 * 4 * 2 = 16 processors


>
>
> On Mon, Oct 12, 2015 at 3:55 AM Viktor Klang 
> wrote:
>
>> Hi Maatary,
>>
>> On Sun, Oct 11, 2015 at 9:27 PM, Maatary Okouya <
>> maatarioko...@gmail.com> wrote:
>>
>>> Hi,
>>>
>>> As I understood that the fork-join-executor is the default
>>> dispatcher when non is provided when creating the actor system
>>> Can someone explain me the following:
>>>
>>>
>>>1. fork-join-executor {
>>>2. # Min number of threads to cap factor-based parallelism
>>>number to
>>>3. parallelism-min = 8
>>>4.
>>>5. # The parallelism factor is used to determine thread pool
>>>size using the
>>>6. # following formula: ceil(available processors * factor).
>>>Resulting size
>>>7. # is then bounded by the parallelism-min and parallelism-max
>>>values.
>>>8. parallelism-factor = 3.0
>>>9.
>>>10. # Max number of threads to cap factor-based parallelism
>>>number to
>>>11. parallelism-max = 64
>>>12.
>>>13. # Setting to "FIFO" to use queue like peeking mode which
>>>"poll" or "LIFO" to use stack
>>>14. # like peeking mode which "pop".
>>>15. task-peeking-mode = "FIFO"
>>>16. }
>>>
>>>
>>> ALthough i understand each word, i don't understand the full
>>> semantic of what is explained here.
>>>
>>>
>>> - What does mean ceil ? in ceil(available processors * factor)
>>>
>>
>> In short: "Rounded up":
>> https://www.google.se/search?q=ceil
>>
>>
>>> - What means factor-based parallelism ?
>>>
>>
>> It means that the factor given in "parallelism-factor" will be what
>> the available number of processors will be multiplied with.
>>
>> Scenario:
>>
>> available processors = 4
>> parallelism-factor = 0.6
>>
>> ceil(4 * 0.6) == 3
>>
>> this means that the resulting desired parallelism is 3
>>
>> Does that make sense?
>>
>>
>>>
>>> Can someone overall explain to me in english what means the
>>> configuration above. By reading many post here and there, i had somewhat
>>> understood that by default, akka, would set up a threadPoolexecutor that
>>> allocate and thread per core. Hence if you have 2 two core processor, 
>>> you
>>> would end up with 4 threads. Which is how much parallel you can really 
>>> be
>>> anyway. Above that it is concurrent but not full strictly speaking

Re: [akka-user] "Returning" a value from an ActorPublisher?

2015-10-12 Thread Konrad Malawski
Yes, that's the status quo and should be fine to do.

We also have some new upcoming infrastructure (
GraphStageWithMaterializedValue
,
to be documented soon),
that will be coming to Http 1.1 and allow to write complex custom and async
and arbitrary number of ports stages (including sinks and sources),
as well as providing a materialized value using that API, instead of having
to drop down to Publisher/Subscriber level.

Please look forward to it, your feedback about it once we release 1.1 would
be really valuable, thanks!

Hope this helps, happy hakking!

On Sun, Oct 11, 2015 at 1:06 AM, Jan Algermissen 
wrote:

>
>
> On Saturday, October 10, 2015 at 11:18:20 PM UTC+2, Konrad Malawski wrote:
>>
>>
>> Since an ActorPublisher can get parameters passed in - it's your Props
>> after all - you could simply pass in a Promise to be completed by it for
>> example.
>>
>>
> Yeah - thought about that but it somehow felt weird - thanks for clearing
> my mind, in fact it's just fine (using a callback now).
>
> Jan
>
>
>
>> --
>> Cheers,
>> Konrad 'ktoso’ Malawski
>> Akka  @ Typesafe 
>>
>> On 10 October 2015 at 23:08:36, Jan Algermissen (algermi...@me.com)
>> wrote:
>>
>> Hi,
>>
>> I am implementing an ActorPublisher that reads records from a database.
>> When the stream is completed I would like to extract some value from the
>> actor (for example the maximum of some field of the records processed).
>>
>> Is there a way to extract such a value from the ActorPublisher once the
>> stream has completed (like there is in the ActorSubscriber case)?
>>
>> Or would I have to fork the stream an calculate such a value using a
>> separate (forked-off) flow and sink for it?
>>
>> Jan
>> --
>> >> 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.
>> To post to this group, send email to akka...@googlegroups.com.
>> Visit this group at http://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 http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Cheers,
Konrad 'ktoso' Malawski
Akka  @ Typesafe 

-- 
>>  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] [akka-http] mapInnerRoute is not working

2015-10-12 Thread Konrad Malawski
Hi Jack,
please don't double post questions to multiple forums at the same time, it
makes tracking if something is resolved or not yet much harder for us.
Or post the solution on the relevant cross-posted threads once you have
found it, so others can benefit from fiding it, thanks a lot in advance!

This was answered on StackOverflow:
http://stackoverflow.com/questions/32969554/mapinnerroute-is-not-working

def completeWithUserAwareException(user: User) =
  handleExceptions(
ExceptionHandler {
  case NonFatal(ex) => failWith(new ExceptionWithUser(user, 0, ex))
})


On Tue, Oct 6, 2015 at 8:33 PM, Jack Daniels  wrote:

> I'm trying to create route that would wrap caught exception into my
> exception that carries user object of logged-in user. Ideally I prefer to
> put that information into ContextRequest in order to use it in my
> ExceptionHandler but it's immutable.
>
>
> I concluded that the right way to do it is to use mapInnerRoute as
> described in this example
> 
> .
>
>
> def completeWithUserAwareException(user: User) =
>   mapInnerRoute { route =>
> ctx =>
>   try {
> route(ctx)
>   } catch {
> case ex: Throwable =>
>   ctx.fail(new ExceptionWithUser(user, 0, ex))
>   }
>   }
>
>
> which I use like this
>
>
> val authenticatedRoutes = myAuthorization { user =>
> completeWithUserAwareException(user) {
> pathPrefix("admin") {
>   (get & path("plugins")) {
>   complete {
> ""
>   }
>   }
> }
>   }}
>
>
> Content of completeWithUserAwareException is never invoked. I suspect it
> has something to do with dynamic nature of outer route.
>
>
> How can I achieve my goal of passing user context information to exception
> handler ?
>
> SO question is here :
> http://stackoverflow.com/questions/32969554/mapinnerroute-is-not-working
>
> --
> >> 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,
Konrad 'ktoso' Malawski
Akka  @ Typesafe 

-- 
>>  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: is there a way to know when *really* an actor has stopped

2015-10-12 Thread 'Konstantinos Kougios' via Akka User List
well, it could, but requires more work and it is more complex than 
having any actor .watch() for events.


Especially in my case that I need to watch for termination across the 
cluster, I would need a round trip to all parents (where as now I am 
just doing the round trip to the actors straight away)


Basically, my db "driver" issues a DropIndex msg to one of the db 
servers. That server then needs to monitor the whole process, making 
sure the drop index indeed occurred for all the cluster


On 09/10/15 18:21, Patrik Nordwall wrote:
Thanks for elaborating. I still don't understand why the 
databaseServer can't watch its index children and recreate them when 
it receives Terminated.


Regarding recreating the databaseServer itself (top level I guess) in 
tests I would not reuse the name.
fre 9 okt. 2015 kl. 18:54 skrev 'Konstantinos Kougios' via Akka User 
List mailto:akka-user@googlegroups.com>>:


A solution like this could work, but it is a lot more complicated
(complexity added just to handle actor termination).

The databaseServer actor is not affected by the deaths of the indexes.

Btw, all my Terminated actors are local (same ActorSystem, same
jvm) to the watcher, does that help?


On 09/10/15 17:36, Michael Frank wrote:

instead of using actor paths to send directly to the index actor,
why not send your message to the /databaseServer actor, which
then forwards the message to the appropriate index actor?  the
databaseServer actor would contain a Map[String,ActorRef] which
maps index name to index actor (which are its children), and
would register deathwatch on each child, so it would be notified
when an index goes away and update its state.

-Michael

On 10/09/15 08:58, 'Konstantinos Kougios' via Akka User List wrote:

well, I am using actor paths to find the actors, which are
unique per ActorSystem.

I.e. paths are

../databaseServer

../databaseServer/index:x1

../databaseServer/index:x2

I am using the akka cluster, so each "server" will have these paths.

Now when I do a "dropIndex" and drop index x1, actors
../databaseServer/index:x1 on each server must terminate. I
would like to know precisely when that occurred, because a
drop/recreate will have the issue of the same actor name.

Now I could, for tests, use a unique index name each time. But
some tests need to drop/recreate the /databaseServer (and
remember I refer to the indexes by ../databaseServer/index:x1)

Cheers


On 09/10/15 12:30, Patrik Nordwall wrote:

it's probably easies to not reuse the name

On Fri, Oct 9, 2015 at 1:23 PM, 'Konstantinos Kougios' via Akka
User List mailto:akka-user@googlegroups.com>> wrote:

Well, I have this component based on 1 actor. It is the
"flow" thing I was talking a few months ago, anyway it does
take care of a process between different actors. One thing
it does is to stop an other actor and wait till it is
terminated. I need to make sure the other actor is really
terminated because further down an actor with the same name
is created - which randomly & rarely fails with "actor name
[databaseServer] is not unique!"


On 09/10/15 12:17, Patrik Nordwall wrote:



On Fri, Oct 9, 2015 at 12:59 PM, 'Konstantinos Kougios'
via Akka User List mailto:akka-user@googlegroups.com>> wrote:

oh... in that case my code changes won't work. The
watcher is not the parent of the actor.

Will it work if the watcher is child of the same
parent of the Terminated actor?


no, but what would a sibling do? it can't recreate the
actor, it is only the parent that can create child actor
with same name




On 09/10/15 06:08, Patrik Nordwall wrote:

Note that this advice is correct but only when the
parent actor receives the Terminated, i.e. it does
not hold for top level actors where you can only
watch from the "outside".
tors 8 okt. 2015 kl. 11:46 skrev Kostas kougios
mailto:kostas.koug...@googlemail.com>>:

Thanks, I am doing that now and hopefully it
works (the issue occurred very rarely, so I have
to wait and see)


On Friday, 2 October 2015 17:16:35 UTC+1, Ryan
Tanner wrote:

Don't create the replacement actor until
you've received a Terminated message for the
original actor.

On Friday, October 2, 2015 at 8:58:54 AM
UTC-6, Kostas kougios wrote:

I create a named actor, stop it and
recreate it with the same name. Because
stop is async, I end up with exceptions like

akka.actor.Inval

Re: [akka-user] [akka-persistence] Hihgest sequence number and deleteMessages in third-party journal.

2015-10-12 Thread Evgeny Shepelyuk
Thank you for the answer.
Will it be possible to contribute to TCK if I be able to write proper test 
cases ?

понеділок, 12 жовтня 2015 р. 15:47:37 UTC+3 користувач Patrik Nordwall 
написав:
>
> It should keep track of the highest used sequence number, also after 
> delete of all events. That is not documented yet. We intend to do so and 
> also enforce it with the TCK. https://github.com/akka/akka/issues/18559
>
> /Patrik
>
> On Sat, Oct 10, 2015 at 11:43 AM, Evgeny Shepelyuk  > wrote:
>
>> Hello,
>>
>> Is it true that third-party journal implementation should keep the 
>> highest sequence number for persistenceId even if deleteMessages caused 
>> complete journal cleanup ?
>> This is how LevelDB implementation is working, but I can't 
>> find explicit statement mentioning this in AKKA docs.
>>
>> --
>> Regards.
>>
>> -- 
>> >> 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 .
>> To post to this group, send email to akka...@googlegroups.com 
>> .
>> Visit this group at http://groups.google.com/group/akka-user.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> -- 
>
> Patrik Nordwall
> Typesafe  -  Reactive apps on the JVM
> Twitter: @patriknw
>
>

-- 
>>  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] [akka-persistence] Hihgest sequence number and deleteMessages in third-party journal.

2015-10-12 Thread Patrik Nordwall
It would be great if you do that. Thanks
/Patrik

mån 12 okt. 2015 kl. 20:52 skrev Evgeny Shepelyuk :

> Thank you for the answer.
> Will it be possible to contribute to TCK if I be able to write proper test
> cases ?
>
> понеділок, 12 жовтня 2015 р. 15:47:37 UTC+3 користувач Patrik Nordwall
> написав:
>>
>> It should keep track of the highest used sequence number, also after
>> delete of all events. That is not documented yet. We intend to do so and
>> also enforce it with the TCK. https://github.com/akka/akka/issues/18559
>>
>> /Patrik
>>
> On Sat, Oct 10, 2015 at 11:43 AM, Evgeny Shepelyuk 
>> wrote:
>>
> Hello,
>>>
>>> Is it true that third-party journal implementation should keep the
>>> highest sequence number for persistenceId even if deleteMessages caused
>>> complete journal cleanup ?
>>> This is how LevelDB implementation is working, but I can't
>>> find explicit statement mentioning this in AKKA docs.
>>>
>>> --
>>> Regards.
>>>
>> --
>>> >> 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.
>>> To post to this group, send email to akka...@googlegroups.com.
>>
>>
>>> Visit this group at http://groups.google.com/group/akka-user.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>>
>> --
>>
>> Patrik Nordwall
>> Typesafe  -  Reactive apps on the JVM
>> Twitter: @patriknw
>>
>> --
> >> 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.
>
-- 
/Patrik

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


[akka-user] Re: [Akka Streams] Sink vs Flow (or: committing offsets after writing to Kafka)

2015-10-12 Thread hbf

On Monday, 12 October 2015 10:03:06 UTC-7, Julian Howarth wrote:
>
> Have you looked at reactive-kafka: 
> https://github.com/softwaremill/reactive-kafka ?
>

I have looked at reactive-kaka and am following some discussions on Gitter 
on the subject.
 

> We use the method documented in the Manual Commit section of that page 
> which works well for us. Basically, it automatically commits some 
> configurable period of time after your processing of the message is 
> complete. So as long as your handling of the incoming messages is 
> idempotent, you can never lose messages.
>

Can you elaborate how that works exactly? My main question is this: an Akka 
Stream flow does message processing in parallel. So what can happen is that 
the Kafka consumer has read two messages and both of them are still in some 
flow and have *not* reached the sink (= the Kafka writer who writes to an 
output topic) yet. Suppose the auto-commit happens now and we crash. In 
this case, I will have lost two messages. Correct?

If so, then auto-commit doesn't work. So we need to commit messages *after* 
they 
been written out.

Looking at reactive-kafka, I think they use approach two from my original 
mail:

val consumerWithOffsetSink = 
kafka.consumeWithOffsetSink(consumerProperties)Source(consumerWithOffsetSink.publisher)
  .map(processMessage(_)) // your message processing
  .to(consumerWithOffsetSink.offsetCommitSink) // stream back for commit
  .run()


You'd write your message out in processMessage.

– Kaspar



> HTH,
>
> Julian
>
> On Sunday, October 11, 2015 at 11:55:21 PM UTC+1, hbf wrote:
>>
>> Hi,
>>
>> I using Akka streams to read (= consume) messages from a Kafka tropic, 
>> transform them, and write them to another Kafka topic. I am looking for a 
>> way to commit the consumer offset of a message after it was written.
>>
>> Example: if I've read message *m*, I'd like to first process it and 
>> write it out to the destination topic. Only then do I want to tell Kafka 
>> "ok, I've read *m; *if i crash and restart, position me after *m*, 
>> please!"
>>
>> Here are a few ways to realize this:
>>
>>- Make the writer a Sink and give it knowledge about the consumer so 
>>it can commit the latter's offset after writing. Not nice: the sink 
>>shouldn't have to know about a consumer.
>>- Make the writer a Flow that as a side effect writes to Kafka. Then 
>>connect this flow to a CommitSink that commits the offsets. That doesn't 
>>sound nice either, as conceptually, both are sinks.
>>
>> Any suggestions how to do this in The Akka Streams Way®?
>>
>> Thanks,
>> K
>>
>

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


[akka-user] Re: [Akka Streams] Sink vs Flow (or: committing offsets after writing to Kafka)

2015-10-12 Thread Julian Howarth
Have you looked at 
reactive-kafka: https://github.com/softwaremill/reactive-kafka ? We use the 
method documented in the Manual Commit section of that page which works 
well for us. Basically, it automatically commits some configurable period 
of time after your processing of the message is complete. So as long as 
your handling of the incoming messages is idempotent, you can never lose 
messages.

HTH,

Julian

On Sunday, October 11, 2015 at 11:55:21 PM UTC+1, hbf wrote:
>
> Hi,
>
> I using Akka streams to read (= consume) messages from a Kafka tropic, 
> transform them, and write them to another Kafka topic. I am looking for a 
> way to commit the consumer offset of a message after it was written.
>
> Example: if I've read message *m*, I'd like to first process it and write 
> it out to the destination topic. Only then do I want to tell Kafka "ok, 
> I've read *m; *if i crash and restart, position me after *m*, please!"
>
> Here are a few ways to realize this:
>
>- Make the writer a Sink and give it knowledge about the consumer so 
>it can commit the latter's offset after writing. Not nice: the sink 
>shouldn't have to know about a consumer.
>- Make the writer a Flow that as a side effect writes to Kafka. Then 
>connect this flow to a CommitSink that commits the offsets. That doesn't 
>sound nice either, as conceptually, both are sinks.
>
> Any suggestions how to do this in The Akka Streams Way®?
>
> Thanks,
> K
>

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


[akka-user] akka.actor.ActorNotFound: Actor not found for: ActorSelection[Anchor(akka.tcp://DistIdx@dist-index:2710/), Path(/user/databaseServer/index:my-index)]

2015-10-12 Thread Kostas kougios
Running some stress tests on my code produces the following:

2015-10-12 15:38:06.301UTC ERROR[DistIdx-akka.actor.default-dispatcher-22] 
[akka.tcp://DistIdx@dist-index:2720/user/driverActor] 
o.d.a.e.i.ActorExtImpl - Failed to locate index
akka.actor.ActorNotFound: Actor not found for: 
ActorSelection[Anchor(akka.tcp://DistIdx@dist-index:2710/), 
Path(/user/databaseServer/index:my-index)]
at 
akka.actor.ActorSelection$$anonfun$resolveOne$1.apply(ActorSelection.scala:65) 
~[akka-actor_2.11-2.4.0.jar:na]
at 
akka.actor.ActorSelection$$anonfun$resolveOne$1.apply(ActorSelection.scala:63) 
~[akka-actor_2.11-2.4.0.jar:na]
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:32) 
~[scala-library-2.11.7.jar:na]
at 
akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:55)
 
~[akka-actor_2.11-2.4.0.jar:na]
at akka.dispatch.BatchingExecutor$Batch.run(BatchingExecutor.scala:73) 
~[akka-actor_2.11-2.4.0.jar:na]
at 
akka.dispatch.ExecutionContexts$sameThreadExecutionContext$.unbatchedExecute(Future.scala:74)
 
~[akka-actor_2.11-2.4.0.jar:na]
at 
akka.dispatch.BatchingExecutor$class.execute(BatchingExecutor.scala:120) 
~[akka-actor_2.11-2.4.0.jar:na]
at 
akka.dispatch.ExecutionContexts$sameThreadExecutionContext$.execute(Future.scala:73)
 
~[akka-actor_2.11-2.4.0.jar:na]
at 
scala.concurrent.impl.CallbackRunnable.executeWithValue(Promise.scala:40) 
~[scala-library-2.11.7.jar:na]
at 
scala.concurrent.impl.Promise$DefaultPromise.tryComplete(Promise.scala:248) 
~[scala-library-2.11.7.jar:na]
at akka.pattern.PromiseActorRef.$bang(AskSupport.scala:345) 
~[akka-actor_2.11-2.4.0.jar:na]
at akka.actor.EmptyLocalActorRef.specialHandle(ActorRef.scala:553) 
~[akka-actor_2.11-2.4.0.jar:na]
at akka.actor.DeadLetterActorRef.specialHandle(ActorRef.scala:589) 
~[akka-actor_2.11-2.4.0.jar:na]
at akka.actor.DeadLetterActorRef.$bang(ActorRef.scala:579) 
~[akka-actor_2.11-2.4.0.jar:na]
at 
akka.remote.RemoteActorRefProvider$RemoteDeadLetterActorRef.$bang(RemoteActorRefProvider.scala:85)
 
~[akka-remote_2.11-2.4.0.jar:na]
at 
akka.remote.ReliableDeliverySupervisor$$anonfun$gated$1.applyOrElse(Endpoint.scala:328)
 
~[akka-remote_2.11-2.4.0.jar:na]
at akka.actor.Actor$class.aroundReceive(Actor.scala:480) 
~[akka-actor_2.11-2.4.0.jar:na]
at 
akka.remote.ReliableDeliverySupervisor.aroundReceive(Endpoint.scala:188) 
~[akka-remote_2.11-2.4.0.jar:na]
at akka.actor.ActorCell.receiveMessage(ActorCell.scala:525) 
[akka-actor_2.11-2.4.0.jar:na]
at akka.actor.ActorCell.invoke(ActorCell.scala:494) 
[akka-actor_2.11-2.4.0.jar:na]
at akka.dispatch.Mailbox.processMailbox(Mailbox.scala:257) 
[akka-actor_2.11-2.4.0.jar:na]
at akka.dispatch.Mailbox.run(Mailbox.scala:224) 
[akka-actor_2.11-2.4.0.jar:na]
at akka.dispatch.Mailbox.exec(Mailbox.scala:234) 
[akka-actor_2.11-2.4.0.jar:na]
at scala.concurrent.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260) 
[scala-library-2.11.7.jar:na]
at 
scala.concurrent.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
 
[scala-library-2.11.7.jar:na]
at 
scala.concurrent.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979) 
[scala-library-2.11.7.jar:na]
at 
scala.concurrent.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
 
[scala-library-2.11.7.jar:na]

Ok, so the actor is dead, but how? There is no exception before that (if 
the actor throwed one, wouldn't it be visible in the logs?)


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


[akka-user] Re: How to construct a type parameterized Actor with a ClassTag?

2015-10-12 Thread Rolf
I found a basic way to do this by manually passing the ClassTag. It is not 
very pretty but it works:


import akka.actor._
import scala.reflect.ClassTag

class MyActor[V](size: Int, default: V, ct: ClassTag[V]) extends Actor {

// Array of given size filled with given default value
val array = Array.fill[V](size)(default)(ct)

override def receive: Receive = {
  case i: Int if i < size && i >= 0 => println(array(i))
}
}

val system = ActorSystem("test")
val myActor = system.actorOf(Props(classOf[MyActor[Double]], 100, 0.0, 
implicitly[ClassTag[Double]]))

myActor ! 3
// Correctly returns 0.0



On Friday, 9 October 2015 22:05:56 UTC+2, Rolf wrote:
>
> I wish to create an actor that stores an array of elements of some general 
> type V. The typical way to instantiate such an array is to provide a 
> ClassTag and default value. I have implemented this as follows:
>
> import akka.actor._
> import scala.reflect.ClassTag
>
> class MyActor[V : ClassTag](size: Int, default: V) extends Actor {
>
> // Array of given size filled with given default value
> val array = Array.fill[V](size)(default)
>
> override def receive: Receive = {
>   case i: Int if i < size && i >= 0 => println(i)
> }
> }
>
> val system = ActorSystem("test")
> val myActor = system.actorOf(Props(classOf[MyActor[Double]], 100, 0.0))
> // java.lang.IllegalArgumentException: no matching constructor found on 
> class MyActor for arguments [class java.lang.Integer, class 
> java.lang.Double]
> //   at akka.util.Reflect$.error$1(Reflect.scala:81)
> //   ...
>
> Unfortunately, the above code does not work and I get an exception as soon 
> as the actor is created. It seems that Akka does not pass the implicit 
> class tag that is necessary to instantiate the class(?) Note that there is 
> no problem when using the above pattern in a normal class:
>
> import scala.reflect.ClassTag
>
> class Test[V : ClassTag](size: Int, default: V) {
>
> // Array of given size filled with given default value
> val array = Array.fill[V](size)(default)
>
> }
>
> val test = new Test[Double](100, 0.0)
> test.array(3)
> // Correctly returns 0.0
>
> Any advice on how to get something like this working in Akka?
>
> Thanks!
>

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


[akka-user] Event-sourcing with aka-persistence

2015-10-12 Thread Adam Dohnal
Hello, 

I am new in Akka and I am trying to develop some mini project to test some 
things (akka, rx, cqrs, es etc..)

I think I understand the concept of cqrs/es and how it fit to akka. My 
problem is probably more theoretical than technical.

Let's say, I have class Player, which has several Attribute[T] attributes 
... these attributes can be for example player's current health, vitality, 
experience, level etc ... These attributes have dependencies ... for 
example currentHealth is defined as 10 * vitality ... if experience is > 
100 new level is earns, which causes to add 1 vitality, which causes to add 
10 health ... Hopefully, you get the point.

I like the idea to implement this using reactive streams. Each Attribute[T] 
should be considered as Observable[T] and with all these excellent 
operators I can model dependencies I have described before.

Now I am trying to model each Player as actor, which can handle commands 
(AddExperience(...), AddVitality(...) etc...) and produce events 
(ExperienceAdded(...), LevelEarned(...)) which should be event sourced.

Problem is, that when I am handling command I directly don't know what 
events should be generated ... for example AddExperience(100) is handled 
and after some validation ExperienceAdded(100) should be persisted to event 
store. When it success, it should be applied to my domain, which emit value 
change in that attribute observable and new level can be earned ... but how 
can I persist that event?

I try to write some pseudo-code

class ExamplePersistentActor extends PersistentActor {
  val Player player = ... // domain

  val subscription = player.observable.subscribe {
// here I get asynchronously information about that level is increased ... 
should I call persist here?
}

val receiveCommand: Receive = {
case AddExperience(xp: Int) => {
 persist(ExperienceAdded(xp)) { event =>
  player.addExperience(xp) // should produce LevelEarned(1) event, which 
should be also persisted
}   
  }
}

So I have reference to Player which has observable of all events that are 
produced ... but I don't how to persist them :/

-- 
>>  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] [akka-persistence] Hihgest sequence number and deleteMessages in third-party journal.

2015-10-12 Thread Patrik Nordwall
It should keep track of the highest used sequence number, also after delete
of all events. That is not documented yet. We intend to do so and also
enforce it with the TCK. https://github.com/akka/akka/issues/18559

/Patrik

On Sat, Oct 10, 2015 at 11:43 AM, Evgeny Shepelyuk 
wrote:

> Hello,
>
> Is it true that third-party journal implementation should keep the highest
> sequence number for persistenceId even if deleteMessages caused complete
> journal cleanup ?
> This is how LevelDB implementation is working, but I can't
> find explicit statement mentioning this in AKKA docs.
>
> --
> Regards.
>
> --
> >> 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.
>



-- 

Patrik Nordwall
Typesafe  -  Reactive apps on the JVM
Twitter: @patriknw

-- 
>>  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] Explaining AKKA Thread Pool Execturor Config parameters

2015-10-12 Thread Viktor Klang
On Mon, Oct 12, 2015 at 12:44 PM, Maatary Okouya 
wrote:

> Just to be clear, the meaning of parallelism is not stricto sensus. In
> other words, when i think  parallelism, i think parallel execution. While
> given that we are not at 1 thread per OS reported processor, but 3, i
> conclude that this is more like a concurrency factor. I mean concurrent is
> not parallel.  That was the my original confusion i.e. understanding what
> is meant by parallelism here.
>
> But i guess this is parallel in the loose sense, as in scala parallel
> collection. They can be fully operated in parallel but r actually operated
> concurrently.
>
> I just wanted to be clear on the semantic? Is my understanding right ? We
> are talking of parallelism in a loose sense and not stricto sensus.
>

Id' recommend reading up on the following for understanding ForkJoinPool:
https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ForkJoinPool.html

We chose to use the same nomenclature (inventing our own would be weird,
don't you agree?)


> On Mon, Oct 12, 2015 at 6:26 AM, Maatary Okouya 
> wrote:
>
>> Understood, Many thanks.
>>
>> On Mon, Oct 12, 2015 at 6:08 AM, Viktor Klang 
>> wrote:
>>
>>>
>>>
>>> On Mon, Oct 12, 2015 at 12:00 PM, Maatary Okouya <
>>> maatarioko...@gmail.com> wrote:
>>>
 Thank you victor.

 However,

 1 - does it means that akka configuration is not related to the number
 of cores but the processor only ? So wether your processor has two cores or
 4 cores or just 1, is not taken into account at all, i.e. in deciding how
 much thread you would allocate in your thread pool?


>>> Or

 2 - by processor u actually mean "a core" I.e in "4 processors" your
 actually mean a quad-core processor or dual-core processor hyper-threaded.


 Could you please clarify this "processor" thing in term of typical
 machine configuration ?

>>>
>>> No, it's about the number of processors available to the JVM. It's about
>>> what the OS reports.
>>>
>>> https://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html#availableProcessors()
>>>
>>> So for a computer with 2 CPU-slots with 4 cores each with
>>> HyperThreading, it would be 2 * 4 * 2 = 16 processors
>>>
>>>


 On Mon, Oct 12, 2015 at 3:55 AM Viktor Klang 
 wrote:

> Hi Maatary,
>
> On Sun, Oct 11, 2015 at 9:27 PM, Maatary Okouya <
> maatarioko...@gmail.com> wrote:
>
>> Hi,
>>
>> As I understood that the fork-join-executor is the default
>> dispatcher when non is provided when creating the actor system
>> Can someone explain me the following:
>>
>>
>>1. fork-join-executor {
>>2. # Min number of threads to cap factor-based parallelism number
>>to
>>3. parallelism-min = 8
>>4.
>>5. # The parallelism factor is used to determine thread pool size
>>using the
>>6. # following formula: ceil(available processors * factor).
>>Resulting size
>>7. # is then bounded by the parallelism-min and parallelism-max
>>values.
>>8. parallelism-factor = 3.0
>>9.
>>10. # Max number of threads to cap factor-based parallelism
>>number to
>>11. parallelism-max = 64
>>12.
>>13. # Setting to "FIFO" to use queue like peeking mode which
>>"poll" or "LIFO" to use stack
>>14. # like peeking mode which "pop".
>>15. task-peeking-mode = "FIFO"
>>16. }
>>
>>
>> ALthough i understand each word, i don't understand the full semantic
>> of what is explained here.
>>
>>
>> - What does mean ceil ? in ceil(available processors * factor)
>>
>
> In short: "Rounded up":
> https://www.google.se/search?q=ceil
>
>
>> - What means factor-based parallelism ?
>>
>
> It means that the factor given in "parallelism-factor" will be what
> the available number of processors will be multiplied with.
>
> Scenario:
>
> available processors = 4
> parallelism-factor = 0.6
>
> ceil(4 * 0.6) == 3
>
> this means that the resulting desired parallelism is 3
>
> Does that make sense?
>
>
>>
>> Can someone overall explain to me in english what means the
>> configuration above. By reading many post here and there, i had somewhat
>> understood that by default, akka, would set up a threadPoolexecutor that
>> allocate and thread per core. Hence if you have 2 two core processor, you
>> would end up with 4 threads. Which is how much parallel you can really be
>> anyway. Above that it is concurrent but not full strictly speaking
>> parallel. Although that is another issue.
>>
>>
>> So if someone could explain the above configuration in term of
>> processor and core and the resulting number of threads with 2 examples of
>> machine (per their processor configurati

Re: [akka-user] Explaining AKKA Thread Pool Execturor Config parameters

2015-10-12 Thread Maatary Okouya
Just to be clear, the meaning of parallelism is not stricto sensus. In
other words, when i think  parallelism, i think parallel execution. While
given that we are not at 1 thread per OS reported processor, but 3, i
conclude that this is more like a concurrency factor. I mean concurrent is
not parallel.  That was the my original confusion i.e. understanding what
is meant by parallelism here.

But i guess this is parallel in the loose sense, as in scala parallel
collection. They can be fully operated in parallel but r actually operated
concurrently.

I just wanted to be clear on the semantic? Is my understanding right ? We
are talking of parallelism in a loose sense and not stricto sensus.

On Mon, Oct 12, 2015 at 6:26 AM, Maatary Okouya 
wrote:

> Understood, Many thanks.
>
> On Mon, Oct 12, 2015 at 6:08 AM, Viktor Klang 
> wrote:
>
>>
>>
>> On Mon, Oct 12, 2015 at 12:00 PM, Maatary Okouya > > wrote:
>>
>>> Thank you victor.
>>>
>>> However,
>>>
>>> 1 - does it means that akka configuration is not related to the number
>>> of cores but the processor only ? So wether your processor has two cores or
>>> 4 cores or just 1, is not taken into account at all, i.e. in deciding how
>>> much thread you would allocate in your thread pool?
>>>
>>>
>> Or
>>>
>>> 2 - by processor u actually mean "a core" I.e in "4 processors" your
>>> actually mean a quad-core processor or dual-core processor hyper-threaded.
>>>
>>>
>>> Could you please clarify this "processor" thing in term of typical
>>> machine configuration ?
>>>
>>
>> No, it's about the number of processors available to the JVM. It's about
>> what the OS reports.
>>
>> https://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html#availableProcessors()
>>
>> So for a computer with 2 CPU-slots with 4 cores each with HyperThreading,
>> it would be 2 * 4 * 2 = 16 processors
>>
>>
>>>
>>>
>>> On Mon, Oct 12, 2015 at 3:55 AM Viktor Klang 
>>> wrote:
>>>
 Hi Maatary,

 On Sun, Oct 11, 2015 at 9:27 PM, Maatary Okouya <
 maatarioko...@gmail.com> wrote:

> Hi,
>
> As I understood that the fork-join-executor is the default dispatcher
> when non is provided when creating the actor system
> Can someone explain me the following:
>
>
>1. fork-join-executor {
>2. # Min number of threads to cap factor-based parallelism number
>to
>3. parallelism-min = 8
>4.
>5. # The parallelism factor is used to determine thread pool size
>using the
>6. # following formula: ceil(available processors * factor).
>Resulting size
>7. # is then bounded by the parallelism-min and parallelism-max
>values.
>8. parallelism-factor = 3.0
>9.
>10. # Max number of threads to cap factor-based parallelism number
>to
>11. parallelism-max = 64
>12.
>13. # Setting to "FIFO" to use queue like peeking mode which
>"poll" or "LIFO" to use stack
>14. # like peeking mode which "pop".
>15. task-peeking-mode = "FIFO"
>16. }
>
>
> ALthough i understand each word, i don't understand the full semantic
> of what is explained here.
>
>
> - What does mean ceil ? in ceil(available processors * factor)
>

 In short: "Rounded up":
 https://www.google.se/search?q=ceil


> - What means factor-based parallelism ?
>

 It means that the factor given in "parallelism-factor" will be what
 the available number of processors will be multiplied with.

 Scenario:

 available processors = 4
 parallelism-factor = 0.6

 ceil(4 * 0.6) == 3

 this means that the resulting desired parallelism is 3

 Does that make sense?


>
> Can someone overall explain to me in english what means the
> configuration above. By reading many post here and there, i had somewhat
> understood that by default, akka, would set up a threadPoolexecutor that
> allocate and thread per core. Hence if you have 2 two core processor, you
> would end up with 4 threads. Which is how much parallel you can really be
> anyway. Above that it is concurrent but not full strictly speaking
> parallel. Although that is another issue.
>
>
> So if someone could explain the above configuration in term of
> processor and core and the resulting number of threads with 2 examples of
> machine (per their processor configuration) that would be great.
>
> --
> >> 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 e

Re: [akka-user] Explaining AKKA Thread Pool Execturor Config parameters

2015-10-12 Thread Viktor Klang
Happy hAkking!

On Mon, Oct 12, 2015 at 12:26 PM, Maatary Okouya 
wrote:

> Understood, Many thanks.
>
> On Mon, Oct 12, 2015 at 6:08 AM, Viktor Klang 
> wrote:
>
>>
>>
>> On Mon, Oct 12, 2015 at 12:00 PM, Maatary Okouya > > wrote:
>>
>>> Thank you victor.
>>>
>>> However,
>>>
>>> 1 - does it means that akka configuration is not related to the number
>>> of cores but the processor only ? So wether your processor has two cores or
>>> 4 cores or just 1, is not taken into account at all, i.e. in deciding how
>>> much thread you would allocate in your thread pool?
>>>
>>>
>> Or
>>>
>>> 2 - by processor u actually mean "a core" I.e in "4 processors" your
>>> actually mean a quad-core processor or dual-core processor hyper-threaded.
>>>
>>>
>>> Could you please clarify this "processor" thing in term of typical
>>> machine configuration ?
>>>
>>
>> No, it's about the number of processors available to the JVM. It's about
>> what the OS reports.
>>
>> https://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html#availableProcessors()
>>
>> So for a computer with 2 CPU-slots with 4 cores each with HyperThreading,
>> it would be 2 * 4 * 2 = 16 processors
>>
>>
>>>
>>>
>>> On Mon, Oct 12, 2015 at 3:55 AM Viktor Klang 
>>> wrote:
>>>
 Hi Maatary,

 On Sun, Oct 11, 2015 at 9:27 PM, Maatary Okouya <
 maatarioko...@gmail.com> wrote:

> Hi,
>
> As I understood that the fork-join-executor is the default dispatcher
> when non is provided when creating the actor system
> Can someone explain me the following:
>
>
>1. fork-join-executor {
>2. # Min number of threads to cap factor-based parallelism number
>to
>3. parallelism-min = 8
>4.
>5. # The parallelism factor is used to determine thread pool size
>using the
>6. # following formula: ceil(available processors * factor).
>Resulting size
>7. # is then bounded by the parallelism-min and parallelism-max
>values.
>8. parallelism-factor = 3.0
>9.
>10. # Max number of threads to cap factor-based parallelism number
>to
>11. parallelism-max = 64
>12.
>13. # Setting to "FIFO" to use queue like peeking mode which
>"poll" or "LIFO" to use stack
>14. # like peeking mode which "pop".
>15. task-peeking-mode = "FIFO"
>16. }
>
>
> ALthough i understand each word, i don't understand the full semantic
> of what is explained here.
>
>
> - What does mean ceil ? in ceil(available processors * factor)
>

 In short: "Rounded up":
 https://www.google.se/search?q=ceil


> - What means factor-based parallelism ?
>

 It means that the factor given in "parallelism-factor" will be what
 the available number of processors will be multiplied with.

 Scenario:

 available processors = 4
 parallelism-factor = 0.6

 ceil(4 * 0.6) == 3

 this means that the resulting desired parallelism is 3

 Does that make sense?


>
> Can someone overall explain to me in english what means the
> configuration above. By reading many post here and there, i had somewhat
> understood that by default, akka, would set up a threadPoolexecutor that
> allocate and thread per core. Hence if you have 2 two core processor, you
> would end up with 4 threads. Which is how much parallel you can really be
> anyway. Above that it is concurrent but not full strictly speaking
> parallel. Although that is another issue.
>
>
> So if someone could explain the above configuration in term of
> processor and core and the resulting number of threads with 2 examples of
> machine (per their processor configuration) that would be great.
>
> --
> >> 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 a topic in the
 Google Groups "Akka User List" group.

Re: [akka-user] Explaining AKKA Thread Pool Execturor Config parameters

2015-10-12 Thread Maatary Okouya
Understood, Many thanks.

On Mon, Oct 12, 2015 at 6:08 AM, Viktor Klang 
wrote:

>
>
> On Mon, Oct 12, 2015 at 12:00 PM, Maatary Okouya 
> wrote:
>
>> Thank you victor.
>>
>> However,
>>
>> 1 - does it means that akka configuration is not related to the number of
>> cores but the processor only ? So wether your processor has two cores or 4
>> cores or just 1, is not taken into account at all, i.e. in deciding how
>> much thread you would allocate in your thread pool?
>>
>>
> Or
>>
>> 2 - by processor u actually mean "a core" I.e in "4 processors" your
>> actually mean a quad-core processor or dual-core processor hyper-threaded.
>>
>>
>> Could you please clarify this "processor" thing in term of typical
>> machine configuration ?
>>
>
> No, it's about the number of processors available to the JVM. It's about
> what the OS reports.
>
> https://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html#availableProcessors()
>
> So for a computer with 2 CPU-slots with 4 cores each with HyperThreading,
> it would be 2 * 4 * 2 = 16 processors
>
>
>>
>>
>> On Mon, Oct 12, 2015 at 3:55 AM Viktor Klang 
>> wrote:
>>
>>> Hi Maatary,
>>>
>>> On Sun, Oct 11, 2015 at 9:27 PM, Maatary Okouya >> > wrote:
>>>
 Hi,

 As I understood that the fork-join-executor is the default dispatcher
 when non is provided when creating the actor system
 Can someone explain me the following:


1. fork-join-executor {
2. # Min number of threads to cap factor-based parallelism number to
3. parallelism-min = 8
4.
5. # The parallelism factor is used to determine thread pool size
using the
6. # following formula: ceil(available processors * factor).
Resulting size
7. # is then bounded by the parallelism-min and parallelism-max
values.
8. parallelism-factor = 3.0
9.
10. # Max number of threads to cap factor-based parallelism number
to
11. parallelism-max = 64
12.
13. # Setting to "FIFO" to use queue like peeking mode which "poll"
or "LIFO" to use stack
14. # like peeking mode which "pop".
15. task-peeking-mode = "FIFO"
16. }


 ALthough i understand each word, i don't understand the full semantic
 of what is explained here.


 - What does mean ceil ? in ceil(available processors * factor)

>>>
>>> In short: "Rounded up":
>>> https://www.google.se/search?q=ceil
>>>
>>>
 - What means factor-based parallelism ?

>>>
>>> It means that the factor given in "parallelism-factor" will be what the
>>> available number of processors will be multiplied with.
>>>
>>> Scenario:
>>>
>>> available processors = 4
>>> parallelism-factor = 0.6
>>>
>>> ceil(4 * 0.6) == 3
>>>
>>> this means that the resulting desired parallelism is 3
>>>
>>> Does that make sense?
>>>
>>>

 Can someone overall explain to me in english what means the
 configuration above. By reading many post here and there, i had somewhat
 understood that by default, akka, would set up a threadPoolexecutor that
 allocate and thread per core. Hence if you have 2 two core processor, you
 would end up with 4 threads. Which is how much parallel you can really be
 anyway. Above that it is concurrent but not full strictly speaking
 parallel. Although that is another issue.


 So if someone could explain the above configuration in term of
 processor and core and the resulting number of threads with 2 examples of
 machine (per their processor configuration) that would be great.

 --
 >> 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 a topic in the
>>> Google Groups "Akka User List" group.
>>> To unsubscribe from this topic, visit
>>> https://groups.google.com/d/topic/akka-user/eR4fShuWm6w/unsubscribe.
>>> To unsubscribe from this group and all its topics, send an email to
>>> akka-user+unsubscr...@googlegroups.com.
>>> To post to this group, send emai

Re: [akka-user] Explaining AKKA Thread Pool Execturor Config parameters

2015-10-12 Thread Viktor Klang
On Mon, Oct 12, 2015 at 12:00 PM, Maatary Okouya 
wrote:

> Thank you victor.
>
> However,
>
> 1 - does it means that akka configuration is not related to the number of
> cores but the processor only ? So wether your processor has two cores or 4
> cores or just 1, is not taken into account at all, i.e. in deciding how
> much thread you would allocate in your thread pool?
>
>
Or
>
> 2 - by processor u actually mean "a core" I.e in "4 processors" your
> actually mean a quad-core processor or dual-core processor hyper-threaded.
>
>
> Could you please clarify this "processor" thing in term of typical machine
> configuration ?
>

No, it's about the number of processors available to the JVM. It's about
what the OS reports.
https://docs.oracle.com/javase/7/docs/api/java/lang/Runtime.html#availableProcessors()

So for a computer with 2 CPU-slots with 4 cores each with HyperThreading,
it would be 2 * 4 * 2 = 16 processors


>
>
> On Mon, Oct 12, 2015 at 3:55 AM Viktor Klang 
> wrote:
>
>> Hi Maatary,
>>
>> On Sun, Oct 11, 2015 at 9:27 PM, Maatary Okouya 
>> wrote:
>>
>>> Hi,
>>>
>>> As I understood that the fork-join-executor is the default dispatcher
>>> when non is provided when creating the actor system
>>> Can someone explain me the following:
>>>
>>>
>>>1. fork-join-executor {
>>>2. # Min number of threads to cap factor-based parallelism number to
>>>3. parallelism-min = 8
>>>4.
>>>5. # The parallelism factor is used to determine thread pool size
>>>using the
>>>6. # following formula: ceil(available processors * factor).
>>>Resulting size
>>>7. # is then bounded by the parallelism-min and parallelism-max
>>>values.
>>>8. parallelism-factor = 3.0
>>>9.
>>>10. # Max number of threads to cap factor-based parallelism number to
>>>11. parallelism-max = 64
>>>12.
>>>13. # Setting to "FIFO" to use queue like peeking mode which "poll"
>>>or "LIFO" to use stack
>>>14. # like peeking mode which "pop".
>>>15. task-peeking-mode = "FIFO"
>>>16. }
>>>
>>>
>>> ALthough i understand each word, i don't understand the full semantic of
>>> what is explained here.
>>>
>>>
>>> - What does mean ceil ? in ceil(available processors * factor)
>>>
>>
>> In short: "Rounded up":
>> https://www.google.se/search?q=ceil
>>
>>
>>> - What means factor-based parallelism ?
>>>
>>
>> It means that the factor given in "parallelism-factor" will be what the
>> available number of processors will be multiplied with.
>>
>> Scenario:
>>
>> available processors = 4
>> parallelism-factor = 0.6
>>
>> ceil(4 * 0.6) == 3
>>
>> this means that the resulting desired parallelism is 3
>>
>> Does that make sense?
>>
>>
>>>
>>> Can someone overall explain to me in english what means the
>>> configuration above. By reading many post here and there, i had somewhat
>>> understood that by default, akka, would set up a threadPoolexecutor that
>>> allocate and thread per core. Hence if you have 2 two core processor, you
>>> would end up with 4 threads. Which is how much parallel you can really be
>>> anyway. Above that it is concurrent but not full strictly speaking
>>> parallel. Although that is another issue.
>>>
>>>
>>> So if someone could explain the above configuration in term of processor
>>> and core and the resulting number of threads with 2 examples of machine
>>> (per their processor configuration) that would be great.
>>>
>>> --
>>> >> 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 a topic in the
>> Google Groups "Akka User List" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/akka-user/eR4fShuWm6w/unsubscribe.
>> To unsubscribe from this group and all its topics, 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.
>>
> --
> >> Read the docs: http://akka.io/docs/
> >> Check the FAQ:
> http://doc

Re: [akka-user] Explaining AKKA Thread Pool Execturor Config parameters

2015-10-12 Thread Maatary Okouya
Thank you victor.

However,

1 - does it means that akka configuration is not related to the number of
cores but the processor only ? So wether your processor has two cores or 4
cores or just 1, is not taken into account at all, i.e. in deciding how
much thread you would allocate in your thread pool?

Or

2 - by processor u actually mean "a core" I.e in "4 processors" your
actually mean a quad-core processor or dual-core processor hyper-threaded.


Could you please clarify this "processor" thing in term of typical machine
configuration ?


On Mon, Oct 12, 2015 at 3:55 AM Viktor Klang  wrote:

> Hi Maatary,
>
> On Sun, Oct 11, 2015 at 9:27 PM, Maatary Okouya 
> wrote:
>
>> Hi,
>>
>> As I understood that the fork-join-executor is the default dispatcher
>> when non is provided when creating the actor system
>> Can someone explain me the following:
>>
>>
>>1. fork-join-executor {
>>2. # Min number of threads to cap factor-based parallelism number to
>>3. parallelism-min = 8
>>4.
>>5. # The parallelism factor is used to determine thread pool size
>>using the
>>6. # following formula: ceil(available processors * factor).
>>Resulting size
>>7. # is then bounded by the parallelism-min and parallelism-max
>>values.
>>8. parallelism-factor = 3.0
>>9.
>>10. # Max number of threads to cap factor-based parallelism number to
>>11. parallelism-max = 64
>>12.
>>13. # Setting to "FIFO" to use queue like peeking mode which "poll"
>>or "LIFO" to use stack
>>14. # like peeking mode which "pop".
>>15. task-peeking-mode = "FIFO"
>>16. }
>>
>>
>> ALthough i understand each word, i don't understand the full semantic of
>> what is explained here.
>>
>>
>> - What does mean ceil ? in ceil(available processors * factor)
>>
>
> In short: "Rounded up":
> https://www.google.se/search?q=ceil
>
>
>> - What means factor-based parallelism ?
>>
>
> It means that the factor given in "parallelism-factor" will be what the
> available number of processors will be multiplied with.
>
> Scenario:
>
> available processors = 4
> parallelism-factor = 0.6
>
> ceil(4 * 0.6) == 3
>
> this means that the resulting desired parallelism is 3
>
> Does that make sense?
>
>
>>
>> Can someone overall explain to me in english what means the configuration
>> above. By reading many post here and there, i had somewhat understood that
>> by default, akka, would set up a threadPoolexecutor that allocate and
>> thread per core. Hence if you have 2 two core processor, you would end up
>> with 4 threads. Which is how much parallel you can really be anyway. Above
>> that it is concurrent but not full strictly speaking parallel. Although
>> that is another issue.
>>
>>
>> So if someone could explain the above configuration in term of processor
>> and core and the resulting number of threads with 2 examples of machine
>> (per their processor configuration) that would be great.
>>
>> --
>> >> 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 a topic in the
> Google Groups "Akka User List" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/akka-user/eR4fShuWm6w/unsubscribe.
> To unsubscribe from this group and all its topics, 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.
>

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

Re: [akka-user] Combine FSM[S, D] and DiagnosticActorLogging

2015-10-12 Thread Michael Zinsmaier
Hi Patrik,

I tried your suggestion, unfortunately I get the same compile time error )-:

object FSMDoubleExtendDemo {

  def props(name: String): Props = Props(new FSMDoubleExtendDemo())

  sealed trait Params

  case object Empty extends Params

  sealed trait State

  case object State1 extends State

  case object State2 extends State

}

class FSMDoubleExtendDemo extends Actor with FSM[State, Params] with 
DiagnosticActorLogging {
  log.debug("startup")
}

class TestRunner extends CCPBaseLoggingTest with BeforeAndAfterAll {

  implicit val system = createActorSystem

  @Test(groups = Array("demo"))
  def createFSM(): Unit = {
EventFilter.debug(message = "startup", occurrences = 1) intercept {
  system.actorOf(FSMDoubleExtendDemo.props("testStartupMessage"))
}
  }
}


any other ideas?

Best Michael  (and sorry for the long delay!)

-- 
>>  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] Explaining AKKA Thread Pool Execturor Config parameters

2015-10-12 Thread Viktor Klang
Hi Maatary,

On Sun, Oct 11, 2015 at 9:27 PM, Maatary Okouya 
wrote:

> Hi,
>
> As I understood that the fork-join-executor is the default dispatcher
> when non is provided when creating the actor system
> Can someone explain me the following:
>
>
>1. fork-join-executor {
>2. # Min number of threads to cap factor-based parallelism number to
>3. parallelism-min = 8
>4.
>5. # The parallelism factor is used to determine thread pool size
>using the
>6. # following formula: ceil(available processors * factor). Resulting
>size
>7. # is then bounded by the parallelism-min and parallelism-max values.
>8. parallelism-factor = 3.0
>9.
>10. # Max number of threads to cap factor-based parallelism number to
>11. parallelism-max = 64
>12.
>13. # Setting to "FIFO" to use queue like peeking mode which "poll" or
>"LIFO" to use stack
>14. # like peeking mode which "pop".
>15. task-peeking-mode = "FIFO"
>16. }
>
>
> ALthough i understand each word, i don't understand the full semantic of
> what is explained here.
>
>
> - What does mean ceil ? in ceil(available processors * factor)
>

In short: "Rounded up":
https://www.google.se/search?q=ceil


> - What means factor-based parallelism ?
>

It means that the factor given in "parallelism-factor" will be what the
available number of processors will be multiplied with.

Scenario:

available processors = 4
parallelism-factor = 0.6

ceil(4 * 0.6) == 3

this means that the resulting desired parallelism is 3

Does that make sense?


>
> Can someone overall explain to me in english what means the configuration
> above. By reading many post here and there, i had somewhat understood that
> by default, akka, would set up a threadPoolexecutor that allocate and
> thread per core. Hence if you have 2 two core processor, you would end up
> with 4 threads. Which is how much parallel you can really be anyway. Above
> that it is concurrent but not full strictly speaking parallel. Although
> that is another issue.
>
>
> So if someone could explain the above configuration in term of processor
> and core and the resulting number of threads with 2 examples of machine
> (per their processor configuration) that would be great.
>
> --
> >> 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.