-
Notifications
You must be signed in to change notification settings - Fork 654
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
MonoSend MAX_SIZE and REFILL_SIZE are not configurable #3255
Comments
@VadimKirilchuk Are you interested in providing a PR? Which Reactor Netty version should enable this feature (1.1.x or 1.2.x)? |
@violetagg I am interested, but will need some guidance. |
sure
then please base the PR on 1.1.x branch |
@violetagg Ok, so here is what I was able to find so far. However, as I said, I don't believe it is easy to achieve in the current configuration.
It declares the following constants which are not used in the abstract In fact they are not directly used in the The only place creating
It uses
Recalculation of requested vs next request seems to be done in the trySuccess here:
I will need more time to understand if this should be as simple as replacing constants by passing system properties like:
or similar, please advice:
|
@VadimKirilchuk I haven't thought about possible implementation, but if we use system properties this will be applied to all client requests/server responses i.e. it won't be possible to specify it per request/respose or per client/server (imagine that you have server and some of the routes do remote calls using the client). May be we can add some configuration on HttpClientRequest/HttpServerResponse or NettyOutbound. |
@violetagg I prepared a draft version of the PR. I see that most of other properties are defined in Are you OK with the property name I haven't provided any additional unit tests as it doesn't seem that your unit tests interact with System properties. |
While working on S3 file download server (can't use pre-signed URLs) it was found that S3 AWS CRT client is using big part size(8MB) of the transferred chunks of data by default. AWS SDK issue.
It seems that reactor-netty by default requests
MonoSend.MAX_SIZE
andMonoSend.REFILL_SIZE
in theMonoSendMany
when processingFlux<ByteBuffer>
for streaming body response.As a result, reactor requests 128*8MB=1024MB from the S3 Client. If the clients are slow enough, and multiple files are downloaded in parallel, this causes OutOfDirectMemory due to S3 client pushing 1024Mb for each file into netty buffers.
There are two issues here:
We fixed the issue by reducing default size of the part/chunk size in S3, however, this causes a chatty traffic and additional requests between application and S3. It would be better, if we can control initial request/refill on the reactor-netty side.
Basic code snippet:
Motivation
Motivation is to preserve big chunk size on the S3 client side, but keep a better backpressure between reactor and S3 Client. Default request of 128 makes sense for S3 NettyNioAsyncHttpClient which uses 8KB chunks by default, but for CRT client which uses 8MB chunks it is too much.
Desired solution
MonoSend MAX_SIZE and REFILL_SIZE should be made configurable and not hardcoded.
Considered alternatives
I don't see any other alternatives, but maybe you can suggest something else.
Additional context
AWS Java SDK version used
2.25.10
CRT Client Version
0.29.14
Reactor netty and netty version
reactor-netty 1.1.3
netty 4.1.108.Final
JDK version used
openjdk version "17.0.3" 2022-04-19
oracle jdk 17
Operating System and version
windows 11 23H2 and some linux image in EKS
The text was updated successfully, but these errors were encountered: