在FreeBSD下做mail系统的性能调整!很好!

原创 2004年09月04日 14:29:00
http://www.daemonnews.org/200108/benchmark.html

The Effects of Tuning a FreeBSD Box for High Performance
Gilbert Gong, <ggong@cal.alumni.berkeley.edu>
Introduction

A stock FreeBSD installation delivers a system which is designed to meet the needs of most users, and strives to provide the best balance of safety, reliability, and performance in a multi-user environment. It is therefore not optimized for use as a high performance dedicated network server. In this article, I will investigate the effect of tuning a FreeBSD for use as a dedicated network server.

System and Methodology
The test server was a Pentium III 600 MHz with 512MB of RAM, installed in a Super Micro P6SBU motherboard. The on-board Adaptec Ultra2 SCSI adapter was connected to an IBM DNES-309170W SA30 (8GB SCSI HDD), and the network card was a 3Com 3c905B-TX. All filesystems were standard UFS

A Celeron 400 with 128MB of RAM was used as a network client when needed. The test server was installed with FreeBSD 4.3-RELEASE. The client was installed with several versions of FreeBSD 1.

The two machines were connected with a Cisco Catalyst 2924-XL running at 100Mbit/Full Duplex.

I ran three different benchmarks against the test server, in both tuned and untuned state. The benchmark results are not meant as a real world performance measurement of the system, but only a means of comparing the relative performance of the tuned and untuned state. The benchmarks were http_load to measure http performance, postmark to measure file system performance, and postal to measure SMTP performance.

Tuning
Most of the following techniques are derived from the tuning(7) man page.

Recompile the kernel
Perhaps the first step in tuning a FreeBSD box is to recompile the Kernel. Remove the options not needed by your system, and increase maxusers and the NMBCLUSTERS option. A copy of the kernel config file I used is here


Turn on soft updates
One of the most critical steps in tuning a FreeBSD box is turning on soft updates (and here). Soft updates is a method of improving filesystem metadata update performance. The following commands were entered in single user mode:
tunefs -n enable /
tunefs -n enable /usr
tunefs -n enable /var
tunefs -n enable /tmp


sysctl
A few sysctl variables should be tuned for maximum performance. The following lines were added to /etc/sysctl.conf:
vfs.vmiodirenable=1
kern.ipc.somaxconn=4096
kern.maxfiles=65536


misc
A few other tweaks included setting the "noatime" parameter on most of the filesystems, and paying attention to partition layout.
http_load Results

For the http_load test, I installed apache 1.3.19 from the ports collection, making a change to set HARD_SERVER_LIMIT to 2048. The untuned configuration would not allow 2048 processes to run, so I set Apache to create 128 initial, and max 1024 processes. For the tuned configuration, I set Apache to have 2048 processes running at all times.

I ran http_load against the server with different numbers of concurrent requests, varying from 10 to 1000. I configured the server to respond to 10 different IP addresses, and strobed over those 10 different IP addresses. This is the page which http_load ran against. The results are graphed here.

The tuned configuration outperformed the untuned configuration by over an order of magnitude. The untuned configuration maxed out at around 17 fetches/sec, as a result of running out of network mbufs. The tuned configuration kept increasing in performance as the load was increased, from 333 fetches/sec to 509 fetches/sec (1800% to 2900% increase over untuned). The tuned configuration also had a lower percentage of errors, as shown here.

postmark Results
The postmark benchmark was run with a variety of settings. First, it was run with some of the configurations documented on the home page. Those results are reported here, including a run on the FreeBSD MFS (Memory File System) for comparison. The system was then put through a series of postmark runs with different file sizes, with initial 1000 files and 20000 files. The improvement in performance is quite drastic in all cases, and ranges from a 40% to 860% increase in performance by this benchmark.

postal Results
For the postal benchmark, the postfix mailer was installed from the Ports collection (postfix-20010228-pl01). The postal benchmark was then run for half hour periods with a range of parallel simultaneous connection settings. Around 15000 accounts were created on the test server, and postal was given the list of accounts to send mail to. The test runs were made back to back, with only a small break between them. This means that mail which was enqueued in an earlier run may have remained enqueued for a later run, slowing things down even more. Since this is only meant as a comparative test, the results are still good indications of the performance difference between the two configurations. The results of the postal benchmark are here. The improvement ranges from a 40% increase to a 650% increase.

Conclusion
In conclusion, we can see that a default FreeBSD installation, while optimized for safety and integrity, is not optimized for maximum performance as a dedicated network server. Particularly in cases of serving many simultaneous connections, reliably supporting large numbers of processes, and filesystem performance, one needs to take steps to improve the performance of the system over the default configuration. The gains that can be realized from this are great, often at least doubling the performance of the system.


--------------------------------------------------------------------------------
Footnotes
1 A security enhancement in 4.3 Release unintentionally slows the rate at which two servers may communicate with one another. It also does not allow a way to turn that behavior off, though a patch has been released which does allow that behavior to be changed.

freebsd下服务硬件性能测试

freebsd用整体解决方案,简约内核打动我们。用它一个更大的理由是它出色的软件包管理。unix/linux下的免费软件远要比windows下的多,不论用port还是, pkg_add都是非常方便! ...
  • cd520yy
  • cd520yy
  • 2014年04月25日 09:42
  • 1066

FreeBSD与Linux的比较

FreeBSD是一个自由的,源自AT&T UNIX的操作系统。目前已经不包含任何AT&T的代码。可以说它是正统的UNIX后代。而Linux是由一个芬兰Helsinki大学的学生Linus Torval...
  • u011536670
  • u011536670
  • 2016年04月09日 20:17
  • 1747

FreeBSD 10.1 64位操作系统安装图解

download FreeBSD 10.2 http://mirrors.ustc.edu.cn/freebsd/releases/ISO-IMAGES/10.2/FreeBSD-10.2-RELE...
  • ztguang
  • ztguang
  • 2016年02月01日 00:00
  • 894

x86上的那些UNIX——BSD篇+主流桌面

我想把古老编程环境系列完成,这是unix篇,其实从linux开始,该系列就有些变味了,变成了操作系统的介绍,本unix篇将分FreeBSD、Solaris、SCO等几个部分,unix的发行版不是很多,...
  • u011536670
  • u011536670
  • 2016年04月09日 21:29
  • 902

FreeBSD虚拟机NAT转发

FreeBSD 内核默认不支持NAT转发功能, 需要重新编译内核源码添加ipfw NAT 选项。 1. 下载FreeBSD内核源码。 下载地址:http://ftp-archive.free...
  • u014752451
  • u014752451
  • 2016年08月30日 17:03
  • 323

使用 FreeBSD 的原因

使用 FreeBSD 的原因 BSD 备选方案概述 FreeBSD 操作系统在免费操作系统中是一个不为人熟知的巨人。从 386BSD 项目开始,FreeBSD 操作系统成为...
  • fngsong
  • fngsong
  • 2014年01月11日 12:14
  • 1263

几款有趣的电脑操作系统,FreeBSD,电脑上的android,谷歌系统,还有一个超小系统

现在操作系统越来越多了,是不是用厌了那一成不变的windows界面?那么下面的这几个操作系统来尝尝鲜吧,注意,这些操作系统是广大爱好者智慧的结晶,虽然发展不完善,但是各有特色,仅供研究使用。    ...
  • coolzoom
  • coolzoom
  • 2014年12月26日 14:54
  • 1115

FreeBSD虚拟机——小折腾

最近,突然想起来Linux了,因为前段时间接触了DOS命令,提高了自己的工作效率,这会想再温习下Linux的CLI,无奈windows下unix命令,水土不服,因此想尝试虚拟机,虚拟机软件无非vmwa...
  • liming0931
  • liming0931
  • 2016年03月23日 21:29
  • 2933

FreeBSD学习总结

FreeBSD完全入门手册 http://www.jb51.net/os/Unix/1525.html 虽然非常基础,但是对于初学者非常有用的,相信不管是初学者还是非初学者,都是有用的。 ...
  • bcbobo21cn
  • bcbobo21cn
  • 2016年07月30日 18:23
  • 1102

Linux和FreeBSD在使用非系统自带的gcc时的区别

下面拿CentOS 5和FreeBSD 9.0做下比较:   CentOS 5 自带的gcc是gcc (GCC) 4.1.2,通过yum可以安装gcc44 (GCC) 4.4.4   Free...
  • linuxnc
  • linuxnc
  • 2014年06月16日 14:20
  • 886
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:在FreeBSD下做mail系统的性能调整!很好!
举报原因:
原因补充:

(最多只允许输入30个字)