• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

kubernetes-sigs / inference-perf / 35916861843
81%

Build:
DEFAULT BRANCH: main
Ran 23 Sep 2026 08:41PM UTC
Jobs 1
Files 125
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

23 Sep 2026 08:34PM UTC coverage: 80.601% (-0.2%) from 80.763%
35916861843

push

github

web-flow
perf(metrics): optimize multiprocess metric collection (#806)

## What does this PR do?

This PR optimizes multiprocess metric collection in
[`inference_perf/metrics/request_collector/multiprocess.py`](https://github.com/kubernetes-sigs/inference-perf/blob/<a class=hub.com/kubernetes-sigs/inference-perf/commit/<a class="double-link" href="https://git"><a class=hub.com/kubernetes-sigs/inference-perf/commit/8794dc9b8e84cf906377484379ba1b8fcfa3e829">8794dc9b8/inference_perf/metrics/request_collector/multiprocess.py):

1. **Bulk Queue Draining
([`_drain_batch`](https://github.com/kubernetes-sigs/inference-perf/blob/8794dc9b8e84cf906377484379ba1b8fcfa3e829/inference_perf/metrics/request_collector/multiprocess.py#L45-L80))**:
Replaces single-item executor thread calls (`run_in_executor(None,
self.queue.get)`) with a batched drain inside the executor thread (an
initial blocking get with 0.5s timeout followed by non-blocking
`get_nowait()` up to 4,096 items per dispatch).
2. **Batch Queue Ingestion**: Extends the metric list directly via
`batch.extend(...)` and `metrics.extend(batch)`, supporting both
singletons and pre-batched metric lists.
3. **Streamlined Circuit Breaker Feeding**: Feeds metrics to circuit
breakers via `feed_breakers(item)` directly without importing internal
dictionaries.
4. **Unit Test Coverage
([`tests/required/metrics/test_multiprocess_collector.py`](https://github.com/kubernetes-sigs/inference-perf/blob/8794dc9b8e84cf906377484379ba1b8fcfa3e829/tests/required/metrics/test_multiprocess_collector.py))**:
Tests context manager lifecycle, mixed batch and singleton queue
draining, bulk drain capacity, and circuit breaker dispatch using
`unittest.mock.patch.dict`.

## Why is this change needed?

Under high concurrency with multiple worker processes, scheduling an
`event_loop.run_in_executor` invocation for every single metric item
creates a severe asyncio event loop bottleneck:
- **Event loop saturation**: `asyncio._run_once` spent substantial time
dispatching thread pool tasks for individual queue reads, delaying HTTP
request processing and client-side scheduling.
- **Queue polling overhead**: High c... (continued)

15 of 36 new or added lines in 1 file covered. (41.67%)

4 existing lines in 1 file now uncovered.

10454 of 12970 relevant lines covered (80.6%)

0.81 hits per line

Uncovered Changes

Lines Coverage ∆ File
21
59.68
-40.32% inference_perf/metrics/request_collector/multiprocess.py

Coverage Regressions

Lines Coverage ∆ File
4
59.68
-40.32% inference_perf/metrics/request_collector/multiprocess.py
Jobs
ID Job ID Ran Files Coverage
1 35916861843.1 23 Sep 2026 08:41PM UTC 125
80.6
GitHub Action Run
Source Files on build 35916861843
  • Tree
  • List 125
  • Changed 1
  • Source Changed 1
  • Coverage Changed 1
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Repo
  • Github Actions Build #35916861843
  • 16122a32 on github
  • Prev Build on main (#35903410916)
  • Next Build on main (#36037073528)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc