summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaghavendra G <raghavendra@gluster.com>2009-09-21 09:52:03 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-09-22 06:14:30 -0700
commitfb34f7fd81d3260d548ee0f6b5d656fdb1ec61f1 (patch)
tree2d9262d5e6fdf9f52a666322a8daab81dd7b4527
parentf86858c3be2ad5b4f9031625e3678528d9f4c6c1 (diff)
performance/write-behind: add option "enable-trickling-writes".
- With this option enabled, writes are stack-wound even though not enough data is aggregated, provided there are no write-requests which are stack-wound but reply is yet to come. The reason behind this option is to make use of the network, which is relatively free (with no writes or replies in transit). However, with non-standard block-sizes of writes the performance can actually degrade. Hence making this configurable. Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 276 (write behind needs to be optimized.) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=276
-rw-r--r--xlators/performance/write-behind/src/write-behind.c63
1 files changed, 41 insertions, 22 deletions
diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c
index 83d0523fbeb..a3c042e4830 100644
--- a/xlators/performance/write-behind/src/write-behind.c
+++ b/xlators/performance/write-behind/src/write-behind.c
@@ -88,6 +88,7 @@ struct wb_conf {
uint64_t disable_till;
gf_boolean_t enable_O_SYNC;
gf_boolean_t flush_behind;
+ gf_boolean_t enable_trickling_writes;
};
@@ -114,7 +115,7 @@ wb_sync (call_frame_t *frame, wb_file_t *file, list_head_t *winds);
size_t
__wb_mark_winds (list_head_t *list, list_head_t *winds, size_t aggregate_size,
- char wind_all);
+ char wind_all, char enable_trickling_writes);
static void
@@ -1147,17 +1148,22 @@ __wb_can_wind (list_head_t *list, size_t aggregate_conf,
size_t
__wb_mark_winds (list_head_t *list, list_head_t *winds, size_t aggregate_conf,
- char wind_all)
+ char wind_all, char enable_trickling_writes)
{
- size_t size = 0;
- char incomplete_writes = 0;
- char other_fop_in_queue = 0;
- char non_contiguous_writes = 0;
+ size_t size = 0;
+ char other_fop_in_queue = 0;
+ char incomplete_writes = 1;
+ char non_contiguous_writes = 0;
char enough_data_aggregated = 0;
+ char *trickling_writes = NULL;
+
+ if (enable_trickling_writes) {
+ trickling_writes = &incomplete_writes;
+ }
if (!wind_all) {
__wb_can_wind (list, aggregate_conf, &other_fop_in_queue,
- &non_contiguous_writes, &incomplete_writes,
+ &non_contiguous_writes, trickling_writes,
&enough_data_aggregated);
}
@@ -1455,7 +1461,8 @@ wb_process_queue (call_frame_t *frame, wb_file_t *file, char flush_all)
if (count == 0) {
__wb_mark_winds (&file->request, &winds, size,
- flush_all);
+ flush_all,
+ conf->enable_trickling_writes);
}
}
@@ -1915,10 +1922,7 @@ init (xlator_t *this)
{
dict_t *options = NULL;
wb_conf_t *conf = NULL;
- char *window_size_string = NULL;
- char *flush_behind_string = NULL;
- char *disable_till_string = NULL;
- char *enable_O_SYNC_string = NULL;
+ char *str = NULL;
int32_t ret = -1;
if ((this->children == NULL)
@@ -1941,9 +1945,9 @@ init (xlator_t *this)
conf->enable_O_SYNC = _gf_false;
ret = dict_get_str (options, "enable-O_SYNC",
- &enable_O_SYNC_string);
+ &str);
if (ret == 0) {
- ret = gf_string2boolean (enable_O_SYNC_string,
+ ret = gf_string2boolean (str,
&conf->enable_O_SYNC);
if (ret == -1) {
gf_log (this->name, GF_LOG_ERROR,
@@ -1956,15 +1960,15 @@ init (xlator_t *this)
conf->aggregate_size = WB_AGGREGATE_SIZE;
conf->disable_till = 1;
ret = dict_get_str (options, "disable-for-first-nbytes",
- &disable_till_string);
+ &str);
if (ret == 0) {
- ret = gf_string2bytesize (disable_till_string,
+ ret = gf_string2bytesize (str,
&conf->disable_till);
if (ret != 0) {
gf_log (this->name, GF_LOG_ERROR,
"invalid number format \"%s\" of \"option "
"disable-for-first-nbytes\"",
- disable_till_string);
+ str);
return -1;
}
}
@@ -1976,15 +1980,15 @@ init (xlator_t *this)
/* configure 'option window-size <size>' */
conf->window_size = WB_WINDOW_SIZE;
ret = dict_get_str (options, "cache-size",
- &window_size_string);
+ &str);
if (ret == 0) {
- ret = gf_string2bytesize (window_size_string,
+ ret = gf_string2bytesize (str,
&conf->window_size);
if (ret != 0) {
gf_log (this->name, GF_LOG_ERROR,
"invalid number format \"%s\" of \"option "
"window-size\"",
- window_size_string);
+ str);
FREE (conf);
return -1;
}
@@ -2010,9 +2014,9 @@ init (xlator_t *this)
/* configure 'option flush-behind <on/off>' */
conf->flush_behind = 0;
ret = dict_get_str (options, "flush-behind",
- &flush_behind_string);
+ &str);
if (ret == 0) {
- ret = gf_string2boolean (flush_behind_string,
+ ret = gf_string2boolean (str,
&conf->flush_behind);
if (ret == -1) {
gf_log (this->name, GF_LOG_ERROR,
@@ -2025,6 +2029,21 @@ init (xlator_t *this)
"enabling flush-behind");
}
}
+
+ conf->enable_trickling_writes = _gf_true;
+ ret = dict_get_str (options, "enable-trickling-writes",
+ &str);
+ if (ret == 0) {
+ ret = gf_string2boolean (str,
+ &conf->enable_trickling_writes);
+ if (ret == -1) {
+ gf_log (this->name, GF_LOG_ERROR,
+ "'enable-trickling_writes' takes only boolean"
+ " arguments");
+ return -1;
+ }
+ }
+
this->private = conf;
return 0;
}