Skip to content
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

Make MonoSend.MAX_SIZE configurable by system property #3276

Merged
merged 2 commits into from
Jun 10, 2024
Merged

Make MonoSend.MAX_SIZE configurable by system property #3276

merged 2 commits into from
Jun 10, 2024

Conversation

VadimKirilchuk
Copy link
Contributor

@VadimKirilchuk VadimKirilchuk commented Jun 4, 2024

MonoSend.MAX_SIZE is a constant used by MonoSendMany and its SendManyInner class to request initial items from a publisher to send to an output Channel. This PR introduces a way to configure MonoSend.MAX_SIZE by using reactor.netty.channel.send.prefetch.maxSize(Upd. reactor.netty.send.maxPrefetchSize) system property. A custom value for the property may be necessary if requested items from publisher are large and requesting default number of items (128) requires too much memory.

Fixes #3255

@pivotal-cla
Copy link

@VadimKirilchuk Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

@pivotal-cla
Copy link

@VadimKirilchuk Thank you for signing the Contributor License Agreement!

@violetagg violetagg changed the title Make MonoSend.MAX_SIZE configurable by system property (#3255) Make MonoSend.MAX_SIZE configurable by system property Jun 4, 2024
@violetagg violetagg added the type/enhancement A general enhancement label Jun 4, 2024
@violetagg violetagg added this to the 1.1.20 milestone Jun 4, 2024
@violetagg violetagg linked an issue Jun 4, 2024 that may be closed by this pull request
@VadimKirilchuk
Copy link
Contributor Author

@violetagg I did the change, some tests are failing locally, but seems to be unrelated.
I'll try to run my sample app with updated code and property to make sure it works fine.

@VadimKirilchuk
Copy link
Contributor Author

VadimKirilchuk commented Jun 7, 2024

I have also checked running that locally with some stub Flux Publisher:

        return Mono.just(ResponseEntity.ok()
                .body(Flux.<ByteBuffer>generate(sink -> sink.next(ByteBuffer.wrap(SAMPLE)))
                        .take(1024)
//                        .delayElements(Duration.ofMillis(100))
                        .doOnRequest(value -> log.info("Requested {}", value))));
2024-06-07T14:58:03.980-04:00  INFO 14288 --- [ctor-http-nio-2] o.e.s.controller.DownloadController      : New request
2024-06-07T14:58:04.031-04:00  INFO 14288 --- [ctor-http-nio-2] o.e.s.controller.DownloadController      : Requested 1
2024-06-07T14:58:04.079-04:00  INFO 14288 --- [ctor-http-nio-2] o.e.s.controller.DownloadController      : Requested 63
2024-06-07T14:58:04.121-04:00  INFO 14288 --- [ctor-http-nio-2] o.e.s.controller.DownloadController      : Requested 32

...

2024-06-07T14:58:04.290-04:00  INFO 14288 --- [ctor-http-nio-2] o.e.s.controller.DownloadController      : Requested 32
2024-06-07T14:58:04.296-04:00  INFO 14288 --- [ctor-http-nio-2] o.e.s.controller.DownloadController      : Requested 32
2024-06-07T14:58:04.300-04:00  INFO 14288 --- [ctor-http-nio-2] o.e.s.controller.DownloadController      : Requested 32
2024-06-07T14:58:04.331-04:00  INFO 14288 --- [ctor-http-nio-2] reactor.netty.http.server.AccessLog      : 0:0:0:0:0:0:0:1 - - [07/июн./2024:14:58:03 -0400] "GET /api/download HTTP/1.1" 200 3072 473

Seems to work as expected. Please let me know if you need anything else from my side.

Also, do you want me to create a similar PR for 1.2.x? I am not sure if you are simply doing merges from 1.1.x -> 1.2.x.

@violetagg violetagg merged commit 3083c45 into reactor:1.1.x Jun 10, 2024
14 checks passed
violetagg added a commit that referenced this pull request Jun 10, 2024
violetagg added a commit that referenced this pull request Jun 10, 2024
@violetagg
Copy link
Member

violetagg commented Jun 10, 2024

@VadimKirilchuk

Also, do you want me to create a similar PR for 1.2.x? I am not sure if you are simply doing merges from 1.1.x -> 1.2.x.

There is no need. We use forward merge strategy, so the change is already available in the dev branches.

Thanks for the PR!

@VadimKirilchuk VadimKirilchuk deleted the feature/mono_send_prefetch_max_size branch June 10, 2024 20:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MonoSend MAX_SIZE and REFILL_SIZE are not configurable
4 participants