linux优化

1、 增加内存到4G

2、 IO进行优化

https://www.percona.com/blog/2009/01/30/linux-schedulers-in-tpcc-like-benchmark/

http://yoshinorimatsunobu.blogspot.com/2009/04/linux-io-scheduler-queue-size-and.html

echo deadline > /sys/block//queue/scheduler(使用deadline调度算法)

增大  /sys/block/sda/queue/read_ahead_kb 对顺序读的操作有所提升

/sys/block/sda/queue/nr_requests 此为请求队列数 (增大会消耗更多内存)

三、网络优化

  http://docs.continuent.com/continuent-tungsten-2.0/performance-networking.html

net.core.somaxconn 调大

net.core.netdev_max_backlog

net.ipv4.ip_local_port_range 调大 原为30000 61000 调为 1024 65536

net.ipv4.tcp_fin_timeout调小 原为60

net.ipv4. tcp_tw_recycle  调为1 原为0

net.ipv4. tcp_tw_reuse    调为1 原为0

net.ipv4.tcp_synack_retries 调为2 原为5

net.ipv4.tcp_rfc1337 = 1

查看网址:

四、php优化

使用APC缓存模块缓存php编译文件,减少重新编译次数(适应于不经常改动PHP的网站)

优化php-fpm

pm.max_children (调小,进程堆积导致cpu进程切换,从而使负载过高)

pm.max_requests (调大,减少创建php-fpm次数)

五、mysql优化

flush query cache(cron 每15分钟刷新缓存)

#mysqlcheck –Aao (优化所有表)

使用memcache 缓存查询

六、文件系统优化

关闭访问时间: noatime,nodiratime /etc/fstab

七、nginx优化

Multi_accept on

client_body_timeout 12; (仿止慢连接)

client_header_timeout 12;(仿止慢连接)

open_file_cache    max=1000 inactive=20s

open_file_cache_valid 30s

open_file_cache_min_uses 5


   

你可能感兴趣的:(linux优化)