最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

nginx性能優(yōu)化的6種方向

2023-02-16 09:46 作者:學(xué)酥兩支筆  | 我要投稿

思路:

多進(jìn)程 multiprocessing

輸入輸出 IO (DIO、AIO Asynchronous)

緩沖區(qū) buffer 針對時間,分批,write-buffer

快速緩沖貯存區(qū) cache 針對存儲,分塊,read-cache,大多數(shù)時候用cache代替buffer可以

通用網(wǎng)關(guān)接口 fastcgi(Common Gateway Interface)


1 multiprocessing

grep ^processor /proc/cpuinfo | wc -l

vim /etc/nginx/nginx.conf

vim /etc/nginx/conf.d/default.conf

worker_processes auto

systemctl restart nginx

ps -aux | grep nginx |grep -v grep


2 IO

事件處理模型

events {

use epoll;

}

windows中是kqueue


3 buffer

vim /etc/nginx/nginx.conf

client_body_buffer_size 512k;


4 cache?

為1,000個元素定義了一個緩存,到期時間為60秒

http

{

? ?open_file_cache max=1000 inactive=60s;

}


5 fastcgi

mkdir /home/www/cache

vim /etc/nginx/conf.d/default.conf

server外添加

fastcgi_cache_path /home/www/cache levels=1:2 keys_zone=MYAPP:100m inactive=60m;

fastcgi_cache_key "schemerequest_methodhostrequest_uri";

php中添加

fastcgi_cache MYAPP;

fastcgi_cache_valid 200 60m;

systemctl reload nginx


6 expire

可以在http段中或者server段中或者location段中加入

root? ?/home/www/wuye/public;

? ? ? ? location ~ .*\.(gif|jpg|jpeg|png|bmp|swf|ico)$

? ? ? ? {

? ? ? ? ? ? expires? ? ? 1d;

? ? ? ? }


? ? ? ? location ~ .*\.(js|css)?$

? ? ? ? {

? ? ? ? ? ? expires? ? ? 1h;

? ? ? ? }


nginx性能優(yōu)化的6種方向的評論 (共 條)

分享到微博請遵守國家法律
绥棱县| 竹山县| 中超| 盐池县| 武汉市| 藁城市| 原平市| 龙江县| 子长县| 泸水县| 县级市| 沅江市| 宁津县| 通州市| 古交市| 彰化县| 昭平县| 遂宁市| 新乡县| 苏尼特右旗| 永春县| 吴桥县| 元朗区| 青州市| 乐平市| 曲麻莱县| 中方县| 蓬莱市| 伊通| 新郑市| 山西省| 台江县| 靖江市| 彰化县| 屯门区| 英吉沙县| 淮北市| 双柏县| 张北县| 宁国市| 恩平市|