forked from hackedteam/rcs-db
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPROFILING
55 lines (41 loc) · 1.56 KB
/
PROFILING
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
Profiling
Mongo profiling
* Slow queries aggregated by operation
db.system.profile.aggregate(
{ $match: {millis: {$gte: 80}} },
{ $group: {_id: '$op', cnt: {$sum: 1}} }
)
* Queries that scans the most
db.system.profile.aggregate(
{ $match: {op: 'query', 'ns': {$nin: ['rcs.profile', 'rcs.system.profile'] }} },
{ $group: {_id: '$ns', avg_scans: {$avg: '$nscanned'}, cnt: {$sum: 1}} },
{ $sort: {avg_scans: -1} }
)
Rcs profiling
* 10 slower rest call with average resp time (em thread queue free)
db.profile.aggregate(
{ $match: {'time.total': {$gt: 1}, 'pool.busy': 1, 'pool.queue': 0} },
{ $group: {_id: '$uriwp', cnt: {$sum: 1}, avg_resp_time: {$avg: '$time.total'}} },
{ $sort: {cnt: -1} },
{ $limit: 10 }
)
* 10 most requested rest path with average resp time
db.profile.aggregate(
{ $group: {_id: '$uriwp', cnt: {$sum: 1}, avg_resp_time: {$avg: '$time.total'}} },
{ $sort: {cnt: -1} },
{ $limit: 20 }
)
* 10 rest call with the highest rate of em-thread-queue busy
db.profile.aggregate(
{ $match: {'pool.busy': {$gt: 1}} },
{ $group: {_id: '$uriwp', busy_rate: {$sum: '$pool.busy'}, avg_resp_time: {$avg: '$time.total'}} },
{ $sort: {busy_rate: -1} },
{ $limit: 10 }
)
* 20 bigger (in size) rest call
db.profile.aggregate(
{ $match: {size: {$not: {$type: 2}}} },
{ $group: {_id: '$uriwp', avg_size: {$avg: '$size'}, cnt: {$sum: 1}} },
{ $sort: {avg_size: -1} },
{ $limit: 20 }
)