[core][distributed] support variable length object in shm broadcast #5768
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The shm transport introduced in #5399 , reserve a fixed chunk size (1MB) for each object, which is not flexible, and waste share memory space.
This PR tries to add variable length support. The initialization argument is now, the max total bytes, and the max number of objects (basically queue size). Only when either is full, the enqueue operation will be blocking.
In most cases, it should not block, as we just have a few broadcast in vLLM, and the worker will read them before the next broadcast. The queue size will not grow dramatically.
The variable length support is more complicated than I thought. The high-watermark and low-watermark stuff is quite difficult to get it right. I added a stress test to send over 400MB data in 10K messages, which should give us enough confidence that this implementation is correct.