Nginx上配置WebSocket

下面是wss://ssl.highlight.top/score/的配置

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
http {
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}

upstream wsbackend{
server localhost:58880; # ws://ip:port
}

server {
listen 443 ssl;
server_name ssl.highlight.top;
keepalive_timeout 70;

ssl_certificate ssl.highlight.top.pem; # 下载自阿里云的免费ssl
ssl_certificate_key ssl.highlight.top.key; # 这两个文件放在和nginx.conf同一目录
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;

location /score/ {
proxy_pass http://wsbackend;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
}
}

阅读全文

Linux性能优化-实验报告28(TBD)

1
2
git clone https://github.com/feiskyer/linux-perf-examples
cd linux-perf-examples/mysql-slow

阅读全文

Linux性能优化-实验报告27

1
docker run --name=app -p 10000:80 -itd feisky/word-pop

阅读全文

Node.js获取文件MD5例子

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function md5(filename, cb) {
const crypto = require('crypto');
const fs = require('fs');

const hash = crypto.createHash('md5');

const input = fs.createReadStream(filename);
input.on('readable', () => {
// Only one element is going to be produced by the
// hash stream.
const data = input.read();
if (data)
hash.update(data);
else {
cb(hash.digest('hex'));
}
});
}

const filename = "/tmp/test.xt";

md5(filename, result => {
console.log(filename + " md5: ", result)
})

阅读全文

怎样使用iframe套用其他网页

1
<iframe style="position:fixed; top:0; left:0; bottom:0; right:0; width:100%; height:100%; border:none; margin:0; padding:0; overflow:hidden; z-index:999999;" src="" frameborder="0"></iframe>

阅读全文

怎样清除Mac的DNS缓存

1
sudo killall -HUP mDNSResponder

阅读全文

Linux性能优化-实验报告26

1
docker run -v /tmp:/tmp --name=app -itd feisky/logapp

阅读全文

Linux性能优化-实验报告23

最后留的问题做的实验。看的下面的评论,我自己使用的bcc cachetop,但看结果毫无变化

1
2
# cachetop #使用了echo 3 >/proc/sys/vm/drop_caches,但结果一直是下面的情况
09:50:57 Buffers MB: 6202 / Cached MB: 386 / Sort: HITS / Order: ascending

阅读全文

Linux性能优化-实验报告19

1
2
3
4
5
6
7
8
root@perf:/home/ykg# numactl --hardware
available: 1 nodes (0)
node 0 cpus: 0 1
node 0 size: 7952 MB
node 0 free: 6841 MB
node distances:
node 0
0: 10

阅读全文

Linux性能优化-实验报告18

1
2
3
4
5
6
7
8
# install sysstat docker
sudo apt-get install -y sysstat docker.io

# Install bcc
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 4052245BD4284CDD
echo "deb https://repo.iovisor.org/apt/bionic bionic main" | sudo tee /etc/apt/sources.list.d/iovisor.list
sudo apt-get update
sudo apt-get install -y bcc-tools libbcc-examples linux-headers-$(uname -r)

阅读全文