linux性能优化
一.最小化安装系统
二.关闭NetworkManager服务。
NetworkManger服务如果启动,当你手动配置网卡时会发生冲突
[root@linuxangel ~]# /etc/init.d/NetworkManager stop
Stopping NetworkManager daemon: [ OK ]
[root@linuxangel ~]# chkconfig NetworkManager off
[root@linuxangel ~]# chkconfig --list NetworkManager
NetworkManager :off :off :off :off :off :off :off
[root@linuxangel ~]#
三.开启messagebus
这是 Linux 的 IPC(Interprocess Communication,进程间通讯)服务。确切地说,它与 DBUS 交互,是重要的系统服务。强烈建议开启它。
[root@linuxangel ~]# chkconfig --list messagebus
messagebus :off :off :on :on :on :on :off
[root@linuxangel ~]#
四.linux服务管理工具ntsysv
ntsysv工具能在命令行下开启text_mod 模块,方便管理服务,能够很直观的观察那些的启动,那些服务停止.
五.irqbalance服务被证实为非常重要的服务,它能够合理的调用cpu资源,优化中断分配。
[root@linuxangel ~]# /etc/init.d/irqbalance start
Starting irqbalance: [ OK ]
[root@linuxangel ~]# chkconfig --list irqbalance
irqbalance :off :off :off :on :on :on :off
[root@linuxangel ~]# chkconfig --level irqbalance on
七.关闭打印服务:这个非常有必要,几乎没有使用linux去打印东西,主流的打印机驱动也不支持。
[root@linuxangel ~]# /etc/rc.d/init.d/cups stop
Stopping cups: [ OK ]
[root@linuxangel ~]# chkconfig --level cups off
[root@linuxangel ~]# chkconfig --list cups
cups :off :off :off :off :off :off :off
[root@linuxangel ~]#
八.针对需求关闭或者开启的iptables
如果你的服务器不是用于特殊的服务,如web前端,mysql等等,建议关闭iptables服务。降低系统负载。
[root@linuxangel ~]#
[root@linuxangel ~]# /etc/init.d/iptables stop
iptables: Flushing firewall rules: [ OK ]
iptables: Setting chains to policy ACCEPT: nat mangle filte[ OK ]
iptables: Unloading modules: [ OK ]
[root@linuxangel ~]# chkconfig --level iptables off
九.关闭selinux
[root@linuxangel ~]# setenforce #零时设置为permissive(自由模式)
[root@linuxangel ~]# sed -i 's/SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config #禁止selinux(需重启系统)
十.关闭不需要的多余的tty控制终端
修改/etc/inittab文件
找到类似tty1,tty2,留下三到两个终端,关闭其余的终端。
然后执行init q
十一.增强扛SYN Flood攻击的能力:
[root@linuxangel ~]# echo "net.ipv4.tcp_syncookies = 1" >> /etc/sysctl.conf [root@linuxangel ~]# sysctl -p #应用修改:
net.ipv4.ip_forward =
net.ipv4.conf.default.rp_filter =
net.ipv4.conf.default.accept_source_route =
kernel.sysrq =
kernel.core_uses_pid =
net.ipv4.tcp_syncookies =
net.bridge.bridge-nf-call-ip6tables =
net.bridge.bridge-nf-call-iptables =
net.bridge.bridge-nf-call-arptables =
kernel.msgmnb =
kernel.msgmax =
kernel.shmmax =
kernel.shmall =
net.ipv4.tcp_syncookies =
[root@linuxangel ~]#
十二.修改linux的history记录个数:
[root@linuxangel ~]# sed -i 's/HISTSIZE=.*/HISTSIZE=100/g' /etc/profile
定期执行history -c命令,可以加入到计划任务,尤其是在安全级别比较高的服务器上。
十三.停止ipv6,现阶段基本没有使用到ipv6技术,建议关闭。
[root@linuxangel ~]# echo "alias net-pf-10 off" >> /etc/modprobe.d/dist.conf
[root@linuxangel ~]# echo "alias ipv6 off " >> /etc/modprobe.d/dist.conf
[root@linuxangel ~]# echo "IPV6INIT=no" >> /etc/sysconfig/network-scripts/ifcfg-eth0
十四.限制打开文件的最大数:
理论上修改这个配置文件是有效的,但是部分系统重启之后就还原了。
[root@linuxangel ~]# vi /etc/security/limits.conf
解决办法是使用ulimit -SHn 65535命令修改,并加入到系统启动脚本当中
可以通过脚本查看一些服务打开的文件数:
#!/bin/bash
for pid in $(ps aux | grep http | grep -v grep | awk '{print $2}');do
cat /proc/$pid/limits |grep 'Max open files';
done
[root@linuxangel ~]# for pid in $(ps aux | grep http | grep -v grep | awk '{print $2}');do cat /proc/$pid/limits | grep 'Max open files'; done
Max open files files
Max open files files
Max open files files
Max open files files
Max open files files
Max open files files
Max open files files
Max open files files
Max open files files
Max open files files
Max open files files
[root@linuxangel ~]#
linux性能优化的更多相关文章
- Linux 性能优化之 IO 子系统 系列 图
http://blog.sina.com.cn/s/articlelist_1029388674_11_1.html Linux 性能优化之 IO 子系统(一) 本文介绍了对 Linux IO 子系统 ...
- 如何学习Linux性能优化?
如何学习Linux性能优化? 你是否也曾跟我一样,看了很多书.学了很多 Linux 性能工具,但在面对 Linux 性能问题时,还是束手无策?实际上,性能分析和优化始终是大多数软件工程师的一个痛点.但 ...
- Linux 性能优化解析
前情概述 进程调度 老板 cpu 任劳任怨的打工仔 线程 工作在做什么 可运行队列 拥有的工作清单 上下文切换 和老板沟通以便得到老板的想法并及时调整自己的工作 中断 部分工作做完以后还需要及时向老板 ...
- 深挖计算机基础:Linux性能优化学习笔记
参考极客时间专栏<Linux性能优化实战>学习笔记 一.CPU性能:13讲 Linux性能优化实战学习笔记:第二讲 Linux性能优化实战学习笔记:第三讲 Linux性能优化实战学习笔记: ...
- Linux 性能优化排查工具
下图1为 Linux 性能优化排查工具的总结 图1 诊断 CPU 工具 查看 CPU 核数 总核数 = 物理CPU个数 X 每颗物理CPU的核数 总逻辑CPU数 = 物理CPU个数 X 每颗物理CPU ...
- Linux性能优化从入门到实战:01 Linux性能优化学习路线
我通过阅读各种相关书籍,从操作系统原理.到 Linux内核,再到硬件驱动程序等等. 把观察到的性能问题跟系统原理关联起来,特别是把系统从应用程序.库函数.系统调用.再到内核和硬件等不同的层级贯 ...
- Linux性能优化-平均负载
Linux性能优化-平均负载 目录 Linux性能优化-平均负载 平均负载的含义 平均负载为多少时合理 平均负载与 CPU 使用率 平均负载案例分析 场景一:CPU 密集型进程 场景二:I/O 密集型 ...
- linux性能优化常用命令
作为一名linux系统管理员,最主要的工作是优化系统配置,使应用在系统上以最优的状态运行,但是由于硬件问题.软件问题.网络环境等的复杂性 和多变性,导致对系统的优化变得异常复杂,如何定位性能问题出在哪 ...
- linux性能优化cpu 磁盘IO MEM
系统优化是一项复杂.繁琐.长期的工作,优化前需要监测.采集.测试.评估,优化后也需要测试.采集.评估.监测,而且是一个长期和持续的过程,不 是说现在优化了,测试了,以后就可以一劳永逸了,也不是说书本上 ...
- linux 性能优化
linux的性能优化: 1.CPU,MEM 2.DISK--RAID 3.网络相关的外设,网卡 linux系统性能分析: top:linux系统的负载,CPU,MEM,SWAP,占用CPU和内存比较的 ...
随机推荐
- c语言学习之基础知识点介绍(一):输出语句和变量简单介绍
本系列是为了学习ios做准备的,也能作为c语言入门的教程看看. c语言的程序结构: 1.顺序结构:自上而下依次执行. 2.分支结构:程序有选择的执行某段代码或者不执行某段代码. 3.循环结构:程序循环 ...
- hibernate - Transaction not successfully started
今天在测试 transaction(使用事务进行管理)的时候, 总报错: Transaction not successfully started 可能有多种原因, 这位哥们总结得很好: Transa ...
- jsp - java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver
使用jsp连接数据库真的不那么容易,之前使用纯java连接sql Server 2008,都是很正常的,但是在使用jsp调用的时候,总是报错ClassNotFoundException.很郁闷 jar ...
- 关于Java中的数组转变成字符串问题
1.用StringBuilder private static String arraytoString(int arr[]){ StringBuilder sb=new StringBuilder( ...
- ACM HDU 2674 N! Again(数论)
继续数论.. Problem Description WhereIsHeroFrom: Zty,what are you doing ? Zty: ...
- postman本地或远程访问不了
问题postman: 问题描述: 1.手动测试过不去http://121.199.54.31:8081/suppliers/Split 2.localhost:8080/microshop-settl ...
- Dreamweaver安装jQuery插件jQuery_API.mxp
要让Dreamweaver支持jQuery自动提示代码功能,方法很简单,下载一个插件—jQuery_API.mxp[点击下载]. 在Dreamweaver里依次选择“命令” -> “扩展管理” ...
- wamp安装注意点!
安装wamp前或者重装系统后,默认没有依赖的组件VC11,需要先安装才能运行 下载地址:http://www.microsoft.com/en-us/download/details.aspx?id= ...
- thinkphp3.2 namespace及use用法
PHP 5.3中的namespace其实是个不错的东西,可以简化编程,下面介绍三类在代码中 访问namespace中类的方法 1 引用namespace和类 假设namespace的程序为name ...
- PHPCMS标签大全
{$head[title]} 页面标题,用法: {$phpcms[sitename]} 网站名称 用法: {$head[keywords]} 要害字 用法: {$head[description]} ...