-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Benchmarks OOM #2062
Comments
Some thoughts:
|
Another interesting thing, The byte buf stream used by the benchmarks causes a heap allocation and a copy due to bad interaction with the MessageFramer. Here is how it is allocated:
|
More notes: NettyWritableBufferAllocator allocates a minimum of 4k buffers, which is much larger than the small 14 and 13 byte buffers that are sent by The flow control benchmark. This makes the system run out of direct extremely fast since it effectively costs 4k per rpc. At a million messages per second, it is easy to run out. |
MessageFramer calls Drainable.drainTo with a special output stream of OutputStreamAdapter. Currently, ByteBufInputStream writes to this output stream by allocating a heapBuffer in UnsafeByteBufUtil.getBytes, copying from the direct byte buffer of BBIS, and then copies to the direct byte buffer from MessageFramer.writeRaw(). This change is an easy way to cut down on wasted memory, even though ideally there would be some way to have less copies. The actual data is only around 10 bytes, but causes O(10)s of megabytes allocation for the heap pool. For grpc#2062
MessageFramer calls Drainable.drainTo with a special output stream of OutputStreamAdapter. Currently, ByteBufInputStream writes to this output stream by allocating a heapBuffer in UnsafeByteBufUtil.getBytes, copying from the direct byte buffer of BBIS, and then copies to the direct byte buffer from MessageFramer.writeRaw(). This change is an easy way to cut down on wasted memory, even though ideally there would be some way to have less copies. The actual data is only around 10 bytes, but causes O(10)s of megabytes allocation for the heap pool. For grpc#2062
Running FlowControlledMessagePerSecond benchmark with 4 forks creates out of memory exceptions.
The text was updated successfully, but these errors were encountered: