Skip to content

Detection costs more CPU per request in 4.4.0 than in 4.3.x #172

Closed

Description

@rennf93

Since 4.4.0 every request costs noticeably more CPU, even when requests run one at a time. On a realistic POST (JSON body, browser headers, a bearer token) I measured about 209 ms of CPU per request on 4.4.0 against about 148 ms on 4.3.1, with the same number of pattern checks. The per-request scan time budget reads the thread CPU clock twice and enters a context manager for every pattern check (about 57k clock reads per request), and the 2 ms event-loop slice restarts for every scanned value, so it rarely fires and responsiveness comes from per-pattern thread pool round trips instead. Separately, the performance monitor recomputes the variance with a per-element Python loop on every pattern check and sanitizes anomalies even when no callback is registered. I am charging the budget once per pass with a request-scoped slice and making the monitor statistics cheaper, without changing any detection result.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: detection-engineTouches guard_core/detection_engine/bugConfirmed defect

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions