summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorPoornima G <pgurusid@redhat.com>2017-01-17 17:45:59 +0530
committerRaghavendra G <rgowdapp@redhat.com>2017-01-23 03:00:24 -0500
commitf245dc568e3c22882e22ddd3e26a4207f5704e3b (patch)
treeb2a81aa4435b9494c38765847a9e571b4b9bab3b /xlators
parentac629e574935a8aed6526936bc83b1c6d295ae67 (diff)
glusterd, rda: If parallel readdir is enabled, split the cache limit
With patch http://review.gluster.org/#/c/16072/ readdir-ahead can be loaded as a child of dht. i.e. there can be more than one instance of readdir-ahead in client process. In this case the rda-cache-size should be split among all the readdir-ahead instances. Also the value of rda-request-size is considered as the minimum cache size of any readdir-ahead instance. Change-Id: Iea2fe6d4c46adc09dd2e9a252332a0fe3005f2b9 BUG: 1401812 Signed-off-by: Poornima G <pgurusid@redhat.com> Reviewed-on: https://review.gluster.org/16424 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Kaushal M <kaushal@redhat.com> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.c76
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volgen.h2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-volume-set.c2
3 files changed, 78 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.c b/xlators/mgmt/glusterd/src/glusterd-volgen.c
index 144bd5a4d57..f5ddef4755d 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.c
@@ -3774,18 +3774,90 @@ out:
return ret;
}
+static int
+client_graph_set_rda_options (volgen_graph_t *graph,
+ glusterd_volinfo_t *volinfo,
+ dict_t *set_dict)
+{
+ char *rda_cache_s = NULL;
+ int32_t ret = 0;
+ uint64_t rda_cache_size = 0;
+ char *rda_req_s = NULL;
+ uint64_t rda_req_size = 0;
+ uint64_t new_cache_size = 0;
+ char new_cache_size_str[50] = {0,};
+ char new_req_size_str[50] = {0,};
+ int dist_count = 0;
+
+ dist_count = volinfo->brick_count / volinfo->dist_leaf_count;
+ if (dist_count <= 1)
+ goto out;
+
+ if (graph->type == GF_REBALANCED ||
+ graph->type == GF_QUOTAD ||
+ graph->type == GF_SNAPD ||
+ !glusterd_volinfo_get_boolean (volinfo, VKEY_PARALLEL_READDIR) ||
+ !glusterd_volinfo_get_boolean (volinfo, VKEY_READDIR_AHEAD))
+ goto out;
+
+ ret = glusterd_volinfo_get (volinfo, VKEY_RDA_CACHE_LIMIT, &rda_cache_s);
+ if (ret < 0)
+ goto out;
+
+ gf_string2bytesize_uint64 (rda_cache_s, &rda_cache_size);
+
+ ret = glusterd_volinfo_get (volinfo, VKEY_RDA_REQUEST_SIZE, &rda_req_s);
+ if (ret < 0)
+ goto out;
+
+ gf_string2bytesize_uint64 (rda_req_s, &rda_req_size);
+
+ new_cache_size = rda_cache_size / dist_count;
+ if (new_cache_size < rda_req_size) {
+ if (new_cache_size < 4 * 1024)
+ new_cache_size = rda_req_size = 4 * 1024;
+ else
+ rda_req_size = new_cache_size;
+
+ snprintf (new_req_size_str, sizeof (new_req_size_str),
+ "%ld%s", rda_req_size, "B");
+ ret = dict_set_dynstr_with_alloc (set_dict,
+ VKEY_RDA_REQUEST_SIZE,
+ new_req_size_str);
+ if (ret < 0)
+ goto out;
+ }
+
+ snprintf (new_cache_size_str, sizeof (new_cache_size_str),
+ "%ld%s", new_cache_size, "B");
+ ret = dict_set_dynstr_with_alloc (set_dict,
+ VKEY_RDA_CACHE_LIMIT,
+ new_cache_size_str);
+ if (ret < 0)
+ goto out;
+
+out:
+ return ret;
+}
+
+
static int client_graph_set_perf_options(volgen_graph_t *graph,
glusterd_volinfo_t *volinfo,
dict_t *set_dict)
{
- data_t *tmp_data = NULL;
- char *volname = NULL;
+ data_t *tmp_data = NULL;
+ char *volname = NULL;
+ int ret = 0;
/*
* Logic to make sure NFS doesn't have performance translators by
* default for a volume
*/
volname = volinfo->volname;
+ ret = client_graph_set_rda_options (graph, volinfo, set_dict);
+ if (ret < 0)
+ return ret;
+
tmp_data = dict_get (set_dict, "nfs-volume-file");
if (!tmp_data)
return volgen_graph_set_options_generic(graph, set_dict,
diff --git a/xlators/mgmt/glusterd/src/glusterd-volgen.h b/xlators/mgmt/glusterd/src/glusterd-volgen.h
index de1ba9428f5..8f725c46380 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volgen.h
+++ b/xlators/mgmt/glusterd/src/glusterd-volgen.h
@@ -34,6 +34,8 @@
#define VKEY_FEATURES_SCRUB "features.scrub"
#define VKEY_PARALLEL_READDIR "performance.parallel-readdir"
#define VKEY_READDIR_AHEAD "performance.readdir-ahead"
+#define VKEY_RDA_CACHE_LIMIT "performance.rda-cache-limit"
+#define VKEY_RDA_REQUEST_SIZE "performance.rda-request-size"
#define AUTH_ALLOW_MAP_KEY "auth.allow"
#define AUTH_REJECT_MAP_KEY "auth.reject"
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-set.c b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
index 96e76cd7953..7da0de20291 100644
--- a/xlators/mgmt/glusterd/src/glusterd-volume-set.c
+++ b/xlators/mgmt/glusterd/src/glusterd-volume-set.c
@@ -3120,6 +3120,7 @@ struct volopt_map_entry glusterd_volopt_map[] = {
{ .key = "performance.rda-request-size",
.voltype = "performance/readdir-ahead",
.option = "rda-request-size",
+ .value = "128KB",
.flags = OPT_FLAG_CLIENT_OPT,
.type = DOC,
.op_version = GD_OP_VERSION_3_9_1,
@@ -3139,6 +3140,7 @@ struct volopt_map_entry glusterd_volopt_map[] = {
},
{ .key = "performance.rda-cache-limit",
.voltype = "performance/readdir-ahead",
+ .value = "10MB",
.type = DOC,
.flags = OPT_FLAG_CLIENT_OPT,
.op_version = GD_OP_VERSION_3_9_1,