-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Transport:
AsyncTransport
plugin (#6626)
# Short * Transport: `AsyncTransport` plugin with entry point `core.ssh_async` * `TransportPath` new Path Type , so that transport plugins support more types -- previously str only. # Long This PR proposes many changes to make transport tasks asynchronous. This ensures that the daemon won’t be blocked by time-consuming tasks such as uploads, downloads, and similar operations, requested by @giovannipizzi. Here’s a summary of the main updates: - **New Transport Plugin:** Introduces `AsyncSshTransport` with the entry point `core.ssh_async`. - **Enhanced Authentication:** `AsyncSshTransport` supports executing custom scripts before connections, which is particularly useful for authentication. 🥇 - **Engine Updates:** Modifies the engine to consistently call asynchronous transport methods. - **Backward Compatibility:** Provides synchronous counterparts for all asynchronous methods in `AsyncSshTransport`. - **Transport Class Overhaul:** Major changes to `Transport` class. Introduces `BlockingTransport`, and `AsyncTransport` as helper class for plugin developers. - **Improved Documentation:** Adds more docstrings and comments to guide plugin developers. Blocking plugins should inherit from `Transport`, while asynchronous ones should inherit from `AsyncSshTransport`. - **New Path Type:** Defines a `TransportPath` type and upgrades transport plugins to work with `Union[str, Path, PurePosixPath]`. - **New Feature:** Introduces `copy_from_remote_to_remote_async`, addressing a previous issue where such tasks blocked the entire daemon. ## Test Results: Performance Comparisons ### **When `core.ssh_async` Outperforms** In scenarios where the daemon is blocked by heavy transfer tasks (uploading/downloading/copying large files), `core.ssh_async` shows significant improvement. For example, I submitted two WorkGraphs: 1. The first handles heavy transfers: - Upload 10 MB - Remote copy 1 GB - Retrieve 1 GB 2. The second performs a simple shell command: `touch file`. The time taken until the submit command is processed (with one daemon running): - **`core.ssh_async`:** **Only 4 seconds!** 🚀🚀🚀🚀 *A major improvement!* - **`core.ssh`:** **108 seconds** (WorkGraph 1 fully completes before processing the second). ### **When `core.ssh_async` and `core.ssh` Are Comparable** For tasks involving both (and many!) uploads and downloads (a common scenario), performance varies slightly depending on the case. - **Large Files (~1 GB):** - `core.ssh_async` performs better due to simultaneous uploads and downloads. In some networks, this can almost double the bandwidth, as demonstrated in the graph in on the PR #6626. My bandwidth is 11.8 MB/s but increased to nearly double under favorable conditions. However, under heavy network load, bandwidth may revert to its base level (e.g., 11.8 MB/s) **Test Case:** Two WorkGraphs: one uploads 1 GB, the other retrieves 1 GB using `RemoteData`. - `core.ssh_async`: **120 seconds** - `core.ssh`: **204 seconds** - **Small Files (Many Small Transfers):** - **Test Case:** 25 WorkGraphs each transferring a few 1 MB files. - `core.ssh_async`: **105 seconds** - `core.ssh`: **65 seconds** In this scenario, however, the overhead of asynchronous calls seems to outweigh the benefits. We need to discuss the trade-offs and explore possible optimizations. As @agoscinski mentioned, this might be expected, see here [async overheads](https://stackoverflow.com/questions/55761652/what-is-the-overhead-of-an-asyncio-task).
- Loading branch information
Showing
22 changed files
with
2,925 additions
and
521 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
eba6954
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible performance regression was detected for benchmark 'pytest-benchmarks:ubuntu-22.04,psql_dos'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold
2
.tests/benchmark/test_json_contains.py::test_wide_json[100-2]
19.41046971696955
iter/sec (stddev: 0.0011605
)569.015838428265
iter/sec (stddev: 0.000063974
)29.31
This comment was automatically generated by workflow using github-action-benchmark.
CC: @giovannipizzi @agoscinski @GeigerJ2 @khsrali @unkcpz