[Core] Fix the false sharing in struct grpc_completion_queue (#33173)

For the details of the issue, please see #33157.

Add several paddings in struct grpc_comletion_quete to avoid the false
sharing.

I see performance improvement with the QPS tests.


cpp_protobuf_async_streaming_qps_unconstrained_1cq_insecure: ~2.9%
cpp_protobuf_async_unary_qps_unconstrained_1cq_insecure: ~7%
pull/33258/head
Steven Wang 2 years ago committed by GitHub
parent 942d64b16f
commit eac1a93f49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      src/core/lib/surface/completion_queue.cc

@ -349,10 +349,14 @@ struct cq_callback_data {
struct grpc_completion_queue {
/// Once owning_refs drops to zero, we will destroy the cq
grpc_core::RefCount owning_refs;
/// Add the paddings to fix the false sharing
char padding_1[GPR_CACHELINE_SIZE];
gpr_mu* mu;
char padding_2[GPR_CACHELINE_SIZE];
const cq_vtable* vtable;
char padding_3[GPR_CACHELINE_SIZE];
const cq_poller_vtable* poller_vtable;
#ifndef NDEBUG

Loading…
Cancel
Save