-
Notifications
You must be signed in to change notification settings - Fork 0
/
Taskfile.yaml
75 lines (64 loc) · 2.37 KB
/
Taskfile.yaml
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
version: '3'
tasks:
apply-config:
desc: "apply mysql / nginx config from git"
cmds:
- sudo cp s1/etc/mysql/mysql.conf.d/mysqld.cnf /etc/mysql/mysql.conf.d/mysqld.cnf
- sudo cp s1/etc/nginx/nginx.conf /etc/nginx/nginx.conf
- sudo cp s1/etc/nginx/sites-available/isucari.conf /etc/nginx/sites-available/isucari.conf
- sudo nginx -t
- sudo systemctl reload nginx
- sudo systemctl restart mysql
before-bench:
desc: "rotate log / build / restart services"
cmds:
# rotate log
- sudo rm -f /var/log/mysql/mysql-slow.log
- sudo rm -f /var/log/nginx/access.log
# restart mysql / nginx
- sudo systemctl restart mysql
- sudo nginx -t
- sudo systemctl reload nginx
# build app
- cd ~/isucari && git pull
- cd ~/isucari/webapp/go && make isucari
- sudo systemctl restart isucari.golang.service
analyze:
desc: "analyze mysql / nginx log"
cmds:
- sudo pt-query-digest --filter 'length($event->{arg}) <= 4000' /var/log/mysql/mysql-slow.log > ~/isucari/log/$(date +mysql-slow.log-%m-%d-%H-%M -d "+9 hours")
- sudo cat /var/log/nginx/access.log | alp ltsv -m "/users/\d+.json","/items/\d+.json","/new_items/\d+.json","/upload/.+.jpg","/transactions/\d+.png" --sort sum -r > ~/isucari/log/$(date +access.log-%m-%d-%H-%M -d "+9 hours")
view-slow:
desc: "view latest mysql slow log"
cmds:
- less $(ls ~/isucari/log/mysql-slow* | tail -n 1)
view-log:
desc: "view latest alp analyzed nginx log"
cmds:
- less $(ls ~/isucari/log/access.log* | tail -n 1)
profile-pprof:
# desc: "run pprof 30s"
cmds:
- go tool pprof http://localhost:6060/debug/pprof/profile?seconds=30
profile-fgprof:
# desc: "run fgprof 30s"
cmds:
- go tool pprof http://localhost:6060/debug/fgprof/profile?seconds=30
profile:
desc: "run pprof / fgprof for 30s"
deps:
- profile-pprof
- profile-fgprof
view-pprof:
# desc: "view pprof profile localhost:6070"
cmds:
- go tool pprof -http=localhost:6070 $(ls ~/pprof/pprof.isucari.samples.cpu.* | tail -n 1)
view-fgprof:
# desc: "view fgprof profile localhost:6070"
cmds:
- go tool pprof -http=localhost:6071 $(ls ~/pprof/pprof.samples.time.* | tail -n 1)
view-profile:
desc: "view pprof / fgprof at 6070, 6071"
deps:
- view-pprof
- view-fgprof