Skip to content

Commit

Permalink
Reapply "DAOS-15914 cart: add D_MRECV_BUF env var to control number o…
Browse files Browse the repository at this point in the history
…f multi-r… (#14662) (#14683)"

This reverts commit 4d0d372.
  • Loading branch information
jolivier23 committed Oct 30, 2024
1 parent 72d646b commit ff63c34
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 5 deletions.
19 changes: 19 additions & 0 deletions src/cart/README.env
Original file line number Diff line number Diff line change
Expand Up @@ -186,3 +186,22 @@ This file lists the environment variables used in CaRT.
Set parent directory for client side metrics. Each client will write its metrics to
a file with the pattern <D_CLIENT_METRICS_DUMP_DIR>/<DAOS_JOBID>-<pid>.csv. As a
convenience, setting this variable automatically sets D_CLIENT_METRICS_ENABLE=1.

D_POST_INIT
(server only) Controls the initial number of requests that are posted on context creation.
When using a transport that supports multi-recv, also controls the maximum size
of buffers (DAOS_RPC_SIZE x D_POST_INIT x D_MRECV_BUF).

D_POST_INCR
(server only) Controls the number of RPC handles that are incrementally posted when the
initial number of requests (D_POST_INIT) is exhausted.

D_MRECV_BUF
(server only) When using a transport that supports multi-recv, controls the total number
of multi-recv buffers that are posted.

D_MRECV_BUF_COPY
(server only) When using a transport that supports multi-recv, controls when we should
start copying data in an effort to release multi-recv buffers. Copy will occur when at
most D_MRECV_BUF_COPY buffers remain.

8 changes: 5 additions & 3 deletions src/cart/crt_hg.c
Original file line number Diff line number Diff line change
Expand Up @@ -859,10 +859,12 @@ crt_hg_class_init(crt_provider_t provider, int ctx_idx, bool primary, int iface_
if (prov_data->cpg_max_unexp_size > 0)
init_info.na_init_info.max_unexpected_size = prov_data->cpg_max_unexp_size;

init_info.request_post_init = crt_gdata.cg_post_init;
init_info.request_post_incr = crt_gdata.cg_post_incr;
init_info.request_post_init = crt_gdata.cg_post_init;
init_info.request_post_incr = crt_gdata.cg_post_incr;
init_info.multi_recv_op_max = crt_gdata.cg_mrecv_buf;
init_info.multi_recv_copy_threshold = crt_gdata.cg_mrecv_buf_copy;

hg_class = HG_Init_opt(info_string, crt_is_service(), &init_info);
hg_class = HG_Init_opt2(info_string, crt_is_service(), HG_VERSION(2, 4), &init_info);
if (hg_class == NULL) {
D_ERROR("Could not initialize HG class.\n");
D_GOTO(out, rc = -DER_HG);
Expand Down
3 changes: 2 additions & 1 deletion src/cart/crt_hg.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright 2016-2023 Intel Corporation.
* (C) Copyright 2016-2024 Intel Corporation.
*
* SPDX-License-Identifier: BSD-2-Clause-Patent
*/
Expand Down Expand Up @@ -30,6 +30,7 @@
/** default values for init / incr to prepost handles */
#define CRT_HG_POST_INIT (512)
#define CRT_HG_POST_INCR (512)
#define CRT_HG_MRECV_BUF (16)

#define CRT_UCX_STR "ucx"

Expand Down
8 changes: 7 additions & 1 deletion src/cart/crt_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,9 @@ static int data_init(int server, crt_init_options_t *opt)
uint32_t mem_pin_enable = 0;
uint32_t is_secondary;
uint32_t post_init = CRT_HG_POST_INIT, post_incr = CRT_HG_POST_INCR;
int rc = 0;
unsigned int mrecv_buf = CRT_HG_MRECV_BUF;
unsigned int mrecv_buf_copy = 0; /* buf copy disabled by default */
int rc = 0;

crt_env_dump();

Expand All @@ -255,6 +257,10 @@ static int data_init(int server, crt_init_options_t *opt)
crt_gdata.cg_post_init = post_init;
crt_env_get(D_POST_INCR, &post_incr);
crt_gdata.cg_post_incr = post_incr;
crt_env_get(D_MRECV_BUF, &mrecv_buf);
crt_gdata.cg_mrecv_buf = mrecv_buf;
crt_env_get(D_MRECV_BUF_COPY, &mrecv_buf_copy);
crt_gdata.cg_mrecv_buf_copy = mrecv_buf_copy;

is_secondary = 0;
/* Apply CART-890 workaround for server side only */
Expand Down
4 changes: 4 additions & 0 deletions src/cart/crt_internal_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ struct crt_gdata {
/** Hints to mercury for request post init (ignored for clients) */
uint32_t cg_post_init;
uint32_t cg_post_incr;
unsigned int cg_mrecv_buf;
unsigned int cg_mrecv_buf_copy;

/** global timeout value (second) for all RPCs */
uint32_t cg_timeout;
Expand Down Expand Up @@ -208,6 +210,8 @@ struct crt_event_cb_priv {
ENV(D_PORT_AUTO_ADJUST) \
ENV(D_POST_INCR) \
ENV(D_POST_INIT) \
ENV(D_MRECV_BUF) \
ENV(D_MRECV_BUF_COPY) \
ENV_STR(D_PROVIDER) \
ENV_STR_NO_PRINT(D_PROVIDER_AUTH_KEY) \
ENV(D_QUOTA_RPCS) \
Expand Down

0 comments on commit ff63c34

Please sign in to comment.