Skip to content

Commit

Permalink
Spread out realtime updates evenly (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
jamespfennell committed Aug 5, 2023
1 parent 6412ba9 commit bdef699
Show file tree
Hide file tree
Showing 5 changed files with 383 additions and 322 deletions.
13 changes: 13 additions & 0 deletions api/admin.proto
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,19 @@ message FeedConfig {
// If unspecified, defaults to 5 seconds.
optional int64 periodic_update_period_ms = 10;

// For feeds with a `PERIODIC` scheduling policy, the offset.
//
// The periodic schedulers for all of a system's realtime feeds are started at the same time.
// For each feed, the offset is the amount of time to wait before performing the first update.
// The idea is to provide each realtime feed with a different offset so that updates for
// for different feeds happen at different times.
// This makes Transiter less bursty, and also reduces the chances
// of conflicts between concurrent feed updates.
//
// If unspecified, the offsets are chosen so that the feeds are evently spaced out.
// This algorithm currently assumes that the feed periods are all the same.
optional int64 periodic_update_offset_ms = 15;

// Deprecated: use `periodic_update_period_ms` instead.
optional double update_period_s = 4 [deprecated = true];

Expand Down
1 change: 1 addition & 0 deletions docs/src/api/admin.md
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ No fields.
| scheduling_policy | [FeedConfig.SchedulingPolicy](admin.md#FeedConfig.SchedulingPolicy) | The scheduling policy to use for this feed.<br /><br />If unspecified, it takes the value `DEFAULT``.
| update_strategy | [FeedConfig.SchedulingPolicy](admin.md#FeedConfig.SchedulingPolicy) | Deprecated: use `scheduling_policy` instead.
| periodic_update_period_ms | int64 | For feeds with a `PERIODIC` scheduling policy, the update period.<br /><br />If unspecified, defaults to 5 seconds.
| periodic_update_offset_ms | int64 | For feeds with a `PERIODIC` scheduling policy, the offset.<br /><br />The periodic schedulers for all of a system's realtime feeds are started at the same time. For each feed, the offset is the amount of time to wait before performing the first update. The idea is to provide each realtime feed with a different offset so that updates for for different feeds happen at different times. This makes Transiter less bursty, and also reduces the chances of conflicts between concurrent feed updates.<br /><br />If unspecified, the offsets are chosen so that the feeds are evently spaced out. This algorithm currently assumes that the feed periods are all the same.
| update_period_s | double | Deprecated: use `periodic_update_period_ms` instead.
| daily_update_time | string | For feeds with a `DAILY` scheduling policy, the time of day in the form HH:MM at which to perform an update.<br /><br />If unspecified, defaults to 03:00 for the first feed in the system, 03:10 for the second feed, and so on. The idea of the default is to run at night when the system is either quiet or not running. The staggering is to avoid updates stepping on each other, and to spread out the load.
| daily_update_timezone | string | For feeds with a `DAILY` scheduling policy, the timezone for the time of day specified in the `daily_update_time`.<br /><br />If empty, a default is provided as follows. The scheduler lists the agencies for the system in order of ID and uses the first valid timezone it finds. Given the GTFS static specification this should always work. Moreover, all agencies should have the same timezone so listing in order of ID shouldn't matter. But in reality it may not work. If there is no valid agency timezones, the scheduler will log a warning and fall back to UTC.
Expand Down
Loading

0 comments on commit bdef699

Please sign in to comment.