summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormohit84 <moagrawa@redhat.com>2020-10-15 16:28:58 +0530
committerGitHub <noreply@github.com>2020-10-15 16:28:58 +0530
commitf71660eb879a9cd5761e5adbf10c783e959a990a (patch)
tree86fbf54496afbf8a9d4e276120941f72175543cb
parent07e37295f7a90ae293f68d04a6b2fc65ab3f0f51 (diff)
downloadglusterfs-f71660eb879a9cd5761e5adbf10c783e959a990a.tar.gz
glusterfs-f71660eb879a9cd5761e5adbf10c783e959a990a.tar.xz
glusterfs-f71660eb879a9cd5761e5adbf10c783e959a990a.zip
io-stats: Configure ios_sample_buf_size based on sample_interval value (#1574)
io-stats xlator declares a ios_sample_buf_size 64k object(10M) per xlator but in case of sample_interval is 0 this big buffer is not required so declare the default value only while sample_interval is not 0.The new change would be helpful to reduce RSS size for a brick and shd process while the number of volumes are huge. Change-Id: I3e82cca92e40549355edfac32580169f3ce51af8 Fixes: #1542 Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
-rw-r--r--tests/bugs/glusterd/daemon-log-level-option.t8
-rw-r--r--xlators/debug/io-stats/src/io-stats.c26
2 files changed, 26 insertions, 8 deletions
diff --git a/tests/bugs/glusterd/daemon-log-level-option.t b/tests/bugs/glusterd/daemon-log-level-option.t
index 66e55e3d75..5352a63d1f 100644
--- a/tests/bugs/glusterd/daemon-log-level-option.t
+++ b/tests/bugs/glusterd/daemon-log-level-option.t
@@ -61,8 +61,8 @@ rm -f /var/log/glusterfs/glustershd.log
TEST $CLI volume set all cluster.daemon-log-level WARNING
TEST $CLI volume start $V0
-# log should not have any info messages
-EXPECT 0 Info_messages_count "/var/log/glusterfs/glustershd.log"
+# log does have 1 info message specific to configure ios_sample_buf_size in io-stats xlator
+EXPECT 1 Info_messages_count "/var/log/glusterfs/glustershd.log"
# log should not have any debug messages
EXPECT 0 Debug_messages_count "/var/log/glusterfs/glustershd.log"
@@ -78,8 +78,8 @@ rm -f /var/log/glusterfs/glustershd.log
TEST $CLI volume set all cluster.daemon-log-level ERROR
TEST $CLI volume start $V0
-# log should not have any info messages
-EXPECT 0 Info_messages_count "/var/log/glusterfs/glustershd.log"
+# log does have 1 info message specific to configure ios_sample_buf_size in io-stats xlator
+EXPECT 1 Info_messages_count "/var/log/glusterfs/glustershd.log"
# log should not have any warning messages
EXPECT 0 Warning_messages_count "/var/log/glusterfs/glustershd.log"
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c
index aa00c446e5..0eac501172 100644
--- a/xlators/debug/io-stats/src/io-stats.c
+++ b/xlators/debug/io-stats/src/io-stats.c
@@ -3699,6 +3699,15 @@ xlator_set_loglevel(xlator_t *this, int log_level)
}
}
+void
+ios_sample_buf_size_configure(char *name, struct ios_conf *conf)
+{
+ conf->ios_sample_buf_size = 1024;
+ gf_log(name, GF_LOG_INFO,
+ "Configure ios_sample_buf "
+ " size is 1024 because ios_sample_interval is 0");
+}
+
int
reconfigure(xlator_t *this, dict_t *options)
{
@@ -3755,8 +3764,13 @@ reconfigure(xlator_t *this, dict_t *options)
int32, out);
GF_OPTION_RECONF("ios-dump-format", dump_format_str, options, str, out);
ios_set_log_format_code(conf, dump_format_str);
- GF_OPTION_RECONF("ios-sample-buf-size", conf->ios_sample_buf_size, options,
- int32, out);
+ if (conf->ios_sample_interval) {
+ GF_OPTION_RECONF("ios-sample-buf-size", conf->ios_sample_buf_size, options,
+ int32, out);
+ } else {
+ ios_sample_buf_size_configure (this->name, conf);
+ }
+
GF_OPTION_RECONF("sys-log-level", sys_log_str, options, str, out);
if (sys_log_str) {
sys_log_level = glusterd_check_log_level(sys_log_str);
@@ -3933,8 +3947,12 @@ init(xlator_t *this)
GF_OPTION_INIT("ios-dump-format", dump_format_str, str, out);
ios_set_log_format_code(conf, dump_format_str);
- GF_OPTION_INIT("ios-sample-buf-size", conf->ios_sample_buf_size, int32,
- out);
+ if (conf->ios_sample_interval) {
+ GF_OPTION_INIT("ios-sample-buf-size", conf->ios_sample_buf_size, int32,
+ out);
+ } else {
+ ios_sample_buf_size_configure (this->name, conf);
+ }
ret = ios_init_sample_buf(conf);
if (ret) {