ChsOptimizations
hash琛
Ngnix浣跨敤hash琛ㄦ潵鍗忓姪瀹屾垚璇锋眰鐨勫揩閫熷鐞嗐
鑰冭檻鍒颁繚瀛橀敭鍙婂叾鍊肩殑hash琛ㄥ瓨鍌ㄥ崟鍏冪殑澶у皬涓嶈嚦浜庤秴鍑鸿瀹氬弬鏁(hash bucket size)锛 鍦ㄥ惎鍔ㄥ拰姣忔閲嶆柊閰嶇疆鏃讹紝Nginx涓篽ash琛ㄩ夋嫨灏藉彲鑳藉皬鐨勫昂瀵搞
鐩村埌hash琛ㄨ秴杩囧弬鏁(hash max size)鐨勫ぇ灏忔墠閲嶆柊杩涜閫夋嫨. 瀵逛簬澶у鏁癶ash琛ㄩ兘鏈夋寚浠ゆ潵淇敼杩欎簺鍙傛暟銆備緥濡傦紝淇濆瓨鏈嶅姟鍣ㄥ悕瀛楃殑hash琛ㄦ槸鐢辨寚浠 server_names_hash_max_size
鍜 server_names_hash_bucket_size
鎵鎺у埗鐨勩傚弬鏁癶ash bucket size鎬绘槸绛変簬hash琛ㄧ殑澶у皬锛屽苟涓旀槸涓璺鐞嗗櫒缂撳瓨澶у皬鐨勫嶆暟銆傚湪鍑忓皯浜嗗湪鍐呭瓨涓殑瀛樺彇娆℃暟鍚庯紝浣垮湪澶勭悊鍣ㄤ腑鍔犻熸煡鎵緃ash琛ㄩ敭鍊兼垚涓哄彲鑳姐傚鏋渉ash bucket size绛変簬涓璺鐞嗗櫒缂撳瓨鐨勫ぇ灏忥紝閭d箞鍦ㄦ煡鎵鹃敭鐨勬椂鍊欙紝鏈鍧忕殑鎯呭喌涓嬪湪鍐呭瓨涓煡鎵剧殑娆℃暟涓2銆傜涓娆℃槸纭畾瀛樺偍鍗曞厓鐨勫湴鍧锛岀浜屾鏄湪瀛樺偍鍗曞厓涓煡鎵鹃敭鍊笺傚洜姝わ紝濡傛灉Nginx缁欏嚭闇瑕佸澶 hash max size 鎴 hash bucket size鐨勬彁绀猴紝閭d箞棣栬鐨勬槸澧炲ぇ鍓嶄竴涓弬鏁扮殑澶у皬.
浜嬩欢妯″瀷
Nginx鏀寔濡備笅澶勭悊杩炴帴鐨勬柟娉曪紙I/O澶嶇敤鏂规硶锛夛紝杩欎簺鏂规硶鍙互閫氳繃use
鎸囦护鎸囧畾銆
- select - 鏍囧噯鏂规硶銆 濡傛灉褰撳墠骞冲彴娌℃湁鏇存湁鏁堢殑鏂规硶锛屽畠鏄紪璇戞椂榛樿鐨勬柟娉曘備綘鍙互浣跨敤閰嶇疆鍙傛暟
--with-select_module
鍜--without-select_module
鏉ュ惎鐢ㄦ垨绂佺敤杩欎釜妯″潡銆 - poll - 鏍囧噯鏂规硶銆 濡傛灉褰撳墠骞冲彴娌℃湁鏇存湁鏁堢殑鏂规硶锛屽畠鏄紪璇戞椂榛樿鐨勬柟娉曘備綘鍙互浣跨敤閰嶇疆鍙傛暟
--with-poll_module
鍜--without-poll_module
鏉ュ惎鐢ㄦ垨绂佺敤杩欎釜妯″潡銆 - kqueue - 楂樻晥鐨勬柟娉曪紝浣跨敤浜 FreeBSD 4.1+, OpenBSD 2.9+, NetBSD 2.0 鍜 MacOS X. 浣跨敤鍙屽鐞嗗櫒鐨凪acOS X绯荤粺浣跨敤kqueue鍙兘浼氶犳垚鍐呮牳宕╂簝銆
- epoll - 楂樻晥鐨勬柟娉曪紝浣跨敤浜嶭inux鍐呮牳2.6鐗堟湰鍙婁互鍚庣殑绯荤粺銆傚湪鏌愪簺鍙戣鐗堟湰涓紝濡係uSE 8.2, 鏈夎2.4鐗堟湰鐨勫唴鏍告敮鎸乪poll鐨勮ˉ涓併
- rtsig - 鍙墽琛岀殑瀹炴椂淇″彿锛屼娇鐢ㄤ簬Linux鍐呮牳鐗堟湰2.2.19浠ュ悗鐨勭郴缁熴傞粯璁ゆ儏鍐典笅鏁翠釜绯荤粺涓笉鑳藉嚭鐜板ぇ浜1024涓狿OSIX瀹炴椂(鎺掗槦)淇″彿銆傝繖绉嶆儏鍐靛浜庨珮璐熻浇鐨勬湇鍔″櫒鏉ヨ鏄綆鏁堢殑锛涙墍浠ユ湁蹇呰閫氳繃璋冭妭鍐呮牳鍙傛暟
/proc/sys/kernel/rtsig-max
鏉ュ鍔犻槦鍒楃殑澶у皬銆傚彲鏄粠Linux鍐呮牳鐗堟湰2.6.6-mm2寮濮嬶紝 杩欎釜鍙傛暟灏变笉鍐嶄娇鐢ㄤ簡锛屽苟涓斿浜庢瘡涓繘绋嬫湁涓涓嫭绔嬬殑淇″彿闃熷垪锛岃繖涓槦鍒楃殑澶у皬鍙互鐢 RLIMIT_SIGPENDING 鍙傛暟璋冭妭銆傚綋杩欎釜闃熷垪杩囦簬鎷ュ锛宯ginx灏辨斁寮冨畠骞朵笖寮濮嬩娇鐢poll
鏂规硶鏉ュ鐞嗚繛鎺ョ洿鍒版仮澶嶆甯搞 - /dev/poll - 楂樻晥鐨勬柟娉曪紝浣跨敤浜 Solaris 7 11/99+, HP/UX 11.22+ (eventport), IRIX 6.5.15+ 鍜 Tru64 UNIX 5.1A+.
- eventport - 楂樻晥鐨勬柟娉曪紝浣跨敤浜 Solaris 10. 涓轰簡闃叉鍑虹幇鍐呮牳宕╂簝鐨勯棶棰橈紝 鏈夊繀瑕佸畨瑁 杩欎釜 瀹夊叏琛ヤ竵銆