Do not wait for allocation if buffer is less than half the target.

We overallocate by 2x for target. Unless buffer is more than half
full, we should not delay read for more allocation.
pull/16838/head
Soheil Hassas Yeganeh 6 years ago
parent c8d5db1717
commit 78434ad303
  1. 2
      src/core/lib/iomgr/tcp_posix.cc

@ -500,7 +500,7 @@ static void tcp_read_allocation_done(void* tcpp, grpc_error* error) {
static void tcp_continue_read(grpc_tcp* tcp) {
size_t target_read_size = get_target_read_size(tcp);
if (tcp->incoming_buffer->length < target_read_size &&
if (tcp->incoming_buffer->length < target_read_size / 2 &&
tcp->incoming_buffer->count < MAX_READ_IOVEC) {
if (grpc_tcp_trace.enabled()) {
gpr_log(GPR_INFO, "TCP:%p alloc_slices", tcp);

Loading…
Cancel
Save