Giter Club home page Giter Club logo

Comments (3)

sclasen avatar sclasen commented on August 17, 2024

Hi @tarmath

If your processing actor(s)are parallelizable, then the actorRef you use with akka-kafka could certainly be a Router backed by several underlying processor actors.

Akka benchmarks show that a single actor can process 10s of millions of messages per second (at least), so you have to be going pretty fast to botteneck there.

In many cases you will want to have a single actor that manages some state. Imagine the simplest case where your processing actor simply counts messages recieved var count:Int = 0. Using a single actor here makes the problem trivial. (Correctly) aggreagting state across a set of processing actors to calculate the total count is less so.

Make sense?

That said, I have considered having a way to allow for specifying a processing actor per StreamFSM to allow for ordered processing (where each processing actor will see the messages in order from the stream/kafka partition(s) it is associated with)

from akka-kafka.

tarmath avatar tarmath commented on August 17, 2024

Using a router would certainly solve my problem here, though it also sounds a little less "parallel" to me, as there is only one router taking in the messages from multiple StreamFSM. At any rate, and as you mentioned, it would take a lot of messages for the router to be overwhelmed while I can create more processors as needed, which is really where the slow processing happens (not due to akka but to the nature of my problem).

As for the issue where you would need to count the messages received, wouldn't that work trivially if you declare streams = 1 since you don't want parallelism in your receiver anyway? I guess I don't see the advantage of using multiple StreamFSM if it all ends up in the same Receiver? Doesn't it break the idea that having multiple Kafka streams is typically needed when the processing is parallelizable?

Finally, if you do end up making it possible to have a processing Actor per Stream, I would definitively use that feature!

Thanks again for your quick feedback and your suggestion!

from akka-kafka.

sclasen avatar sclasen commented on August 17, 2024

@tarmath one thing to note about number of streams...

If your consumer has less streams (in aggregate across the consumer group) than the number of partitions in the topic, then the underlying kafka consumer won't be receiving messages from all topics, but will instead switch the set of partitions it is consuming from every 10 minutes (by default)

There is more doc on that behavior (if you look closely enough ;). At the kafka website

from akka-kafka.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.