Username: Password:

基础linux系统优化
来源: ChinaUnix博客  作者: ChinaUnix博客   发布时间:2008-04-24 06:41:27


对于一个刚安装完毕的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

喜欢本文,那就收藏到:

    Del.icio.us Google书签 Digg Live Bookmark Technorati Furl Yahoo书签 Facebook 百度搜藏 新浪ViVi 365Key网摘 天极网摘 和讯网摘 博拉网 POCO网摘 添加到饭否 QQ书签 Digbuzz我挖网
相关评论  我也要评论
还没有关于此文章的相关评论!
  • 昵称: (为空则显示guest)
  • 评论分数: ★ ★ ★★★ ★★★★ ★★★★★
  • 评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
  • 导航
    赞助商
    文章类别
    订阅