[GH-ISSUE #221] We found that deleting slices leads to poor performance。delete slice 有性能问题 #94

Closed
opened 2026-10-29 21:09:11 +00:00 by bsakaguchi · 6 comments
Owner

Originally created by @a4zhangfei on GitHub (Apr 9, 2025).
Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/221

github.com/kvcache-ai/Mooncake@5ed7331871
原本有内存泄漏的问题,后面有PR修复了,升级之后不会内存泄漏了,但是会导致性能变差,(500ms)怀疑是 delete 导致,注释掉下面的就没问题

Image

Originally created by @a4zhangfei on GitHub (Apr 9, 2025). Original GitHub issue: https://github.com/kvcache-ai/Mooncake/issues/221 https://github.com/kvcache-ai/Mooncake/commit/5ed7331871cd9c0d146d43e81404796fdea74789 原本有内存泄漏的问题,后面有PR修复了,升级之后不会内存泄漏了,但是会导致性能变差,(500ms)怀疑是 delete 导致,注释掉下面的就没问题 ![Image](https://github.com/user-attachments/assets/5e393eb1-c28c-4524-904c-1a7e5c072fce)
Author
Owner

@xiaguan commented on GitHub (Apr 9, 2025):

Is there a reproducible case available? Or, could you share how you identified this performance issue?

<!-- gh-comment-id:2788860974 --> @xiaguan commented on GitHub (Apr 9, 2025): Is there a reproducible case available? Or, could you share how you identified this performance issue?
Author
Owner

@xiaguan commented on GitHub (Apr 9, 2025):

By the way, pr #220 fixed a known long-tail issue, which might resemble the problem you described. You might want to try updating and see if it helps?

<!-- gh-comment-id:2788876125 --> @xiaguan commented on GitHub (Apr 9, 2025): By the way, pr #220 fixed a known long-tail issue, which might resemble the problem you described. You might want to try updating and see if it helps?
Author
Owner

@a4zhangfei commented on GitHub (Apr 9, 2025):

By the way, pr #220 fixed a known long-tail issue, which might resemble the problem you described. You might want to try updating and see if it helps?

@xiaguan
thanks for your reply. However, update to the latest code did not resolve the performance issue.
we use it transfer kv data from prefill instance to decode instance layer-wise.
P/D instance TP4,slice_count: 2w~3w / layer, too many slices cause performance issues with delete.

<!-- gh-comment-id:2789677938 --> @a4zhangfei commented on GitHub (Apr 9, 2025): > By the way, pr [#220](https://github.com/kvcache-ai/Mooncake/pull/220) fixed a known long-tail issue, which might resemble the problem you described. You might want to try updating and see if it helps? @xiaguan thanks for your reply. However, update to the latest code did not resolve the performance issue. we use it transfer kv data from prefill instance to decode instance layer-wise. P/D instance TP4,slice_count: 2w~3w / layer, too many slices cause performance issues with delete.
Author
Owner
<!-- gh-comment-id:2790039170 --> @xiaguan commented on GitHub (Apr 9, 2025): You could also check here https://github.com/kvcache-ai/Mooncake/blob/b31b8b84b9f1871a4582a70273f0a6a8626558fd/mooncake-transfer-engine/src/transport/rdma_transport/rdma_transport.cpp#L215C1-L222C75
Author
Owner

@alogfans commented on GitHub (Apr 10, 2025):

@a4zhangfei In the previous patch, the delete operations are internally executed in the transfer engine's worker thread. So we moved them back the call of freeBatchID. We also use a thread-local Slice cache to reduce the call of new/delete.

<!-- gh-comment-id:2791513021 --> @alogfans commented on GitHub (Apr 10, 2025): @a4zhangfei In the previous patch, the delete operations are internally executed in the transfer engine's worker thread. So we moved them back the call of freeBatchID. We also use a thread-local Slice cache to reduce the call of new/delete.
Author
Owner

@ShangmingCai commented on GitHub (Apr 10, 2025):

Closed as fixed.

<!-- gh-comment-id:2791556906 --> @ShangmingCai commented on GitHub (Apr 10, 2025): Closed as fixed.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
kvcache-ai/Mooncake#94
No description provided.