トップ 差分 一覧 ソース 検索 ヘルプ RSS ログイン

LN-Kernel


説明


kernel.sysrq=1
kernel.shmmax=4000000000
kernel.sem=1100 35406 200 800
kernel.msgmax=32768
kernel.msgmin=4670
kernel.threads-max=4096
kernel.shmmni=4315
kernel.msgmnb=4194303
fs.file-max=32768
net.core.rmem_max=1048576
net.core.wmem_max=1048576
net.core.rmem_default=65535
net.core.wmem_default=65535
net.core.optmem_max=20480
net.ipv4.tcp_rmem=4096 87380 1048576
net.ipv4.tcp_wmem=4096 16384 1048576
net.ipv4.tcp_mem=1048576 1048576 1048576
vm.bdflush=30 500 0 0 60 300 60 0 0
echo "250 32000 128 1024" > /proc/sys/kernel/sem
echo "256" > /proc/sys/kernel/msgmni
echo "10" >  /proc/sys/net/ipv4/tcp_fin_timeout

echo "1048576" >  /proc/sys/net/core/rmem_max
echo "1048576" >  /proc/sys/net/core/wmem_max
echo "65535"   >  /proc/sys/net/core/rmem_default
echo "65535"   >  /proc/sys/net/core/wmem_default
echo "20480" >  /proc/sys/net/core/optmem_max
echo ""
echo "4096 87380 1048576" >   /proc/sys/net/ipv4/tcp_rmem
echo "4096 87380 1048576" >  /proc/sys/net/ipv4/tcp_wmem
echo "1048576 1048576 1048576" >  /proc/sys/net/ipv4/tcp_mem
echo "30 500 0 0 60 300 60 0 0" > /proc/sys/vm/bdflush 
echo "32768" > /proc/sys/fs/file-max

cat /proc/sys/net/core/rmem_max
cat /proc/sys/net/core/wmem_max
cat /proc/sys/net/core/rmem_default
cat /proc/sys/net/core/wmem_default
cat /proc/sys/net/core/optmem_max
echo ""
cat /proc/sys/net/ipv4/tcp_rmem
cat /proc/sys/net/ipv4/tcp_wmem
cat /proc/sys/net/ipv4/tcp_mem
echo ""
cat /proc/sys/fs/file-max 
cat /proc/sys/vm/bdflush

/usr/local/tomcat
# Use TCP syncookies when needed
net.ipv4.tcp_syncookies = 1
# Enable TCP window scaling
net.ipv4.tcp_window_scaling: = 1
# Increase TCP max buffer size
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
# Increase Linux autotuning TCP buffer limits
net.ipv4.tcp_rmem = 4096 87380 16777216 
net.ipv4.tcp_wmem = 4096 65536 16777216
# Increase number of ports available
net.ipv4.ip_local_port_range = 1024 65000

---

echo "HAL"
echo ""
# Use TCP syncookies when needed
# net.ipv4.tcp_syncookies = 1
cat /proc/sys/net/ipv4/tcp_syncookies 
# Enable TCP window scaling
# net.ipv4.tcp_window_scaling: = 1
cat /proc/sys/net/ipv4/tcp_window_scaling
# Increase TCP max buffer size
# net.core.rmem_max = 16777216
cat /proc/sys/net/core/rmem_max
# net.core.wmem_max = 16777216
cat /proc/sys/net/core/wmem_max
# Increase Linux autotuning TCP buffer limits
# net.ipv4.tcp_rmem = 4096 87380 16777216 
cat /proc/sys/net/ipv4/tcp_rmem
# net.ipv4.tcp_wmem = 4096 65536 16777216
cat /proc/sys/net/ipv4/tcp_wmem
# Increase number of ports available
# net.ipv4.ip_local_port_range = 1024 65000

cat /proc/sys/net/ipv4/ip_local_port_range 

PHP-CMS

net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_fin_timeout = 30
## check #$ netstat -anpto

kernel.sem=1100 35406 200 800
kernel.msgmnb=4194303

Adobe Media Serverhttp://www.adobe.com/devnet/adobe-media-server/articles/performance_tuning_webcasts.html

# Disable response to broadcasts.
# You don't want yourself becoming a Smurf amplifier.
net.ipv4.icmp_echo_ignore_broadcasts = 1

# Filter packets not meant for this network.
net.ipv4.conf.eth0.rp_filter=1
net.ipv4.conf.lo.rp_filter=1
net.ipv4.conf.default.rp_filter=1
net.ipv4.conf.all.rp_filter=1

net.core.rmem_max = 16777216
net.core.wmem_max = 16777216

# increase Linux autotuning TCP buffer limits
# min, default, and max number of bytes to use
net.ipv4.tcp_rmem = 4096 10000000 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216

# Disabling the following parameters will prevent a hacker
# from using a spoofing attack against the IP address of the server.
net.ipv4.conf.eth0.accept_source_route=0
net.ipv4.conf.lo.accept_source_route=0
net.ipv4.conf.default.accept_source_route=0
net.ipv4.conf.all.accept_source_route=0

# These commands configure the server to ignore redirects from
# machines that are listed as gateways. Redirects can be used to
# perform attacks, so we only want to allow them from trusted sources.
net.ipv4.conf.eth0.secure_redirects=1
net.ipv4.conf.lo.secure_redirects=1
net.ipv4.conf.default.secure_redirects=1
net.ipv4.conf.all.secure_redirects=1

#  Don't allow ICMP redirects
net.ipv4.conf.eth0.accept_redirects=0
net.ipv4.conf.lo.accept_redirects=0
net.ipv4.conf.default.accept_redirects=0
net.ipv4.conf.all.accept_redirects=0

# If the server does not act as a router, it does not need to
# send redirects.
net.ipv4.conf.eth0.send_redirects=0
net.ipv4.conf.lo.send_redirects=0
net.ipv4.conf.default.send_redirects=0
net.ipv4.conf.all.send_redirects=0

# For servers that receive many connections at the same time, the
# TIME-WAIT sockets for new connections can be reused. This is useful
# in Web servers, seems to be good for Flash servers as well.
net.ipv4.tcp_tw_reuse=1
net.ipv4.tcp_fin_timeout=30

# Move keepalive from 2hrs to 30 min. You may want to tune this up or down depending  on your implementation
net.ipv4.tcp_keepalive_time=1800

# Help protect from denial-of-service (syn-flood) attack.
net.ipv4.tcp_max_syn_backlog=4096

CentOS6

# 共有メモリの最大サイズ。変更
kernel.shmmax = 8073741824
# システム全体の共有メモリ・ページの最大数
kernel.shmall = 262144
# システム全体のプロセス数の上限
kernel.threads-max = 1060863
# システム全体のファイルディスクリプタの上限
fs.file-max = 5242880
# RFC1323のTCPウィンドウ スケーリングを有効
net.ipv4.tcp_window_scaling = 1
# データ送信バッファ サイズ
net.ipv4.tcp_wmem = 4096 65536 16777216
# TCPソケットが受け付けた接続要求を格納するキューの最大長
net.core.somaxconn=4096
# カーネルがキューイング可能なパケットの最大個数
net.core.netdev_max_backlog=4096
# ソケット当たりのSYNを受け付けてACKを受け取っていない状態のコネクションの保持可能数
net.ipv4.tcp_max_syn_backlog=4096
# ネットワークのルート・メトリクスの保持を無効化
net.ipv4.tcp_no_metrics_save=1
# スプーフィング対策 送信元IPの偽装防止
net.ipv4.conf.all.rp_filter = 1
# RFC1337に準拠させる。
# TIME_WAIT状態のときにRSTを受信した場合、TIME_WAIT期間の終了を待たずにそのソケットをクローズする
net.ipv4.tcp_rfc1337 = 1
# SYN flood攻撃対策。
net.ipv4.tcp_syncookies = 1
# OOM killer 対策
# メモリオーバーコミットを無効
vm.overcommit_memory = 2
# mallocにより確保するメモリ量の上限(%)を指定
vm.overcommit_ratio = 95
# kernel panicで自動再起動
kernel.panic=10
# TCP/IPの送信用ポート範囲の変更
net.ipv4.ip_local_port_range = 1024 65535
# TCP: time wait bucket table overflow の解消とTIME_WAITを減らすチューニング
# tcp_tw_recycle
net.ipv4.tcp_tw_recycle = 1
# TIME_OUT 状態のコネクションを再利用
net.ipv4.tcp_tw_reuse = 1
# FIN-WAIT2からTIME_WAITに遷移する時間の設定(秒)
net.ipv4.tcp_fin_timeout = 10
# NAT/Softbank携帯対策。tcp_timestamps を無効にする。
net.ipv4.tcp_timestamps = 0
# CLOSE_WAITを減らす対策
# アイドル接続状態のTCP接続に対し検査する頻度
net.ipv4.tcp_keepalive_time = 10
# TCP/IP が、既存の接続で応答されていないキープアライブ・メッセージを再送する回数
net.ipv4.tcp_keepalive_probes = 2
# 相手側からのキープアライブ応答から受信されない場合に、TCP/IP がキープアライブ送信を繰り返す頻度
net.ipv4.tcp_keepalive_intvl = 3

squid

# fs.file-max = 65535 ## 
net.core.rmem_default = 262144
net.core.rmem_max = 262144
net.core.wmem_default = 262144
net.core.wmem_max = 262144
net.ipv4.tcp_rmem = 4096 87380 8388608
net.ipv4.tcp_wmem = 4096 65536 8388608
# net.ipv4.tcp_mem = 4096 4096 4096
net.ipv4.tcp_low_latency = 1
net.core.netdev_max_backlog = 4096
# net.ipv4.ip_local_port_range = 1024 65000
net.ipv4.tcp_max_syn_backlog = 16384

/proc 配下

 cmdline  	システムのブートパラメータ
 version 	カーネルバージョン
 cpuinfo 	CPU情報
 uptime 	システム動作時間
 devices 	デバイスとメジャー番号の対応
 partitions 	認識されたパーティション一覧
 filesystems 	サポートするファイルシステムタイプ
 interrupts 	プロセッサへの割り込み要因のリスト
 pci  PCI 認識しているハードウェア情報
 ioports IOports 認識しているハードウェア情報
 iomem  I/O mem 認識しているハードウェア情報
 interrupts 	認識しているハードウェア情報
 swaps 	スワップファイル一覧
 locks 	ファイルロックのリスト
 loadavg 	ロードアベレージ
 stat 	システム状態
 meminfo 	空きメモリ情報
 slabinfo 	スラブキャッシュの状態

# 使い方
cat /proc/interrupts

バージョンの確認

Suse のバージョン
$ cat /etc/SuSE-release

Cent-OS / Debian
$ cat /etc/issue
RedHat
$ cat /etc/redhat-release

Fedora
# cat /etc/fedora-release

SWAP の追加

dd if=/dev/zero of=/home/swap bs=1M count=2048
mkswap /home/swap
swapon /home/swap
/etc/fstab に追加
/swap    swap    swap    defaults    0    0

postfix-admin-sqlite C31009a

kernel.msgmax = 32768
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_fin_timeout = 30
kernel.msgmnb = 4194303
net.core.netdev_max_backlog = 16384
net.core.somaxconn = 8192
net.core.rmem_default = 1048576
net.core.rmem_max = 16777216
net.core.wmem_default = 1048576
net.core.wmem_max = 16777216
net.ipv4.tcp_fastopen = 3
net.ipv4.tcp_max_syn_backlog = 8192
fs.file-max = 5242880
kernel.threads-max = 1060863
net.ipv4.tcp_no_metrics_save = 1
net.ipv4.conf.all.rp_filter = 1
net.ipv4.tcp_rfc1337 = 1
net.ipv4.tcp_syncookies = 1
vm.overcommit_memory = 2
vm.overcommit_ratio = 75
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_fin_timeout = 10
net.ipv4.tcp_keepalive_time = 10
net.ipv4.tcp_keepalive_probes = 2
net.ipv4.tcp_keepalive_intvl = 3