0

I have an Akka Project with Akka Persistence that works perfectly, lately I integrated it with Akka Projections and it works but I have some weird phenomena that I like to ask here.

When I am sending Commands to Akka they are processed and saved at Apache Cassandra (I can see the persisted events) but the Events picked with a delay between 5 to 10 minutes by Akka Projections.

Now I could not see in the documentation any word about Akka Projections working model about that it is a push or pull model. So is Akka Projections polling the Cassandra Journal or somehow pushed.

If it is pull model, is there a configuration parameter that I can with which interval Akka Projections should poll the Casandra Journal.

Any ideas?

Levi Ramsey
  • 18,884
  • 1
  • 16
  • 30
posthumecaver
  • 1,584
  • 4
  • 16
  • 29

1 Answers1

0

Akka Projections is built on top of Akka Persistence Query and generally relies on the events by tag query. The relevant options which would come into play here are covered in the docs for Akka Persistence Cassandra's events by tag query. The events-by-tag query which is feeding the Projection works on the pull model (though some metadata can be updated on a push model, e.g. if akka.persistence.cassandra.events-by-tag.pubsub-notification is set to on in the writer).

The 15 minute delay doesn't immediately scream out anything, unless this is the first time starting the projection, as the default akka.persistence.cassandra.events-by-tag.first-time-bucket and akka.persistence.cassandra.bucket-size values will cause the query to iterate through every hour since November, 2015. bucket-size can't be changed once data has been written, but the first-time-bucket can be set to a time not too soon before the earliest date the application was started.

A Projection should be saving offsets as it makes progress, so once a projection catches up, it should stay caught up (and not be doing that scan from 2015). If you're starting Projections on demand, I'd consider revisiting that decision (e.g. having a long-lived Projection for a given tag which publishes the events to Kafka).

Beyond that, I'd look at how well your Cassandra is performing. This delay might be caused by an excessive number of retries of the query: akka.persistence.cassandra.verbose-debug-logging = true in the config might shed some light.

Levi Ramsey
  • 18,884
  • 1
  • 16
  • 30