主要目的是想相互学习,我想大家都各自优化freebsd的方法,也使用着不同配置的服务器,但有谁能知道自己的服务器已经到最好了,有没有更好的优化法?所以希望大家说说自己的情况,并且越详细越好。这样能及时发现自己的不足,取长补短。
我先说说我的:
硬件:
CPU Xeon 3.0 MEM 2G SATA RAID1 200G
软件:
FreeBSD 6.1 apache1.3.27 + php 5.2.0 + mysql5.0.27 + squid/2.5.STABLE14
运行:
discuz 5.0.0 在线时间统计为论坛默认的,最高2046(某电影同名……),平时在线1400~2000浮动
优化参数:
sysctl:
net.inet.tcp.sendspace=65535
net.inet.tcp.recvspace=65535
#net.inet.udp.recvspace=65535
#net.inet.udp.maxdgram=65535
net.local.stream.sendspace=65535
net.inet.tcp.rfc1323=1
net.inet.tcp.rfc3042=1
net.inet.tcp.rfc3390=1
net.inet.icmp.drop_redirect=1
net.inet.icmp.log_redirect=1
net.inet.ip.redirect=0
net.inet.icmp.bmcastecho=0
net.inet.icmp.maskrepl=0
net.inet.icmp.icmplim=50
net.inet.icmp.icmplim_output=0
net.inet.tcp.always_keepalive=1
net.inet.tcp.msl=7200
net.inet.tcp.blackhole=2
#net.inet.udp.blackhole=1
net.inet.tcp.inflight.enable=1
kern.ipc.somaxconn=4096
net.inet.udp.checksum=1
net.local.stream.recvspace=65535
net.local.dgram.maxdgram=65535
net.local.dgram.recvspace=65535
net.inet.raw.maxdgram=65535
net.inet.ip.ttl=128
kern.coredump=0
net.isr.direct=1
kern.polling.enable=1
net.inet.tcp.mssdflt=1460
mysql:
[mysqld]
port = 3306
socket = /tmp/mysql.sock
skip-locking
#skip-bdb
skip-name-resolve
key_buffer = 256M
max_allowed_packet = 2M
# table_cache=max_connections
table_cache = 1536
sort_buffer_size = 8M
read_buffer_size = 2M
myisam_sort_buffer_size = 64M
thread_cache_size = 64
query_cache_size = 32M
tmp_table_size = 96M
connect_timeout = 5
max_connections = 1024
back_log = 512
wait_timeout = 30
record_buffer = 8M
long_query_time = 10
join_buffer_size = 1M
max_heap_table_size = 8M
squid:
http_port 222.217.221.160:80
icp_port 0
#dns_children 20
#redirect_children 20
cache_mgr [email]iceblood@163.com[/email]
cache_effective_user squid
cache_effective_group squid
cache_dir ufs /backup/webcache 4096 16 256
cache_mem 128 MB
cache_swap_low 90
cache_swap_high 95
acl all src 0.0.0.0/0
acl tar dst 172.16.1.0/29 221.7.172.132/32
acl me src 127.0.0.1
#acl conncount maxconn 15
#httpd_access deny conncount
#client_db off
httpd_accel_with_proxy on
httpd_accel_uses_host_header on
httpd_accel_host 172.16.1.1
httpd_accel_port 80
tcp_outgoing_address 172.16.1.1
http_access allow tar
cache_log /var/log/squid/cache.log
pid_filename /var/run/squid.pid
cache_access_log /var/log/squid/access.log
cache_store_log none
#cache_store_log /var/log/squid/store.log
#acl AdminBoxes src 127.0.0.1 172.16.1.0/24
#acl Purge method PURGE
#http_access allow AdminBoxes Purge
#http_access deny Purge
#
refresh_pattern -i \.html$ 1440 90% 129600 reload-into-ims
refresh_pattern -i \.shtml$ 1440 90% 129600 reload-into-ims
refresh_pattern -i \.hml$ 1440 90% 129600 reload-into-ims
refresh_pattern -i \.gif$ 1440 90% 129600 reload-into-ims
refresh_pattern -i \.swf 1440 90% 129600 reload-into-ims
refresh_pattern -i \.jpg$ 1440 90% 129600 reload-into-ims
refresh_pattern -i \.png$ 1440 90% 129600 reload-into-ims
refresh_pattern -i \.bmp$ 1440 90% 129600 reload-into-ims
refresh_pattern -i \.js$ 1440 90% 129600 reload-into-ims
#acl nocachefile url_regex \.swf$
#no_cache deny nocachefile
read_timeout 1 minutes
client_lifetime 1 minutes
half_closed_clients Off
apache:
Timeout 20
KeepAlive Off
MaxKeepAliveRequests 100
KeepAliveTimeout 5
MinSpareServers 32
MaxSpareServers 64
StartServers 32
MaxClients 150
MaxRequestsPerChild 0
Listen 172.16.1.1:80
LoadModule config_log_module libexec/apache/mod_log_config.so
LoadModule mime_module libexec/apache/mod_mime.so
LoadModule negotiation_module libexec/apache/mod_negotiation.so
LoadModule includes_module libexec/apache/mod_include.so
LoadModule dir_module libexec/apache/mod_dir.so
LoadModule alias_module libexec/apache/mod_alias.so
LoadModule access_module libexec/apache/mod_access.so
LoadModule auth_module libexec/apache/mod_auth.so
LoadModule php5_module libexec/apache/libphp5.so
LoadModule gzip_module libexec/apache/mod_gzip.so
