标签:linux调优
01 Linux系统调优基础
#显示进行在哪个cpu上运行
[root@Controller ~]# ps axo psr,
2 ntpd
1 qpidd
3 pickup
3 sshd
0 bash
2 pscomm
#显示进行在哪个cpu上运行,并显示进程的pid
[root@Controller ~]# ps axo psr,comm,pid
2 ntpd 3775
1 qpidd 9998
3 pickup 26239
2 sshd 26448
1 bash 26450
1 ps 26496
#绑定进程号为9998的进程到第四颗CPU上
[root@Controller ~]# taskset -p -c 3 9998
pid 9998‘s current affinity list: 0-3
pid 9998‘s new affinity list: 3
#绑定进程号为3775的进程到第一或第二颗CPU上
[root@Controller ~]# taskset -p -c 1,2 3775
pid 3775‘s current affinity list: 0-3
pid 3775‘s new affinity list: 1,2
注意:该命令仅对当前进程有效,重启后无效
#显示中断
[root@Controller ~]# cat /proc/interrupts
02 Linux系统调优基础
[root@Controller ~]# sar -P ALL 1
[root@Controller ~]# iostat -c 1
[root@Controller ~]# vmstat 1
03 Linux系统调优基础
#释放缓存
[root@Controller vm]# echo 1 > /proc/sys/vm/drop_caches
[root@Controller ~]# cd /sys/block/sda/
[root@Controller sda]# ls queue/ /2\:0\:0\:0/block/sda/
add_random iostats minimum_io_size rotational
discard_granularity logical_block_size nomerges rq_affinity
discard_max_bytes max_hw_sectors_kb nr_requests scheduler
discard_zeroes_data max_sectors_kb optimal_io_size unpriv_sgio
hw_sector_size max_segments physical_block_size
iosched max_segment_size read_ahead_kb
[root@Controller sda]# ls queue/iosched/
back_seek_max fifo_expire_sync low_latency slice_async_rq
back_seek_penalty group_idle quantum slice_idle
fifo_expire_async group_isolation slice_async slice_sync
#显示磁盘调度算法
[root@Controller sda]# cat queue/scheduler
noop anticipatory deadline [cfq]
#更改磁盘调度算法
[root@Controller sda]# echo deadline > queue/scheduler
[root@Controller sda]# cat queue/scheduler
noop anticipatory [deadline] cfq
[root@Controller sda]# ls queue/iosched/
fifo_batch front_merges read_expire write_expire writes_starved
[root@Controller sda]# echo cfq > queue/scheduler
[root@Controller sda]# ls queue/iosched/
back_seek_max fifo_expire_sync low_latency slice_async_rq
back_seek_penalty group_idle quantum slice_idle
fifo_expire_async group_isolation slice_async slice_sync
本文出自 “追梦” 博客,请务必保留此出处http://sihua.blog.51cto.com/377227/1893019
标签:linux调优
原文地址:http://sihua.blog.51cto.com/377227/1893019