pjfanning opened a new pull request, #2786:
URL: https://github.com/apache/pekko/pull/2786

   part of #2730 
   
   ports akka/akka-core#31836
   
   With `rememberEntities` enabled and `entity-recovery-strategy = constant`, 
each shard spawned its own `RememberEntityStarter` with independent throttling 
timers. With many shards starting simultaneously (typical at restart), all 
starters ran concurrently — making the per-shard rate limit effectively 
meaningless and creating a thundering herd.
   
   ## Changes
   
   - **`RememberEntityStarter.scala`**: Introduces 
`RememberEntityStarterManager` — a new per-region actor that serializes shard 
startup under the `constant` strategy (one shard at a time, with 
`entityRecoveryConstantRateStrategyFrequency` delay between shards). The `all` 
strategy retains existing behavior. `RememberEntityStarter` now accepts 
`isConstantStrategy: Boolean` from the manager instead of re-reading settings.
   
   - **`Shard.scala`**: `onEntitiesRemembered` now sends 
`RememberEntityStarterManager.StartEntities` to `context.parent` (the region) 
instead of directly spawning a `RememberEntityStarter`.
   
   - **`ShardRegion.scala`**: Creates `RememberEntityStarterManager` as a child 
when `rememberEntities` is enabled; routes `StartEntities` messages from shards 
to the manager.
   
   - **`RememberEntitiesStarterSpec`**: Updated existing tests for new 
`isConstantStrategy` param; added tests for `RememberEntityStarterManager` 
covering both strategies.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to