最近2018中文字幕在日韩欧美国产成人片_国产日韩精品一区二区在线_在线观看成年美女黄网色视频_国产精品一区三区五区_国产精彩刺激乱对白_看黄色黄大色黄片免费_人人超碰自拍cao_国产高清av在线_亚洲精品电影av_日韩美女尤物视频网站

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問(wèn)題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷解決方案
Nginx開(kāi)啟一個(gè)參數(shù)就能讓你的WEB性能提升3倍的方法-創(chuàng)新互聯(lián)

一、遇到的一些問(wèn)題

創(chuàng)新互聯(lián)服務(wù)項(xiàng)目包括廣水網(wǎng)站建設(shè)、廣水網(wǎng)站制作、廣水網(wǎng)頁(yè)制作以及廣水網(wǎng)絡(luò)營(yíng)銷策劃等。多年來(lái),我們專注于互聯(lián)網(wǎng)行業(yè),利用自身積累的技術(shù)優(yōu)勢(shì)、行業(yè)經(jīng)驗(yàn)、深度合作伙伴關(guān)系等,向廣大中小型企業(yè)、政府機(jī)構(gòu)等提供互聯(lián)網(wǎng)行業(yè)的解決方案,廣水網(wǎng)站推廣取得了明顯的社會(huì)效益與經(jīng)濟(jì)效益。目前,我們服務(wù)的客戶以成都為中心已經(jīng)輻射到廣水省份的部分城市,未來(lái)相信會(huì)繼續(xù)擴(kuò)大服務(wù)區(qū)域并繼續(xù)獲得客戶的支持與信任!

記得 2008 年做性能測(cè)試的時(shí)候,新進(jìn)7臺(tái) lenovo 4核4G 服務(wù)器用于性能測(cè)試。

當(dāng)時(shí)資源緊張,這7臺(tái)服務(wù)器都裝了雙系統(tǒng)(Win2003/CentOS5)空閑時(shí)用于做測(cè)試機(jī)(壓測(cè)的Agent)。

當(dāng)時(shí)給Nginx做了一系列測(cè)試,印象很深的是:在這批機(jī)器上,Nginx狀態(tài)頁(yè)面的壓測(cè)。

短連接的話最佳QPS約4萬(wàn),長(zhǎng)連接的話最高QPS約13萬(wàn)。

大概3年后,那批 lenovo 服務(wù)器已經(jīng)沒(méi)人瞧得上了,只能做肉雞。

然而,一次不經(jīng)意的測(cè)試,發(fā)現(xiàn)再牛的服務(wù)器,短連接最佳QPS也高不了多少。而且,測(cè)試機(jī)的資源沒(méi)用完,被測(cè)試服務(wù)器的資源也用不完,網(wǎng)絡(luò)也沒(méi)瓶頸。

服務(wù)器資源使用率很低,然而響應(yīng)就是不夠快。

最后,我們發(fā)現(xiàn)了瓶頸在監(jiān)聽(tīng)的入口!是否可以提高監(jiān)聽(tīng)入口的性能?是否可以端口復(fù)用?最后我們找到了SO_REUSEPORT。

SO_REUSEPORT支持多個(gè)進(jìn)程或者線程綁定到同一端口,提高服務(wù)器程序的性能。

二、解決方案

測(cè)試環(huán)境

 Dell PowerEdge M620 Intel(R)Xeon(R)CPU E5–[email protected]
Linux3.16.0–4–amd64#1 SMP Debian 3.16.7-ckt11-1+deb8u3 (2015-08-04) x86_64 GNU/Linux
Ethernet controller:Broadcom Corporation NetXtreme II BCM5781010Gigabit Ethernet(rev10)

查看編譯參數(shù)

Nginx 配置如下:

注意有一個(gè)reuse_port參數(shù)

user www–data;
worker_processes auto;
pid/run/nginx.pid;
events{
useepoll;
multi_accept on;
reuse_port on;
worker_connections 1048576;
}
dso{# 動(dòng)態(tài)加載功能模塊 /usr/share/nginx/modules
load ngx_http_memcached_module.so;
load ngx_http_limit_conn_module.so;
load ngx_http_empty_gif_module.so;
load ngx_http_scgi_module.so;
load ngx_http_upstream_session_sticky_module.so;
load ngx_http_user_agent_module.so;
load ngx_http_referer_module.so;
load ngx_http_upstream_least_conn_module.so;
load ngx_http_uwsgi_module.so;
load ngx_http_reqstat_module.so;
load ngx_http_browser_module.so;
load ngx_http_limit_req_module.so;
load ngx_http_split_clients_module.so;
load ngx_http_upstream_ip_hash_module.so;
}
http{
include    /etc/nginx/mime.types;
default_type text/plain;
access_log off;
sendfile    on;
tcp_nopush  on;
tcp_nodelay  on;
server_tokens off;
keepalive_timeout 120;
server_names_hash_bucket_size512;
server_name_in_redirect off;
fastcgi_connect_timeout3s;
fastcgi_send_timeout3s;
fastcgi_read_timeout3s;
fastcgi_buffer_size128k;
fastcgi_buffers8128k;
fastcgi_busy_buffers_size256k;
fastcgi_temp_file_write_size256k;
variables_hash_max_size 1024;
set_real_ip_from10.0.0.0/8;
set_real_ip_from172.28.0.0/16;
set_real_ip_from192.168.0.0/16;
real_ip_headerX–Forwarded–For;
gzip off;
gzip_disable“msie6”;
gzip_min_length2k;
gzip_buffers1664k;
gzip_http_version1.1;
gzip_comp_level6;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
gzip_vary on;
ssl_protocols TLSv1 TLSv1.1TLSv1.2;# Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
access_log/var/log/nginx/access.log;
error_log/var/log/nginx/error.log;
server{
listen    80backlog=65535;
charset utf–8;
location/{# 打印Tengine狀態(tài)頁(yè)
stub_status on;# 開(kāi)啟狀態(tài)頁(yè),依賴 http_stub_status_module 模塊
access_log off;#訪問(wèn)過(guò)程不記日志
}
location~^(.*)\/\.(svn|git|hg|bzr|cvs)\/{# 屏蔽這些目錄
deny all;
access_log off;
log_not_found off;
}
location~/\.{# 屏蔽.開(kāi)頭的目錄或文件,比如 .htaccess .bash_history
deny all;
access_log off;
log_not_found off;
}
location/do_not_delete.html{
access_log off;
empty_gif;
}
}
}

網(wǎng)站欄目:Nginx開(kāi)啟一個(gè)參數(shù)就能讓你的WEB性能提升3倍的方法-創(chuàng)新互聯(lián)
文章分享:http://fisionsoft.com.cn/article/dcedge.html