-
Notifications
You must be signed in to change notification settings - Fork 756
[Feature] [Benchmark]: add ZMQ-based FMQ implementation and benchmark tools #5418
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
5225ec0
9ffc4a9
65abc55
55598ec
3ab2d53
f77e222
e70351c
daf3384
7ab6b98
31159f7
edb11ae
bef4ea8
717bb0c
8dbb087
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,233 @@ | ||||||||||||
| """ | ||||||||||||
| # Copyright (c) 2025 PaddlePaddle Authors. All Rights Reserved. | ||||||||||||
| # | ||||||||||||
| # Licensed under the Apache License, Version 2.0 (the "License" | ||||||||||||
| # you may not use this file except in compliance with the License. | ||||||||||||
| # You may obtain a copy of the License at | ||||||||||||
| # | ||||||||||||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||||||||||||
| # | ||||||||||||
| # Unless required by applicable law or agreed to in writing, software | ||||||||||||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||||||||||||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||||||||||
| # See the License for the specific language governing permissions and | ||||||||||||
| # limitations under the License. | ||||||||||||
| """ | ||||||||||||
|
|
||||||||||||
| import asyncio | ||||||||||||
| import multiprocessing as mp | ||||||||||||
| import os | ||||||||||||
| import statistics | ||||||||||||
| import time | ||||||||||||
|
|
||||||||||||
| from tqdm import tqdm | ||||||||||||
|
|
||||||||||||
| from fastdeploy.inter_communicator.fmq import FMQ | ||||||||||||
|
|
||||||||||||
|
|
||||||||||||
| # ============================================================ | ||||||||||||
| # Producer Task | ||||||||||||
| # ============================================================ | ||||||||||||
| async def producer_task(proc_id, msg_count, payload_size, shm_threshold, result_q): | ||||||||||||
| fmq = FMQ() | ||||||||||||
| q = fmq.queue("mp_bench_latency", role="producer") | ||||||||||||
| payload = b"x" * payload_size | ||||||||||||
|
|
||||||||||||
| # tqdm 进度条 | ||||||||||||
| pbar = tqdm(total=msg_count, desc=f"Producer-{proc_id}", position=proc_id, leave=True, disable=False) | ||||||||||||
|
|
||||||||||||
| t0 = time.perf_counter() | ||||||||||||
| for i in range(msg_count): | ||||||||||||
| send_ts = time.perf_counter() | ||||||||||||
| await q.put(data={"pid": proc_id, "i": i, "send_ts": send_ts, "payload": payload}, shm_threshold=shm_threshold) | ||||||||||||
| pbar.update(1) | ||||||||||||
| # pbar.write(f"send {i}") | ||||||||||||
|
||||||||||||
| # pbar.write(f"send {i}") | |
Copilot
AI
Dec 8, 2025
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.
Comment should be in English to maintain consistency with the rest of the codebase.
| # tqdm 显示进度 | |
| # tqdm progress bar |
Copilot
AI
Dec 8, 2025
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.
Commented-out debug code should be removed before merging to keep the codebase clean.
| pbar.write("recv None") |
Copilot
AI
Dec 8, 2025
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.
Setting the multiprocessing start method globally with mp.set_start_method("fork") can cause issues if this function is called multiple times or if the application has already set a different start method. Consider wrapping this in a try-except or checking if it's already set:
try:
mp.set_start_method("fork")
except RuntimeError:
pass # Already set| mp.set_start_method("fork") | |
| try: | |
| mp.set_start_method("fork") | |
| except RuntimeError: | |
| pass # Start method already set |
Copilot
AI
Dec 8, 2025
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.
Comment should be in English to maintain consistency with the rest of the codebase.
| # 两个信号事件 | |
| # Two signal events |
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.
Comment should be in English to maintain consistency with the rest of the codebase.