{"id":1728,"date":"2010-04-07T11:42:59","date_gmt":"2010-04-07T11:42:59","guid":{"rendered":"http:\/\/www.icocean.com\/blog\/?p=1728"},"modified":"1970-01-01T07:00:00","modified_gmt":"1970-01-01T07:00:00","slug":"mboxvsmaildir%E4%B8%A4%E8%80%85%E7%9A%84%E5%8E%9F%E7%90%86%E5%92%8C%E5%8C%BA%E5%88%AB","status":"publish","type":"post","link":"https:\/\/www.icocean.com\/blog\/?p=1728","title":{"rendered":"Mbox vs Maildir \u4e24\u8005\u7684\u539f\u7406\u548c\u533a\u522b"},"content":{"rendered":"<p>\u5728\u5f00\u653e\u6e90\u4ee3\u7801\u7684\u4e16\u754c\u91cc\uff0c\u7535\u5b50\u90ae\u4ef6\u670d\u52a1\u5668\u6700\u4e3b\u6d41\u7684\u76ee\u524d\u6709\u4e09\u79cd\uff0c\u5206\u522b\u662fsendmail, qmail, postfix\u3002\u800c\u5b58\u50a8\u683c\u5f0f\u6700\u6d41\u884c\u7684\u6709\u4e24\u79cd\uff0cMbox\u548cMaildir\uff0c\u5b83\u4eec\u90fd\u662f\u5f00\u653e\u7684\u5b58\u50a8\u683c\u5f0f\uff0c\u56e0\u6b64\u517c\u5bb9\u6027\u6bd4\u8f83\u597d\u3002<\/p>\n<p>\u800cmbox\u548cmaildir\u7684\u5386\u53f2\uff0c\u5374\u4e0d\u4e3a\u5927\u591a\u6570\u7528\u6237\u6240\u4e86\u89e3\u3002\u4eca\u5929\u548c\u4e00\u4e2a\u670b\u53cb\u804a\u5230mbox\u548cmaildir\u54ea\u4e2a\u597d\uff0c\u987a\u4fbf\u641c\u96c6\u4e00\u4e0bmbox\u548cmaildir\u7684\u8d44\u6599\uff0c\u8c08\u8c08\u8fd9\u4e24\u8005\u7684\u539f\u7406\u548c\u533a\u522b\uff0c\u4ee5\u53ca\u5e94\u8be5\u5982\u4f55\u505a\u9009\u62e9\u3002<\/p>\n<p>Mbox\u7684\u5386\u53f2\u8f83Maildir\u60a0\u4e45\uff0csendmail\u652f\u6301mbox\uff0cqmail\u548cpostfix\u90fd\u652f\u6301mbox\uff0c\u5176\u4e3b\u8981\u7279\u70b9\u5c31\u662f\u201c\u6240\u6709\u90ae\u4ef6\u90fd\u5b58\u653e\u5230\u4e00\u4e2a\u6587\u4ef6\u91cc\u201d\u3002\u6bcf\u4e2a\u90ae\u4ef6\u4e4b\u95f4\u4ee5\u7279\u5b9a\u7684\u6807\u8bb0\u5206\u5272\u3002<\/p>\n<p>\u800cMaildir\u5219\u76f8\u53cd\uff0c\u6bcf\u4e00\u5c01\u90ae\u4ef6\u4fdd\u5b58\u6210\u4e00\u4e2a\u6587\u4ef6\uff0c\u6bcf\u4e2a\u6587\u4ef6\u540d\u79f0\u4e00\u822c\u6709\u4e00\u5b9a\u7684\u89c4\u5f8b\uff0c\u4f8b\u5982\u4f1a\u5305\u542b\u65f6\u95f4\u6233\u3001pid\u53cainode\u8282\u70b9\u53f7\u7b49\u3002<\/p>\n<p>\u9664\u4e86mbox\u548cmaildir\u683c\u5f0f\u5916\uff0c\u8fd8\u6709\u4e00\u4e2a\u53ebmbx\u7684\u683c\u5f0f\uff0c\u5b83\u662f\u5bf9mbox\u7684\u6539\u8fdb\u7248\u672c\u3002\u4e3b\u8981\u7528\u5728UW-IMAP server\u91cc\u3002\u5b83\u6700\u5927\u7684\u7279\u70b9\u662f\u6709\u4e00\u4e2a\u9488\u5bf9mbox\u6587\u4ef6\u7684\u7d22\u5f15\uff0c\u80fd\u6539\u5584\u8bfb\/\u5199\u6027\u80fd\u3002\u4f46\u4f9d\u7136\u9700\u8981file lock\u3002<\/p>\n<p>\u968f\u7740qmail\/postfix\u7684\u666e\u53ca\uff0c\u4ee5\u53cambox\u7684\u4e00\u4e9b\u95ee\u9898\u66b4\u9732\uff0cmaildir\u5f97\u5230\u4e86\u8d8a\u6765\u8d8a\u591a\u7684\u5e94\u7528\u3002\u5176\u4e2dmbox\u7684\u6700\u4e3b\u8981\u95ee\u9898\u662f\u6587\u4ef6\u7f29\u5b9a\uff08file lock\uff09\uff0c\u5176\u6b21\u662f\u5927\u591a\u6570update\u64cd\u4f5c\u7684\u6548\u80fd\u95ee\u9898\u3002<!--more--><\/p>\n<p>\u4ee5\u4e0b\u662f\u5f15\u81eacourier-mta.org\u4e0a\u7684mbox\u548cmaildir\u7684\u6d4b\u8bd5\u5bf9\u6bd4\u6587\u7ae0\uff0c\u4ecb\u7ecd\u4e86mbox\u548cmaildir\uff1a<\/p>\n<p>mbox mail storage format<\/p>\n<p>This is the traditional way to store mail on UNIX-based mail servers. Individual messages are simply concatenated together, and saved in a single file. A special marker is placed where one message ends and the next message begins. Only one process can access the mbox file in read\/write mode. Concurrent access requires a locking mechanism. Anytime someone needs to update the mbox file, everyone else must wait for the update to complete.<\/p>\n<p>maildir mail storage format<\/p>\n<p>Maildirs were originally implemented in the Qmail mail server, supposedly to address the inadequacies of mbox files. Individual messages are saved in separate files, one file per message. There is a defined method for naming each file. There&#39;s a defined procedure for adding new messages to the maildir. No locking is required. Multiple processes can use maildirs at the same time.<\/p>\n<p>mbx mail storage format<\/p>\n<p>This is a slightly modified version of the original mbox format that&#39;s offered by the UW-IMAP server. mbx mailboxes still require locking. The main difference from the mbox format is that each message in the file is preceded by a record that carries some message-specific metadata. As such, certain operations that used to require the entire mbox file to be rewritten can now be implemented by updating the fixed-size header record.<\/p>\n<p>This benchmark focuses mainly on the mbox and maildirs formats. In March of 2003 an unrelated party conducted a similar benchmark for mbx formats. See http:\/\/www.decisionsoft.com\/pdw\/mailbench.html<\/p>\n<p>for more details.<\/p>\n<p>Mbox vs Maildir\u4e4b\u4f18\u7f3a\u70b9\u6bd4\u8f83<\/p>\n<p>\u8fd9\u91cc\u7ed9\u51fa\u4e00\u4e2a\u57fa\u672c\u7684\u7279\u6027\u5bf9\u6bd4\uff0c\u8bfb\u8005\u5f88\u5bb9\u6613\u5c31\u6e05\u695a\u6839\u636e\u81ea\u5df1\u7684\u5e94\u7528\u5230\u5e95\u5e94\u8be5\u9009\u4ec0\u4e48\u5b58\u50a8\u683c\u5f0f\uff1a<\/p>\n<p>\u53ef\u9760\u6027<\/p>\n<p>\u4f18\u9009\u662fMaildir\uff0c\u56e0\u4e3ambox\u53ea\u6709\u4e00\u4e2a\u6587\u4ef6\uff0c\u4e00\u65e6\u51fa\u95ee\u9898\u4e4b\u540e\uff0c\u6240\u6709\u90ae\u4ef6\u90fd\u5c06\u635f\u6bc1\u3002<\/p>\n<p>\u66f4\u65b0\u901f\u5ea6<\/p>\n<p>\u8fd9\u91cc\u4e3b\u8981\u6307\u7684\u662f\u5220\u9664\/\u589e\u52a0\u90ae\u4ef6\u7684\u80fd\u529b\uff0c\u65e0\u7591Maildir\u5b8c\u80dcMbox<\/p>\n<p>\u641c\u7d22\u901f\u5ea6<\/p>\n<p>\u8fd9\u70b9Mbox\u56e0\u4e3a\u662f\u5355\u6587\u4ef6\uff0c\u56e0\u6b64\u641c\u7d22\u7684\u80fd\u529b\u8981\u5f3a\u4e8emaildir<\/p>\n<p>\u5e76\u53d1\u8bbf\u95ee\u80fd\u529b<\/p>\n<p>\u5bf9\u4e8e\u7e41\u5fd9\u7684\u90ae\u4ef6\u7cfb\u7edf\uff0c\u591a\u4e2a\u8fdb\u7a0b\u540c\u65f6\u8bbf\u95ee\u540c\u4e00\u5c01\u90ae\u4ef6\u662f\u53ef\u80fd\u7684\u4e8b\u60c5\uff0cMbox\u9700\u8981flock()\u7684\u652f\u6301\uff0c\u800c\u4e14\u5982\u679c\u67d0\u4e00\u4e2a\u8fdb\u7a0b\u64cd\u4f5c\u65f6\u95f4\u957f\uff0c\u5219\u5176\u4ed6\u6240\u6709\u8fdb\u7a0b\u90fd\u5835<\/p>\n<p>\u585e\u4e86\u3002Maildir\u6ca1\u6709\u8fd9\u4e2a\u95ee\u9898\u3002\u5728NFS\u7b49\u7f51\u7edc\u6587\u4ef6\u7cfb\u7edf\u4e0a\uff0cMaildir\u76f8\u5bf9\u5b89\u5168\uff0cMbox\u4e0d\u80fd\u7528\u4e8e\u6b64\u7c7b\u578b\u73af\u5883<\/p>\n<p>\u6269\u5145\u80fd\u529b<\/p>\n<p>\u73b0\u5728\u7684\u90ae\u7bb1\u5df2\u7ecf\u4e0d\u662f5\u5e74\u524d\u751a\u81f310\u5e74\u524d\u76841MB,2MB\u800c\u662f100,200\u751a\u81f31G\/2G\uff0cMbox\u5e94\u4ed8\u90a3\u4e48\u5927\u7684\u5bb9\u91cf\u5df2\u529b\u4e0d\u4ece\u5fc3\uff0c\u65e0\u7591Maildir\u662f\u6bd4\u8f83\u9002\u5408\u7684\u3002<\/p>\n<p>\u6587\u4ef6\u7cfb\u7edf\u4f9d\u8d56<\/p>\n<p>Maildir\u8f83\u4f9d\u8d56\u6587\u4ef6\u7cfb\u7edf\uff0c\u5c24\u5176\u662f\u4f9d\u8d56\u5bf9\u76ee\u5f55\u7684\u7d22\u5f15\u80fd\u529b\uff0c\u7528ReiserFS\u4f1a\u6bd4\u8f83\u5feb\uff0c\u5bf9\u4e8e\u8d85\u5927\u578b\u7684maildir\uff0c\u8bfb\u5199\u6027\u80fd\u5c06\u53d7\u5230\u8003\u9a8c\u3002\u76f8\u5bf9\u800c\u8a00Mbox\u5219\u4e0d\u5b58\u5728\u8fd9\u4e2a\u95ee\u9898\u3002<\/p>\n<p>\u7efc\u5408\u7ed3\u8bba<\/p>\n<p>\u63a8\u8350\u4f7f\u7528Maildir\u683c\u5f0f\uff0c\u5b89\u5168\u53ef\u9760\uff0c\u7edd\u5927\u90e8\u5206\u64cd\u4f5c\u90fd\u8fdc\u5feb\u4e8eMbox\u3002\u800c\u4e14\u73b0\u4eca\u652f\u6301Maildir\u7684\u8f6f\u4ef6\u8d8a\u6765\u8d8a\u591a\uff0cqmail\/Postfix \u90fd\u652f\u6301\u3002<\/p>\n<p>\u4e00\u4e9b\u6709\u7528\u7684\u94fe\u63a5<\/p>\n<p>\u539f\u7406\u6807\u51c6<\/p>\n<p>http:\/\/cr.yp.to\/proto\/maildir.html<br \/>http:\/\/www.qmail.org\/qmail-manual-html\/man5\/mbox.html<\/p>\n<p>Benchmark\/\u6bd4\u8f83<\/p>\n<p>http:\/\/www.courier-mta.org\/mbox-vs-maildir\/<br \/>http:\/\/www.decisionsoft.com\/pdw\/mailbench.html<\/p>\n<p>\u8f6c\u6362\u5de5\u5177<\/p>\n<p>http:\/\/www.qmail.org\/mbox2maildir<br \/>http:\/\/batleth.sapienti-sat.org\/projects\/mb2md\/<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728\u5f00\u653e\u6e90\u4ee3\u7801\u7684\u4e16\u754c\u91cc\uff0c\u7535\u5b50\u90ae\u4ef6\u670d\u52a1\u5668\u6700\u4e3b\u6d41\u7684\u76ee\u524d\u6709\u4e09\u79cd\uff0c\u5206\u522b\u662fsendmail, qmail, postfix <a href='https:\/\/www.icocean.com\/blog\/?p=1728' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[31],"tags":[2645,2644,2607,1707],"class_list":["post-1728","post","type-post","status-publish","format-standard","hentry","category-email","tag-maildir","tag-mbox","tag-postfix","tag-1707","category-31-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1728","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1728"}],"version-history":[{"count":0,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1728\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1728"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1728"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1728"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}