免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1005 | 回复: 0
打印 上一主题 下一主题

读书笔记:基础linux系统优化 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2003-12-30 15:49 |只看该作者 |倒序浏览
对于一个刚安装完毕的linux系统,有如下通用的优化措施。

优化编译器
编辑/etc/profile,增加:
For CPU i686 or PentiumPro, Pentium II, Pentium III
CFLAGS='-O9 -funroll-loops -ffast-math -malign-double -mcpu=pentiumpro -march=pentiumpro -fomit-frame-pointer -fno-exceptions'
export CFLAGS

For CPU i586 or Pentium
CFLAGS='-O3 -march=pentium -mcpu=pentium -ffast-math -funroll-loops -fomit-frame-pointer -fforce-mem -fforce-addr -malign-double -fno-exceptions'
export CFLAGS

For CPU i486
CFLAGS='-O3 -funroll-all-loops -malign-double -mcpu=i486 -march=i486 -fomit-frame-pointer -fnoexceptions'
export CFLAGS

优化SWAP分区
将SWAP分区置于硬盘的开始部分,可以获得部分的系统性能提升。

优化虚拟内存系统
编辑/etc/sysctl.conf,增加或者更改如下:
# Improve file system performance
vm.bdflush = 100 1200 128 512 15 5000 500 1884 2
# Improve virtual memory performance
vm.buffermem = 80 10 60

优化文件系统

编辑/etc/sysctl.conf,增加或者更改如下:
# Improve the number of open files
fs.file-max = 8192
# Improve the number of inodes opened
fs.inode-max = 32768

此外,对于有频繁读写的文件系统,可以使用noatime的mount选项,这样,对于文件系统的读,系统不会产生对于文件节点atime信息的更新操作。


优化TCP/IP
编辑/etc/sysctl.conf,增加或者更改如下:
# Allowed local port range
net.ipv4.ip_local_port_range = 32768 61000
# Decrease the time default value for tcp_fin_timeout connection
net.ipv4.tcp_fin_timeout = 30
# Decrease the time default value for tcp_keepalive_time connection
net.ipv4.tcp_keepalive_time = 1800
# Turn off the tcp_window_scaling
net.ipv4.tcp_window_scaling = 0
# Turn off the tcp_sack
net.ipv4.tcp_sack = 0
# Turn off the tcp_timestamps
net.ipv4.tcp_timestamps = 0

优化IDE磁盘
应用hdparm命令配置IDE磁盘的32位DMA通道,可以极大的提升磁盘IO,某些情况下几乎可以提升到2倍的IO性能。具体使用参见hdparm的manual.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP