<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>stephenyeong&#039;s blog &#187; mdaemon</title>
	<atom:link href="http://www.stephenyeong.idv.hk/wp/tag/mdaemon/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stephenyeong.idv.hk/wp</link>
	<description>Blog about my IT life</description>
	<lastBuildDate>Mon, 06 Feb 2012 13:41:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Mdaemon slow queue study</title>
		<link>http://www.stephenyeong.idv.hk/wp/2011/10/mdaemon-slow-queue-study/</link>
		<comments>http://www.stephenyeong.idv.hk/wp/2011/10/mdaemon-slow-queue-study/#comments</comments>
		<pubDate>Thu, 27 Oct 2011 18:33:48 +0000</pubDate>
		<dc:creator>stephenyeong</dc:creator>
				<category><![CDATA[軟件]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[Inbound Queue]]></category>
		<category><![CDATA[Local Queue]]></category>
		<category><![CDATA[mdaemon]]></category>
		<category><![CDATA[RAMMap]]></category>
		<category><![CDATA[slow]]></category>

		<guid isPermaLink="false">http://www.stephenyeong.idv.hk/wp/?p=917</guid>
		<description><![CDATA[After few week of Mdaemon slow queue complain, 1 week of changing hardware test and 1 week of process tracing, mail queue is now stabilized. Summarize these week study; there are few setting should help Mdaemon run faster Offload Remote Queue to other server by setting delivery options [Must] Use server 2008R2 with enough memory [...]]]></description>
			<content:encoded><![CDATA[<fb:like href='http://www.stephenyeong.idv.hk/wp/2011/10/mdaemon-slow-queue-study/' send='false' layout='standard' show_faces='true' width='450' height='65' action='like' colorscheme='light' font='lucida+grande'></fb:like><p>After few week of Mdaemon slow queue complain, 1 week of changing hardware test and 1 week of process tracing, mail queue is now stabilized.</p>
<p>Summarize these week study; there are few setting should help Mdaemon run faster</p>
<ol>
<li>Offload Remote Queue to other server by setting delivery options [Must]</li>
<li>Use server 2008R2 with enough memory to cache more Metafile<br />
and calculation of enough memory = 4GB + (files count * 1KB)<br />
for example, total mail store with 4 million files should have 8GB or more</li>
<li>Registry tweak  (based on Performance Tuning Guidelines for Windows Server 2008 R2)<br />
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\FileSystem<br />
NtfsDisable8dot3NameCreation=1<br />
NtfsDisableLastAccessUpdate=1</li>
<li>Disk defragment (no need often defragment)</li>
<li>Application disk volume alignment, Mdaemon Application ( cfilter dir), Local Queue and User folder should be on same volume</li>
<li>CPU &#8211; higher clock / better clock efficient instead of multi core<br />
a. we tested on 8 core 16 thread machine, it use only few thread<br />
b. even average load is below 50%, you will see 2.8GHz CPU perform better than 2.4GHz CPUI think Single CPU SandyBridge 2600K server will run faster than server with Dual Socket Xeon E5625</li>
</ol>
<p>&nbsp;</p>
<p><strong>Offload Remote Queue to other server by setting delivery options</strong></p>
<p>After offload Remote Queue to another Mdaemon server, you will see Incoming Queue run faster (less lockup)</p>
<p><a href="http://www.stephenyeong.idv.hk/wp/wp-content/uploads/2011/10/Delivery-options.png" rel="lightbox[917]" title="Delivery options"><img class="alignnone size-full wp-image-920" title="Delivery options" src="http://www.stephenyeong.idv.hk/wp/wp-content/uploads/2011/10/Delivery-options.png" alt="" width="671" height="480" /></a></p>
<p><strong>Use server 2008R2 with enough memory to cache more Metafile</strong></p>
<p>When huge amount of files and mail box are accessed frequently, server 2008 will cache Metafile to memory.</p>
<p>for example, Mdaemon folder have 4,385,755 Files, the usage of  Metafile can reach 4.7GB.<a href="http://www.stephenyeong.idv.hk/wp/wp-content/uploads/2011/10/MdaemonFiles.png" rel="lightbox[917]" title="MdaemonFiles"><img class="alignnone size-full wp-image-921" title="MdaemonFiles" src="http://www.stephenyeong.idv.hk/wp/wp-content/uploads/2011/10/MdaemonFiles.png" alt="" width="367" height="474" /></a></p>
<p><a href="http://www.stephenyeong.idv.hk/wp/wp-content/uploads/2011/10/RamMap.png" rel="lightbox[917]" title="RamMap"><img class="alignnone size-full wp-image-922" title="RamMap" src="http://www.stephenyeong.idv.hk/wp/wp-content/uploads/2011/10/RamMap.png" alt="" width="698" height="571" /></a></p>
<p>Also, more memory also can benefit windows read cache. Equallogic SAN HQ report show the read/write ratio change from 66/33 to 15/85 after system upgraded to 16GB memory. That mean 91% of read IO saved by system cache.</p>
<p><strong>Application disk volume alignment</strong></p>
<p>After tracing server with Sysinternals&#8217; Process Monitor ( 3 minutes of event, data size 5.9GB!! ),</p>
<p>I found,</p>
<ol>
<li>Mdaemon access disk in 4KB per Read/Write, it would be fine for mail sized in KB sale. However, some user send mail in Megabyte scale.</li>
<li>Mdaemon create Local Queues and Remote Queues by coping message from Inboundfor example, a email addressed to 5 local mailbox and 5 remote mail recipient with 3 different domain will do following<br />
5 times of ( make unique per recipient mail header + copy remaining message body in 4kB per block from Inbound to Local till EOF)<br />
3 times of ( copy message in 4KB per block to Remote Queue  + create *.rte to record target recipient)</li>
<li>when process Local Queue and found user have mail forwarding setting, it will create related Local Queue and Remote Queue.<br />
And same as Inbound Queue, working in 4KB per block pattern.</li>
<li>Local Queue will do Antivirus and SpamAssassin check, file will <strong>move</strong> to Cfilter\Temp during CFilter process</li>
<li>The final local mail will <strong>move</strong> to user mailbox</li>
</ol>
<p>You will found that, file will  move between CFilter, Local Queue, and User Folder.<br />
When the folder not in same disk, Mdaemon still calling filesystem MoveFileA and move between volume handled by system.<br />
On server 2008R2, read buffer is 512KB and write block size is 64KB.</p>
<p><strong>CPU &#8211; higher clock / better clock efficient instead of multi core</strong></p>
<p>You will found that, upgrade from single Quad Core CPU to dual Quad Core CPU only have slightly improvement.</p>
<p>It is because, queue processing seems single thread (one thread scan folder, one thread move file)<br />
However,  CFEngine, Spamassassin and  Antivirus seems running in multi-thread, so, messages waiting inside Local Queue mostly are MDAV &amp; SpamD processed.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stephenyeong.idv.hk/wp/2011/10/mdaemon-slow-queue-study/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>MD-MRTG</title>
		<link>http://www.stephenyeong.idv.hk/wp/2011/09/md-mrtg/</link>
		<comments>http://www.stephenyeong.idv.hk/wp/2011/09/md-mrtg/#comments</comments>
		<pubDate>Thu, 22 Sep 2011 15:51:04 +0000</pubDate>
		<dc:creator>stephenyeong</dc:creator>
				<category><![CDATA[網絡]]></category>
		<category><![CDATA[mdaemon]]></category>
		<category><![CDATA[RRD]]></category>

		<guid isPermaLink="false">http://www.stephenyeong.idv.hk/wp/?p=764</guid>
		<description><![CDATA[原本上星期已有構思，想寫一個插件加到MDaemon去將收到郵件的數量返影給MRTG/CACTI 等rrdgraph。 因為只有rrdgraph才可以有助分析Server 繁忙時間分佈。 找了一會, 想用MDaemon 的guicounts.dat 內數據用WebService Publish 出去. 再找了一會, 找到一個2006件的project MD-MRTG 雖然舊少少, 部份設定不是很好。但經一番修改後總算可以使用。 修改內容如下 index.html font size and graph size double (new target screen width &#62; 1280) Web Session folder path (non default location) Graph Max Value of (POP3 session, Mail In/Out, Spam, Network Bandwidth) Inbound count method support Hash directory (sub directory) 唔睇都唔知, [...]]]></description>
			<content:encoded><![CDATA[<fb:like href='http://www.stephenyeong.idv.hk/wp/2011/09/md-mrtg/' send='false' layout='standard' show_faces='true' width='450' height='65' action='like' colorscheme='light' font='lucida+grande'></fb:like><p>原本上星期已有構思，想寫一個插件加到MDaemon去將收到郵件的數量返影給MRTG/CACTI 等rrdgraph。<br />
因為只有rrdgraph才可以有助分析Server 繁忙時間分佈。</p>
<p>找了一會, 想用MDaemon 的guicounts.dat 內數據用WebService Publish 出去.<br />
再找了一會, 找到一個2006件的project <a title="MD-MRTG" href="http://www.everything-mdaemon.com/mdaemon/plugins/md-mrtg-version-110">MD-MRTG</a></p>
<p>雖然舊少少, 部份設定不是很好。但經一番修改後總算可以使用。<br />
修改內容如下</p>
<ol>
<li>index.html font size and graph size double (new target screen width &gt; 1280)</li>
<li>Web Session folder path (non default location)</li>
<li>Graph Max Value of (POP3 session, Mail In/Out, Spam, Network Bandwidth)</li>
<li>Inbound count method support Hash directory (sub directory)</li>
</ol>
<p><a href="http://www.stephenyeong.idv.hk/wp/wp-content/uploads/2011/09/192.168.4.65-screen-capture-2011-9-22-23-27-53.png" rel="lightbox[764]" title="192.168.4.65 screen capture 2011-9-22-23-27-53"><img class="alignnone size-medium wp-image-765" title="192.168.4.65 screen capture 2011-9-22-23-27-53" src="http://www.stephenyeong.idv.hk/wp/wp-content/uploads/2011/09/192.168.4.65-screen-capture-2011-9-22-23-27-53-300x285.png" alt="" width="300" height="285" /></a></p>
<p><a href="http://www.stephenyeong.idv.hk/wp/wp-content/uploads/2011/09/Mail.png" rel="lightbox[764]" title="Mail"><br />
<img class="alignnone size-medium wp-image-766" title="Mail" src="http://www.stephenyeong.idv.hk/wp/wp-content/uploads/2011/09/Mail-300x247.png" alt="" width="300" height="247" /></a></p>
<p><a href="http://www.stephenyeong.idv.hk/wp/wp-content/uploads/2011/09/Spam.png" rel="lightbox[764]" title="Spam"><br />
<img class="alignnone size-medium wp-image-767" title="Spam" src="http://www.stephenyeong.idv.hk/wp/wp-content/uploads/2011/09/Spam-284x300.png" alt="" width="284" height="300" /></a></p>
<p><a href="http://www.stephenyeong.idv.hk/wp/wp-content/uploads/2011/09/Spam.png"><br />
</a></p>
<p>唔睇都唔知, POP3 Session / hour 可以上到28K、SMTP IN 也有近8.5K。<br />
晚上原來有近半的EMAIL是垃圾。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.stephenyeong.idv.hk/wp/2011/09/md-mrtg/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Email 到 yahoo.com 的問題</title>
		<link>http://www.stephenyeong.idv.hk/wp/2010/03/yahoo-mail-problem/</link>
		<comments>http://www.stephenyeong.idv.hk/wp/2010/03/yahoo-mail-problem/#comments</comments>
		<pubDate>Tue, 23 Mar 2010 08:11:22 +0000</pubDate>
		<dc:creator>stephenyeong</dc:creator>
				<category><![CDATA[網絡]]></category>
		<category><![CDATA[mdaemon]]></category>
		<category><![CDATA[smtp]]></category>
		<category><![CDATA[yahoo]]></category>

		<guid isPermaLink="false">http://www.stephenyeong.idv.hk/wp/?p=560</guid>
		<description><![CDATA[繼上年YAHOO.COM.CN個Outdated Bogon BGP 事件, 同YAHOO的 technical support 交手以後. 今年又要面對 YAHOO.COM 的postmaster. 因為見到有幾封十幾MB的郵件在mail server loop 了很久，才發現 send 到 yahoo.com 經常發生drop connection 的問題. 大郵件發送到YAHOO.COM會無原因地被對方斷開。由於沒有 SMTP Status code*1，E Mail server 會即時重試另一MX*2。 YAHOO.COM 的DNS記錄總共有 8個 MX RECORD。如事者，一封20MB 的電郵每次會傳到YAHOO.COM 的 8個 MX IP，每個IP傳20MB資料。 我地Server 每半小時重試一次，24小時不能成功遞送才會放棄。 即是寄一封20MB的信件到YAHOO.COM會花了20MB x 8 x 2 x 24 = 7.68GB的bandwidth。平均全日0.7Mbps (7680MB * 8bit / 86400sec). 以Singtel [...]]]></description>
			<content:encoded><![CDATA[<fb:like href='http://www.stephenyeong.idv.hk/wp/2010/03/yahoo-mail-problem/' send='false' layout='standard' show_faces='true' width='450' height='65' action='like' colorscheme='light' font='lucida+grande'></fb:like><p>繼上年YAHOO.COM.CN個Outdated Bogon BGP 事件, 同YAHOO的 technical support 交手以後. 今年又要面對 YAHOO.COM 的postmaster.</p>
<p>因為見到有幾封十幾MB的郵件在mail server loop 了很久，才發現 send 到 yahoo.com 經常發生drop connection 的問題.</p>
<p>大郵件發送到YAHOO.COM會無原因地被對方斷開。由於沒有 SMTP Status code*1，E Mail server 會即時重試另一MX*2。 YAHOO.COM 的DNS記錄總共有 8個 MX RECORD。如事者，一封20MB 的電郵每次會傳到YAHOO.COM 的 8個 MX IP，每個IP傳20MB資料。</p>
<p>我地Server 每半小時重試一次，24小時不能成功遞送才會放棄。</p>
<p>即是寄一封20MB的信件到YAHOO.COM會花了20MB x 8 x 2 x 24 = 7.68GB的bandwidth。平均全日0.7Mbps (7680MB * 8bit / 86400sec).</p>
<p>以Singtel 去海外每Mbps每月約$1,000計算, 一封信花了$1,000 * 0.7 / 30 = $23.</p>
<pre>*1 Enhanced Mail System Status Codes - rfc3463
*2 MX = Mail Exchange - rfc1035</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.stephenyeong.idv.hk/wp/2010/03/yahoo-mail-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>新的一年, spamassassin 十年蟲</title>
		<link>http://www.stephenyeong.idv.hk/wp/2010/01/spamassassin-2010-bug/</link>
		<comments>http://www.stephenyeong.idv.hk/wp/2010/01/spamassassin-2010-bug/#comments</comments>
		<pubDate>Mon, 04 Jan 2010 13:34:43 +0000</pubDate>
		<dc:creator>stephenyeong</dc:creator>
				<category><![CDATA[其他]]></category>
		<category><![CDATA[網絡]]></category>
		<category><![CDATA[FH_DATE_PAST_20XX]]></category>
		<category><![CDATA[mdaemon]]></category>
		<category><![CDATA[spamassassin]]></category>

		<guid isPermaLink="false">http://www.stephenyeong.idv.hk/wp/?p=329</guid>
		<description><![CDATA[市佔率很大的spamassassin 其中一條rule在2010 出現問題. 由於這條是Default rule, 很多Server都受影響. 名稱是FH_DATE_PAST_20XX, 看來應該是2006加入的. 原意是日期大於2010年的就加3.2 到3.4分. 以防止有人用將來的日期Broadcast Spam. 理論上sa update會自動下載修補版本. 如果無就要自己手改了. ##{ FH_DATE_PAST_20XX header   FH_DATE_PAST_20XX Date =~ /20[1-9][0-9]/ [if-unset: 2006] describe FH_DATE_PAST_20XX The date is grossly in the future. ##} FH_DATE_PAST_20XX 改為 ##{ FH_DATE_PAST_20XX header   FH_DATE_PAST_20XX Date =~ /20[2-9][0-9]/ [if-unset: 2006] describe FH_DATE_PAST_20XX The date is grossly in the future. ##} FH_DATE_PAST_20XX 又或Disable成條RULE score FH_DATE_PAST_20XX [...]]]></description>
			<content:encoded><![CDATA[<fb:like href='http://www.stephenyeong.idv.hk/wp/2010/01/spamassassin-2010-bug/' send='false' layout='standard' show_faces='true' width='450' height='65' action='like' colorscheme='light' font='lucida+grande'></fb:like><p>市佔率很大的spamassassin 其中一條rule在2010 出現問題.<br />
由於這條是Default rule, 很多Server都受影響.</p>
<p>名稱是FH_DATE_PAST_20XX, 看來應該是2006加入的. 原意是日期大於2010年的就加3.2 到3.4分. 以防止有人用將來的日期Broadcast Spam.</p>
<p>理論上sa update會自動下載修補版本. 如果無就要自己手改了.</p>
<blockquote><p>##{ FH_DATE_PAST_20XX<br />
header   FH_DATE_PAST_20XX Date =~ /20[1-9][0-9]/ [if-unset: 2006]<br />
describe FH_DATE_PAST_20XX The date is grossly in the future.<br />
##} FH_DATE_PAST_20XX</p></blockquote>
<p>改為</p>
<blockquote><p>##{ FH_DATE_PAST_20XX<br />
header   FH_DATE_PAST_20XX Date =~ /20[2-9][0-9]/ [if-unset: 2006]<br />
describe FH_DATE_PAST_20XX The date is grossly in the future.<br />
##} FH_DATE_PAST_20XX</p></blockquote>
<p>又或Disable成條RULE</p>
<blockquote><p>score FH_DATE_PAST_20XX 0.0</p></blockquote>
<p>Spamassassin bug list<br />
<a href="https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6269">https://issues.apache.org/SpamAssassin/show_bug.cgi?id=6269</a></p>
<p>SpamAssassin Rule: FH_DATE_PAST_20XX<br />
<a href="http://wiki.apache.org/spamassassin/Rules/FH_DATE_PAST_20XX">http://wiki.apache.org/spamassassin/Rules/FH_DATE_PAST_20XX</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.stephenyeong.idv.hk/wp/2010/01/spamassassin-2010-bug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

