I’m currently using Akka Persistence w/ the Datastax Cassandra plugin against CosmosDB. I also leverage Akka Persistence Query to create a projection from a Cassandra Read Journal. (see below)
The thing is, running our projections with no new events coming in, I’m seeing ~186 RU/s (approximately, requests/second) against our DB on the akka.tag_views table when the projection is running. I’m running 12 instances of a projection. My tags are “aggregate-slice-{1,12}” naturally. This load seems incredibly high and it feels like the DB is extremely busy. How do I make things more reasonable?
Edit: I’ve narrowed the high load down to query.refresh-interval and backtrack.interval. Why is the default backtrack interval 1 second? That seems pretty frequent in conjunction with polling queries every 2 seconds.
cassandra {
events-by-tag {
bucket-size = "Day"
eventual-consistency-delay = 200ms # i've tinkered with this from 200ms to 5s
flush-interval = 50ms
pubsub-notification = on
first-time-bucket = "20201102T00:00"
gc-grace-seconds = 0
back-track {
interval = 1s
long-interval = 120s
}
}
query {
refresh-interval = 2s
}
SourceProvider<Offset, EventEnvelope<Message>> sourceProvider = EventSourcedProvider
.eventsByTag(
system,
CassandraReadJournal.Identifier(),
tag
);
return CassandraProjection.atLeastOnce(
ProjectionId.of(PROJECTION_NAME, tag),
sourceProvider,
new ProjectionHandler(system, tag, producer)
);