Skip to content

feat(autoscaling): Make autoscaling load signals pluggable - #2359

Open
Mantisus wants to merge 6 commits into
apify:v2from
Mantisus:autoscaling-signals
Open

Mantisus wants to merge 6 commits into
apify:v2from
Mantisus:autoscaling-signals

Conversation

@Mantisus

@Mantisus Mantisus commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

Description

  • The ConcurrencySystem now decides whether the machine is overloaded through load signals that you can tune, switch off or extend with your own.

  • The new load_signals option takes LoadSignalsOptions, with options for each built-in signal (memory, event loop, CPU and storage client), False to switch one off, and custom for signals of your own.

  • The built-in signals are public classes (MemoryLoadSignal, EventLoopLoadSignal, CpuLoadSignal, StorageClientLoadSignal), so you can wrap one instead of reimplementing it. A custom signal matches the LoadSignal protocol, and SnapshotStore keeps its snapshots for the sampled window.

  • The two evaluation windows, current_history (5 s) and snapshot_history (30 s), are options of the ConcurrencySystem and apply to every signal. Each signal is told on start which window it's sampled over and which Configuration to read its limits from.

  • A duplicate signal name raises ValueError.

  • SystemInfo reports custom signals in load_signal_info, and client_info is renamed to storage_client_info.

  • Configuration.max_client_errors now defaults to 3, the same as Crawlee JS.

The new "Load signals" section of the scaling guide shows how to switch a signal off, write your own and wrap a built-in one.

Issues

✍️ Drafted by Claude Code

@Mantisus Mantisus self-assigned this Oct 27, 2026
@github-actions github-actions Bot added the t-tooling Issues with this label are in the ownership of the tooling team. label Oct 27, 2026
@Mantisus
Mantisus requested review from Pijukatel and vdusek October 27, 2026 20:01
@Mantisus
Mantisus force-pushed the autoscaling-signals branch from adcbf8e to 92e417a Compare October 27, 2026 20:28
Comment thread src/crawlee/autoscaling/__init__.py
Comment thread src/crawlee/autoscaling/_load_signal.py Outdated
Comment thread src/crawlee/autoscaling/_load_signal.py Outdated
Comment thread src/crawlee/autoscaling/_snapshotter.py Outdated
Comment thread src/crawlee/autoscaling/_types.py Outdated
Comment thread src/crawlee/autoscaling/_cpu_load_signal.py Outdated
@Mantisus
Mantisus force-pushed the autoscaling-signals branch from 2455ca9 to b1177b6 Compare October 28, 2026 15:02

@vdusek vdusek left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A three more minor comments. Otherwise LGTM.

Comment thread src/crawlee/autoscaling/_event_loop_load_signal.py
Comment thread src/crawlee/autoscaling/_storage_client_load_signal.py
Comment thread src/crawlee/autoscaling/_system_status.py Outdated
Mantisus and others added 2 commits October 29, 2026 14:27

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants