-
Notifications
You must be signed in to change notification settings - Fork 1
/
note.txt
100 lines (78 loc) · 3.4 KB
/
note.txt
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
--------------------------------------------------
Code example: generating a heap dump via code
--------------------------------------------------
const heapdump = require('heapdump');
// Check if request is authorized
function isAuthorized(req) {
// ...
}
router.get('/ops/heapdump', (req, res, next) => {
if (!isAuthorized(req)) {
return res.status(403).send('You are not authorized!');
}
logger.info('About to generate heapdump');
heapdump.writeSnapshot((err, filename) => {
console.log('heapdump file is ready to be sent to the caller', filename);
fs.readFile(filename, 'utf-8', (err, data) => {
res.end(data);
});
});
});
--------------------------------------------------
Maintenance Endpoint
--------------------------------------------------
Instead, I create maintenance Git branches for each running API version. For example:
master: the current API version (e.g 1.4)
maintenance/1.3: the code of 1.3.x version
maintenance/1.2: the code of 1.2.x version
--------------------------------------------------
Local Modules
--------------------------------------------------
https://medium.com/@arnaudrinquin/build-modular-application-with-npm-local-modules-dfc5ff047bcc
https://github.com/ArnaudRinquin/local_modules_poc
https://docs.npmjs.com/creating-and-publishing-private-packages#creating-a-private-package
--------------------------------------------------
DEBUG nodejs server
--------------------------------------------------
https://www.npmjs.com/package/debug
DEBUG=* node server.js
--------------------------------------------------
CURL request for https on localhost
--------------------------------------------------
curl --cacert ssl_certificate/localhost-cert.pem https://localhost:3030/health
TLS HandShake
-------------
curl -v --cacert ssl_certificate/localhost-cert.pem https://localhost:8080/health
nghttp -nsv https://localhost:8080/health
--------------------------------------------------
HTTP2 load testing - h2load
--------------------------------------------------
https://blog.josephscott.org/2019/02/14/h2load-on-ubuntu-18-04/
If Nothing to be done for `install-exec-am'
-> change ./configure --enable-app => ./configure --enable-app --prefix=/usr
Command:
-n
The number of total requests. Default: 1
-c
The number of concurrent clients. Default: 1
-m
The max concurrent streams to issue per client. Default: 1
-> h2load -n100000 -c1000 -m50 https://localhost:8080
--------------------------------------------------
HTTP2 Max Concurrent Streams
--------------------------------------------------
https://http2.github.io/http2-spec/ -> SETTINGS_MAX_CONCURRENT_STREAMS (0x3):
--------------------------------------------------
Kill specific port
--------------------------------------------------
sudo kill -9 $(sudo lsof -t -i:<port-number>)
--------------------------------------------------
Generate SSL keys
--------------------------------------------------
openssl req -x509 -newkey rsa:2048 -nodes -sha256 -subj '/CN=localhost' -keyout ssl_certificate/localhost-privkey.pem -out ssl_certificate/localhost-cert.pem
--------------------------------------------------
NodeJS Profiling
--------------------------------------------------
APP_ENVIRONMENT=development node --prof dist/bin/www/server.js
node --prof-process <filename.log>
https://nodejs.org/en/docs/guides/simple-profiling/