18 Commits

Author SHA1 Message Date
Qi
7dd4d8a30e
runtime: cleanup legacy tests of alt multi-threaded runtime (#7451)
Signed-off-by: ADD-SP <qiqi.zhang@konghq.com>
2025-07-09 19:52:33 +08:00
Motoyuki Kimura
a258bff701
ci: enable printing in multi thread loom tests (#7200) 2025-03-07 13:33:16 +01:00
Taiki Endo
d6ba535ceb
ci: update actions/checkout action to v4 (#6272) 2024-01-06 20:30:28 +09:00
Carl Lerche
dd23f08c3a
rt(alt): fix memory leak and increase max preemption when running Loom CI tests (#5911)
The memory leak was caused by a bug during shutdown where some state was leaked.
2023-08-10 09:18:10 -07:00
Taiki Endo
e5e88551d2
Update CI config (#5893) 2023-08-02 01:04:11 +09:00
Carl Lerche
4165601b1b
rt: initial implementation of new threaded runtime (#5823)
This patch includes an initial implementation of a new multi-threaded
runtime. The new runtime aims to increase the scheduler throughput by
speeding up how it dispatches work to peer worker threads. This
implementation improves most benchmarks by about ~10% when the number of
threads is below 16. As threads increase, mutex contention deteriorates
performance.

Because the new scheduler is not yet ready to replace the old one, the
patch introduces it as an unstable runtime flavor with a warning that it
isn't production ready. Work to improve the scalability of the runtime
will most likely require more intrusive changes across Tokio, so I am
opting to merge with master to avoid larger conflicts.
2023-07-21 11:56:34 -07:00
Carl Lerche
98c8c38e96
ci: speed up multi-threaded runtime loom tests. (#5723)
Increase max preemption back to 2 while running the tests in under 90 minutes.
2023-05-27 16:34:59 -07:00
Carl Lerche
9eb3f5b556
rt(threaded): cap LIFO slot polls (#5712)
As an optimization to improve locality, the multi-threaded scheduler
maintains a single slot (LIFO slot). When a task is scheduled, it goes
into the LIFO slot. The scheduler will run tasks in the LIFO slot first
before checking the local queue.

Ping-ping style workloads where task A notifies task B, which
notifies task A again, can cause starvation as these two tasks 
repeatedly schedule the other in the LIFO slot. #5686, a first
attempt at solving this problem, consumes a unit of budget each time a
task is scheduled from the LIFO slot. However, at the time of this
commit, the scheduler allocates 128 units of budget for each chunk of
work. This is relatively high in situations where tasks do not perform many
async operations yet have meaningful poll times (even 5-10 microsecond
poll times can have an outsized impact on the scheduler).

In an ideal world, the scheduler would adapt to the workload it is
executing. However, as a stopgap, this commit limits the times
the LIFO slot is prioritized per scheduler tick.
2023-05-23 14:38:15 -07:00
Carl Lerche
3a94eb0893
rt: batch pop from injection queue when idle (#5705)
In the multi-threaded scheduler, when there are no tasks on the local
queue, a worker will attempt to pull tasks from the injection queue.
Previously, the worker would only attempt to poll one task from the
injection queue then continue trying to find work from other sources.
This can result in the injection queue backing up when there are many
tasks being scheduled from outside of the runtime.

This patch updates the worker to try to poll more than one task from the
injection queue when it has no more local work. Note that we also don't
want a single worker to poll **all** tasks on the injection queue as
that would result in work becoming unbalanced.
2023-05-23 08:16:41 -07:00
Taiki Endo
b75dba6904
ci: update Swatinem/rust-cache action to v2 (#5320) 2022-12-28 02:20:12 +09:00
Taiki Endo
519afd4458
ci: remove uses of unmaintained actions-rs actions (#5316)
- Use dtolnay/rust-toolchain instead of actions-rs/toolchain
- Use cargo/cross directly instead of actions-rs/cargo
- Use rustsec/audit-check instead of actions-rs/audit-check
2022-12-28 00:06:56 +09:00
Carl Lerche
22862739dd
rt: yield_now defers task until after driver poll (#5223)
Previously, calling `task::yield_now().await` would yield the current
task to the scheduler, but the scheduler would poll it again before
polling the resource drivers. This behavior can result in starving the
resource drivers.

This patch creates a queue tracking yielded tasks. The scheduler
notifies those tasks **after** polling the resource drivers.

Refs: #5209
2022-11-30 14:21:08 -08:00
Ashish Kurmi
b821e436c5
ci: add minimum GitHub token permissions for workflows (#5072)
Signed-off-by: Ashish Kurmi <akurmi@stepsecurity.io>
2022-10-03 05:15:23 -04:00
Josh Soref
5ab6aaf3cd
ci: scope workflows (#4857)
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2022-07-30 13:55:53 +02:00
Taiki Endo
2a305d2423
ci: update actions/checkout action to v3 (#4646) 2022-05-04 15:54:16 +02:00
Carl Lerche
2cee1db20c
chore: make it easier to pin Rust versions in CI (#4448)
When backporting patches to LTS branches, we often run into CI failures due to
changes in rust. Newer rust versions add more lints, which break CI. We really
don't want to also have to backport patches that fix CI, so instead, LTS branches
should pin the stable rust version in CI (e.g. #4434).

This PR restructures the CI config files to make it a bit easier to set a specific rust
version in CI.
2022-01-30 10:07:31 -08:00
Alice Ryhl
9cb495cdb8
tokio: upgrade to new nightly for CI (#4193) 2021-10-26 14:08:11 +02:00
Alice Ryhl
8e54145c8b
ci: make loom tests optional (#4112) 2021-09-20 21:52:35 +02:00