??????????????????????????????в???????????????????? Mio ???????????裬????ο??????
??????????
??????? SELinux
??????????? CentOS/RedHat ??е???????????????? SELinux?????????????????????????????
??????????????? SELinux ??????
????$ sestatus
????SELinux status: disabled
?????????????????????????????????
????$ setenforce 0
????????? /etc/selinux/config ??????????? SELINUX=enforcing ??? SELINUX=disabled??
????????????
????$ cat /proc/sys/fs/file-nr
????3984 0 3255296
?????????????? 3255296 ????????????????????
????????????????????????С???????? 100w ?????????? ?????? /etc/sysctl.conf ?????????
????fs.file-max = 1020000
????net.ipv4.ip_conntrack_max = 1020000
????net.ipv4.netfilter.ip_conntrack_max = 1020000
?????????????????????Ч??
????sudo sysctl -p /etc/sysctl.conf
????????????
?????????????????????????????????? ulimit???????????????????
????$ ulimit -n
????1024
????????????????
????$ ulimit -n 1024000
?????????? /etc/security/limits.conf?? ?????
????* hard nofile 1024000
????* soft nofile 1024000
??????????????????????
??????????????? C1000K
??????????????????ù???????£?????????????????????????? C1000K??
?????????????????????????? SSDB ???????https://github.com/ideawu/c1000k??
??????÷????????????????????????????????????????????????????????
??????? NGINX ????
????user nginx;
????worker_processes 4;
????worker_cpu_affinity 0001 0010 0100 1000;
????events {
????worker_connections 10240;
????}
????????????????????????м???????
????· ???? OpenResty ??????????????? nginx???????????????? OpenResty ?????????????????????????????????á???????????????????????????
????· NGINX ?????????????? 4 ??????????????? 24 ??????????????????? NGINX ????????????? CPU????????????????????????????????У???????????? CPU ????????????
????· ???? CPU ????????? CPU ?????ò?????
????· ???????NGINX worker ?????????????
???????е???????????? NGINX 1.9.10 ????汾?п?????????????????????
????worker_processes auto;
????worker_cpu_affinity auto;
????????????
????????????????????? curl ????? Mio????????????????????????磺
????curl -i http://127.0.0.1/hello
????curl -i http://127.0.0.1:9090/status
????curl -i http://127.0.0.1:9090/summary
??????????????????????? logs/error.log ?????????????
?????????????????????????? NGINX ???????д?????????????????? chown ?????????????????chmod 777 ???????????????????а?????????ò????á?
??????????????? SELinux?????? chown ?????????????????????????????????????????????????????????????????:
????su nginx
?????л??????????£???????????????????????????????? ?????????? ????? chmod +x ???????
???????? /root/Mio/gateway ??????????? /root/Mio ??????????????? /root ???????????????? chmod +x ????????????????????????????
???????????
??????????????? wrk ??????????????????????????? NGINX worker ??????????? ab ???????????????
????wrk -t50 -c100 -d60s http://127.0.0.1/hello
????wrk ?????????????????? 50 ??????100 ?? http ????????????? 60 ???????????
????????????????У?24 ???32G??棬4?? NGINX worker??????????hello ????????????????
$ wrk -t50 -c100 -d60s http://127.0.0.1/hello
Running 1m test @ http://127.0.0.1/hello
50 threads and 100 connections
Thread Stats   Avg      Stdev     Max   +/- Stdev
Latency     0.89ms    1.74ms 149.47ms   99.79%
Req/Sec     2.36k   215.54     8.26k    81.96%
7046236 requests in 1.00m?? 1.31GB read
Requests/sec: 117242.66
Transfer/sec:     22.24MB
???????? Mio ?????????????????????
$ wrk -t50 -c100 -d60s http://127.0.0.1/hello
Running 1m test @ http://127.0.0.1/hello
50 threads and 100 connections
Thread Stats   Avg      Stdev     Max   +/- Stdev
Latency     1.40ms    3.72ms 243.67ms   99.79%
Req/Sec     1.57k   166.29     6.00k    82.67%
4676844 requests in 1.00m?? 0.87GB read
Requests/sec:  77818.01
Transfer/sec:     14.76MB
????????????? 33% ??????????????????????????????????????? ???????????????????????????????????????????????????????????????