Skip to content

ateapi: scheduling parses every worker's cpu_features on each placement #3924

Open

Description

Problem

When placing a gVisor actor from a MEMORY snapshot, the scheduler checks whether each worker supports all of the snapshot's CPU features. Today, the snapshot's cpu_features hex string is parsed once up front, but every worker's 64-character cpu_features string is re-parsed character by character on every candidate comparison.

In addition, attributes are checked in alphabetical order, so cpu_features is parsed before sandbox_bundle_hash is checked. Workers running a different runtime bundle still pay the cost of parsing cpu_features before getting rejected.

In a 1,000-worker benchmark profile (BenchmarkSchedule/memory-hit), parsing cpu_features accounts for 61% of Schedule CPU on main (42% on #3777).

Proposal

  1. Check exact-match attributes first: Compare attributes like architecture and sandbox_bundle_hash before cpu_features, so mismatched runtimes fail immediately without parsing the CPU mask.
  2. Fast-path identical cpu_features strings: If a worker's cpu_features string equals the snapshot's (already validated), return true right away instead of decoding the hex bitmask. Only fall back to parsing and checking the bitmask subset when the two strings differ (for example, across different CPU generations).

Since nodes on the same CPU platform and runsc build report identical cpu_features strings, most comparisons become a single string check.

Activity

  1. added
    kind/cleanup
    on Nov 18, 2026
  2. abhayjoshi201 commented on Nov 23, 2026

    @abhayjoshi201

    Shrutiya Mohan (@shrutiyam-glitch) I'd like to pick this up if you aren't already on it. Plan is the two steps in the proposal, both in matchesCompat in internal/hardware/hardware.go:

    Compare the exact-match attributes first and cpu_features last.
    Return early when the worker's cpu_features string equals the snapshot's, and only parse the mask when they differ.

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

Metadata

Metadata

Labels

area/lifecyclearea/schedulingkind/cleanup

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions