61 Linux系统调优基础
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了61 Linux系统调优基础相关的知识,希望对你有一定的参考价值。
01 Linux系统调优基础
#显示进行在哪个cpu上运行
[[email protected] ~]# ps axo psr,
2 ntpd
1 qpidd
3 pickup
3 sshd
0 bash
2 pscomm
#显示进行在哪个cpu上运行,并显示进程的pid
[[email protected] ~]# 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上
[[email protected] ~]# taskset -p -c 3 9998
pid 9998‘s current affinity list: 0-3
pid 9998‘s new affinity list: 3
#绑定进程号为3775的进程到第一或第二颗CPU上
[[email protected] ~]# taskset -p -c 1,2 3775
pid 3775‘s current affinity list: 0-3
pid 3775‘s new affinity list: 1,2
注意:该命令仅对当前进程有效,重启后无效
#显示中断
[[email protected] ~]# cat /proc/interrupts
02 Linux系统调优基础
[[email protected] ~]# sar -P ALL 1
[[email protected] ~]# iostat -c 1
[[email protected] ~]# vmstat 1
03 Linux系统调优基础
#释放缓存
[[email protected] vm]# echo 1 > /proc/sys/vm/drop_caches
[[email protected] ~]# cd /sys/block/sda/
[[email protected] 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
[[email protected] 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
#显示磁盘调度算法
[[email protected] sda]# cat queue/scheduler
noop anticipatory deadline [cfq]
#更改磁盘调度算法
[[email protected] sda]# echo deadline > queue/scheduler
[[email protected] sda]# cat queue/scheduler
noop anticipatory [deadline] cfq
[[email protected] sda]# ls queue/iosched/
fifo_batch front_merges read_expire write_expire writes_starved
[[email protected] sda]# echo cfq > queue/scheduler
[[email protected] 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
以上是关于61 Linux系统调优基础的主要内容,如果未能解决你的问题,请参考以下文章