你應該在數考慮是Avg error rate
,你的WP
+ Nginx
+ Memcached
配置看起來不算太差,所以我認爲這是不錯的選擇。 也許你可以增加memcached
中的-m
參數來匹配你的一半RAM。
但是: memcached
不能保證數據在內存中可用,並且您必須爲高速緩存未命中風暴做好準備。避免錯失風暴的一個有趣的方法是設置到期時間與一些隨機偏移量,例如10 + [0..10]分鐘,這意味着一些項目將被存儲10和其他20分鐘(目標是並非所有項目都同時過期)。
此外,無論你分配多少內存給memcached
,它只會使用它需要的數量,例如,它只分配實際使用的內存。 使用-k
選項,但是(在您的配置中被禁用),當啓動memcached
時,整個內存將被保留,因此無論它是否需要,它都會分配全部內存量。
這個451
連接數實際上可能會有所不同,這取決於。在執行基準測試時查看平均值總是一個好主意,也就是說,最好爲服務客戶端提供0%Avg error rate
和451
,而不是提供65%Avg error rate
和8200 +服務的客戶端。
但是,爲了卸載一些更多的資源,您可以使用額外的Wordpress緩存,有很多插件,我個人爲此寫了一個。
關於nginx
配置,你可以調整一些參數也存在:
worker_rlimit_nofile 100000;
worker_connections 4000;
# optmized to serve many clients with each thread, essential for linux use epoll;
# accept as many connections as possible,may flood worker connections if set too low
multi_accept on;
# cache informations about FDs, frequently accessed files
# can boost performance, but you need to test those values
open_file_cache max=200000 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
# to boost IO on HDD we can disable access logs
access_log off;
# copies data between one FD and other from within the kernel
# faster then read() + write()
sendfile on;
# send headers in one peace, its better then sending them one by one
tcp_nopush on;
# don't buffer data sent, good for small data bursts in real time
tcp_nodelay on;
# number of requests client can make over keep-alive -- for testing
keepalive_requests 100000;
# allow the server to close connection on non responding client, this will free up memory
reset_timedout_connection on;
# request timed out -- default 60
client_body_timeout 10;
# if client stop responding, free up memory -- default 60
send_timeout 2;
# reduce the data that needs to be sent over network
gzip on;
gzip_min_length 10240;
gzip_proxied expired no-cache no-store private auth;
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml;
gzip_disable "MSIE [1-6]\.";
由於#1可愛的功能,我不能發佈兩個以上的鏈路,這裏是配置文件: Nginx的:http://pastebin.com/H3YyKYdj Memcached的:http://pastebin.com/Jz4ZmqsP PHP-fpm:http://pastebin.com/BmxrQGVz – Rustypredator