summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-03-22 10:54:22 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-03-22 10:54:22 +0000
commitc75bd2401298498efffd830dea0441dbb3d353fb (patch)
tree8b9c5c735b28fcbf3301c4c5a737b7ea2908c3ed
parentcdcc0e6710a7e11bf1c528bf1728f886dba5a0af (diff)
downloadrsyslog-c75bd2401298498efffd830dea0441dbb3d353fb.tar.gz
rsyslog-c75bd2401298498efffd830dea0441dbb3d353fb.tar.xz
rsyslog-c75bd2401298498efffd830dea0441dbb3d353fb.zip
- Greatly enhanced rsyslogd's filw write performance by disabling file
syncing capability of output modules by default. This feature is usually not required, not useful and an extreme performance hit (both to rsyslogd as well as the system at large). Unfortunately, most users enable it by default, because it was most intuitive to enable it in plain old sysklogd syslog.conf format. There is now a new config setting which must be enabled in order to support syncing. By default it is off. So even if the old-format config lines request syncing, it is not done unless explicitely enabled. I am sure this is a very useful change and not a risk at all. I need to think if I undo it under compatibility mode, but currently this does not happen (I fear a lot of lazy users will run rsyslogd in compatibility mode, again bringing up this performance problem...). - added $ActionfileEnableSync config directive
-rw-r--r--doc/rsyslog_conf.html2
-rw-r--r--doc/v3compatibility.html19
-rw-r--r--omfile.c15
3 files changed, 29 insertions, 7 deletions
diff --git a/doc/rsyslog_conf.html b/doc/rsyslog_conf.html
index 1dc53944..14dad6f6 100644
--- a/doc/rsyslog_conf.html
+++ b/doc/rsyslog_conf.html
@@ -64,7 +64,7 @@ unstable...). So you have been warned ;)</p>
many parameter settings modify queue parameters. If in doubt, use the
default, it is usually well-chosen and applicable in most cases.</p>
<ul>
-<li><a href="rsconf1_actionexeconlywhenpreviousissuspended.html">$ActionExecOnlyWhenPreviousIsSuspended</a></li>
+<li><a href="rsconf1_actionexeconlywhenpreviousissuspended.html">$ActionExecOnlyWhenPreviousIsSuspended</a></li><li>$ActionfileEnableSync [on/<span style="font-weight: bold;">off</span>] - enables file syncing capability of omfile</li>
<li>$ActionQueueCheckpointInterval &lt;number&gt;</li>
<li>$ActionQueueDequeueSlowdown &lt;number&gt; [number
is timeout in <i> micro</i>seconds (1000000us is 1sec!),
diff --git a/doc/v3compatibility.html b/doc/v3compatibility.html
index b17aca82..c2a51139 100644
--- a/doc/v3compatibility.html
+++ b/doc/v3compatibility.html
@@ -87,7 +87,24 @@ via rsyslog.conf. That set of configuration directives is to be
expanded. So far, we support:</p>
<p>$klogSymbolsTwice [on/off]<br>
$DebugPrintKernelSymbols [on/off] # spits *a lot* of messages at startup</p>
-<h2>Queue Modes for the Main Message Queue</h2>
+<h2>Output File Syncing</h2>Rsyslogd tries to keep as compatible to
+stock syslogd as possible. As such, it retained stock syslogd's default
+of syncing every file write if not specified otherwise (by placing a
+dash in front of the output file name). While this was a useful feature
+in past days where hardware was much less reliable and UPS seldom, this
+no longer is useful in today's worl. Instead, the syncing is a high
+performace hit. With it, rsyslogd writes files around 50 *times* slower
+than without it. It also affects overall system performance due to the
+high IO activity. In rsyslog v3, syncing has been turned off by
+default. This is done via a specific configuration directive
+"$ActionFileEnableSync on/off" which is off by default. So even if
+rsyslogd finds sync selector lines, it ignores them by default. In
+order to enable file syncing, the administrator must specify
+"$ActionFileEnableSync on" at the top of rsyslog.conf. This ensures
+that syncing only happens in those installations where the
+administrator actually wanted that (performance-intense) feature. In
+the fast majority of cases (if not all), this dramatically increases
+rsyslogd performance without any negative effects.<h2>Queue Modes for the Main Message Queue</h2>
<p>Either "FixedArray" or "LinkedList" is recommended. "Direct"
is available, but should not be used except for a very good reason
("Direct" disables queueing and will potentially lead to message loss
diff --git a/omfile.c b/omfile.c
index 8f0ae7da..b834cc42 100644
--- a/omfile.c
+++ b/omfile.c
@@ -12,7 +12,7 @@
* of the "old" message code without any modifications. However, it
* helps to have things at the right place one we go to the meat of it.
*
- * Copyright 2007 Rainer Gerhards and Adiscon GmbH.
+ * Copyright 2007, 2008 Rainer Gerhards and Adiscon GmbH.
*
* This file is part of rsyslog.
*
@@ -81,6 +81,7 @@ static uid_t fileGID; /* GID to be used for newly created files */
static uid_t dirUID; /* UID to be used for newly created directories */
static uid_t dirGID; /* GID to be used for newly created directories */
static int bCreateDirs; /* auto-create directories for dynaFiles: 0 - no, 1 - yes */
+static int bEnableSync = 0;/* enable syncing of files (no dash in front of pathname in conf): 0 - no, 1 - yes */
/* end globals for default values */
typedef struct _instanceData {
@@ -603,8 +604,9 @@ again:
errno = e;
errmsg.LogError(NO_ERRCODE, "%s", pData->f_fname);
}
- } else if (pData->bSyncFile)
+ } else if (pData->bSyncFile) {
fsync(pData->fd);
+ }
finalize_it:
RETiRet;
@@ -660,11 +662,12 @@ CODESTARTparseSelectorAct
return RS_RET_CONFLINE_UNPROCESSED;
}
- if (*p == '-') {
+ if(*p == '-') {
pData->bSyncFile = 0;
p++;
- } else
- pData->bSyncFile = 1;
+ } else {
+ pData->bSyncFile = bEnableSync ? 1 : 0;
+ }
pData->f_sizeLimit = 0; /* default value, use outchannels to configure! */
@@ -793,6 +796,7 @@ static rsRetVal resetConfigVariables(uchar __attribute__((unused)) *pp, void __a
fCreateMode = 0644;
fDirCreateMode = 0644;
bCreateDirs = 1;
+ bEnableSync = 0;
return RS_RET_OK;
}
@@ -823,6 +827,7 @@ CODEmodInit_QueryRegCFSLineHdlr
CHKiRet(omsdRegCFSLineHdlr((uchar *)"filecreatemode", 0, eCmdHdlrFileCreateMode, NULL, &fCreateMode, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"createdirs", 0, eCmdHdlrBinary, NULL, &bCreateDirs, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"failonchownfailure", 0, eCmdHdlrBinary, NULL, &bFailOnChown, STD_LOADABLE_MODULE_ID));
+ CHKiRet(omsdRegCFSLineHdlr((uchar *)"actionfileenablesync", 0, eCmdHdlrBinary, NULL, &bEnableSync, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler, resetConfigVariables, NULL, STD_LOADABLE_MODULE_ID));
ENDmodInit
/*