cmogstored.git  about / heads / tags
alternative mogstored implementation for MogileFS
blob a5caa7c2d26504f36e36866ef9361202b956603d 1421 bytes (raw)
$ git show empty-header-values:tapset/ioq_wait.awk	# shows this blob on the CLI

 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
 
#!/usr/bin/awk -f
# This outputs 6 columns:
# PID FD BLOCKED_TIME RESCHEDULE_TIME METHOD PATH
#
# PID - pid of cmogstored process
# FD - descriptor of client
# BLOCKED_TIME - total time a client spent blocked
# RESCHEDULE_TIME - the time a client went from unblocked to dispatching
# METHOD - HTTP or sidechannel method (e.g. GET/HEAD/PUT/DELETE/MD5)
# PATH - path accessed (e.g. /dev666/usage)
#
# [PID,FD] - unique identifier on any host at that point-in-time
# BLOCKED_TIME - RESCHEDULE_TIME = time actually spent in the queue
# RESCHEDULE_TIME is usually very low.

/ ioq_blocked / {
	pid = $1
	fd = $2
	time = $4
	ioq_blocked[pid, fd] = time
}

/ ioq_reschedule / {
	pid = $1
	fd = $2
	time = $4
	ioq_reschedule[pid, fd] = time
}

/ http_req_start / {
	pid = $1
	fd = $2
	method = $4
	path = $5

	now = ioq_unblocked[pid, fd]
	if (now) {
		blocked = (now - ioq_blocked[pid, fd]) / 1000000
		resched = (now - ioq_reschedule[pid, fd]) / 1000000

		printf("% 6d % 6d %0.4f %0.4f %s %s\n",
			pid, fd, blocked, resched, method, path)
	}
}

/ mgmt_dig_start / {
	pid = $1
	fd = $2
	alg = $4
	path = $5

	now = ioq_unblocked[pid, fd]
	if (now) {
		blocked = (now - ioq_blocked[pid, fd]) / 1000000
		resched = (now - ioq_reschedule[pid, fd]) / 1000000

		printf("% 6d % 6d %0.4f %0.4f %s %s\n",
			pid, fd, blocked, resched, alg, path)
	}
}

/ ioq_unblocked / {
	pid = $1
	fd = $2
	now = $4
	ioq_unblocked[pid, fd] = now
}

git clone https://yhbt.net/cmogstored.git