Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion bottlecap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Lambda Managed Instances run your functions on EC2 instances (managed by AWS) wi
#### `End`
- **Configuration**: `DD_SERVERLESS_FLUSH_STRATEGY=end`
- **Behavior**: Always flushes at the end of each invocation (blocking)
- **Interval**: 15 minutes (effectively disables periodic flushing)
- **Interval**: 30 minutes, the maximum on-demand Lambda timeout (effectively disables periodic flushing)
- **Use case**: Minimize flushing overhead - only flush once per invocation when the invocation is complete

#### `EndPeriodically`
Expand Down
2 changes: 1 addition & 1 deletion bottlecap/src/bin/bottlecap-test-mode/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ async fn shutdown_signal() -> anyhow::Result<()> {

/// Spawns the periodic flush driver. Decoupled from managed-instance mode: any
/// non-Default strategy enables it, using that strategy's interval. Note that
/// `end` yields the 15-minute placeholder interval `FlushControl` uses to mean
/// `end` yields the 30-minute placeholder interval `FlushControl` uses to mean
/// "never race a flush", so it is periodic only in name. Manual flushing via
/// `POST /flush` always works regardless.
fn spawn_periodic_flush(
Expand Down
10 changes: 5 additions & 5 deletions bottlecap/src/lifecycle/flush_control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::lifecycle::invocation_times::InvocationTimes;

const DEFAULT_FLUSH_INTERVAL: u64 = 60 * 1000; // 60s
pub const DEFAULT_CONTINUOUS_FLUSH_INTERVAL: u64 = 30 * 1000; // 30s
const FIFTEEN_MINUTES: u64 = 15 * 60 * 1000;
const THIRTY_MINUTES: u64 = 30 * 60 * 1000;

#[derive(Clone, Copy, Debug, PartialEq)]
pub struct FlushControl {
Expand Down Expand Up @@ -58,9 +58,9 @@ impl FlushControl {
i
}
FlushStrategy::End => {
// Set the race flush interval to the maximum value of Lambda timeout, so flush will
// only happen at the end of the invocation, and race flush will never happen.
tokio::time::interval(tokio::time::Duration::from_millis(FIFTEEN_MINUTES))
// Set the race flush interval to the maximum Lambda timeout in on-demand mode, the
// only mode that uses `End`, so flush will only happen at the end of the invocation.
tokio::time::interval(tokio::time::Duration::from_millis(THIRTY_MINUTES))
}
}
}
Expand Down Expand Up @@ -208,7 +208,7 @@ mod tests {
let flush_control = FlushControl::new(FlushStrategy::End, 60);
assert_eq!(
flush_control.get_flush_interval().period().as_millis(),
tokio::time::Duration::from_millis(FIFTEEN_MINUTES).as_millis()
tokio::time::Duration::from_millis(THIRTY_MINUTES).as_millis()
);
}
}
Loading