grpc / grpc/grpc-java

Create an API to set Cronet read buffer size

Open
#12,198 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Java
Stars
12.1k
Forks
4k
Avg merge
2d 17h
Merged PRs (30d)
37

Description

### Is your feature request related to a problem?
When Cronet is used as the underlying transport engine for GRPC. The default read buffer size created is quite small (4KB). This small buffer can lead to overhead especially when reading a significant amount of data (~10s MB) as each read call will incur JNI calls to fetch data from Cronet's networking thread. I believe that the default should be bumped up to 64KB. However, it'd be nice to start with adding an API that allows user to set their own read buffer size per Channel.

### Describe the solution you'd like
Add a new API `CronetChannelBuilder.setReadBufferSize(...)` to allow changing the default buffer size for read operations.

### Describe alternatives you've considered
Bump the default to a higher number (64KB)

### Additional context
We're doing some experiments regarding moving folks from Cronet to HttpEngine (Cronet in the platform). And we've noticed some latency regressions only on long-running requests which led to this investigation that GRPC-Cronet is using excessively small buffers.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.