服務器的負載能力
配置Sysctl
編輯此文件
nano
如果該文件為空
# Controls source route verification
# Default should work for all interfaces
nf
# nf
# nf
# nf
# Disables IP source routing
# Default should work for all interfaces
nf
# nf
# nf
# nf
# Controls the System Request debugging functionality of the kernel
kernel
# Controls whether core dumps will append the PID to the core filename
# Useful for debugging multi
re_uses_pid =
# Increase maximum amount of memory allocated to shm
# Only uncomment if needed!
# kernel
# Disable ICMP Redirect Acceptance
# Default should work for all interfaces
nf
# nf
# nf
# nf
# Enable Log Spoofed Packets
# Default should work for all interfaces
nf
# nf
# nf
# nf
# Decrease the time default value for tcp_fin_timeout connection
net
# Decrease the time default value for tcp_keepalive_time connection
net
# Turn on the tcp_window_scaling
net
# Turn on the tcp_sack
net
# tcp_fack should be on because of sack
net
# Turn on the tcp_timestamps
net
# Enable TCP SYN Cookie Protection
net
# Enable ignoring broadcasts request
net
# Enable bad error message Protection
net
# Make more local ports available
# net
# Set TCP Re
net
# Lower syn retry rates
net
net
# Set Max SYN Backlog to
net
# Various Settings
dev_max_backlog =
# Increase the maximum number of skb
re
# Increase the tcp
net
# This will increase the amount of memory available for socket input/output queues
re
re
net
re
re
net
net
re
如果希望屏蔽別人 ping 你的主機
# Disable ping requests
net
編輯完成後
/sbin/sysctl
/sbin/sysctl
MySQL優化
編輯MySQL的配置文件
nano /etc/f
輸入以下內容
[mysqld]
connect_timeout=
interactive_timeout=
join_buffer_size=
key_buffer=
max_allowed_packet=
max_connections=
max_connect_errors=
myisam_sort_buffer_size=
read_buffer_size=
read_rnd_buffer_size=
sort_buffer_size=
table_cache=
thread_cache_size=
thread_concurrency=
wait_timeout=
query_cache_size=
query_cache_limit=
query_cache_type=
skip
請注意
Apache優化
以下優化適用於 Apache
確認 Apache 的配置文件位置並開始編輯
locate
nano
的文件有許多內容
KeepAlive On
MaxKeepAliveRequests
KeepAliveTimeout
MinSpareServers
MaxSpareServers
MaxRequestsPerChild
將 KeepAliveTimeout 設定到較小的數字將有助於減少服務器上的無用等待鏈接
另外
ServerSignature Off
ServerTokens ProductOnly
將 ServerSignature 關閉
以上所做的這些優化在某種程度上會增強服務器的負載性能
From:http://tw.wingwit.com/Article/program/MySQL/201311/29461.html