-
Notifications
You must be signed in to change notification settings - Fork 4
/
twemproxy_mbuf.stp
43 lines (38 loc) · 1.08 KB
/
twemproxy_mbuf.stp
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
# show mbuf usage
# Using twemproxy's default mbuf size of 16Kbytes, we waste lot of memory.
# We allocate always mbuf with 16Kbytes, but we use only let's say 2KBytes, rest of memory is wasted.
# If we change this to 512bytes, we save kernel's memory, we have higher connection rate, but we suffer more read/write()
# @ton31337
global mbuf_size;
global INC_NUM;
global RANGE_BY;
function print_head()
{
ansi_clear_screen();
printf("Probing...Type CTRL+C to stop probing.\n");
}
probe begin
{
RANGE_BY = 1024;
INC_NUM = RANGE_BY - 1;
}
probe process("/usr/local/bin/nutcracker").function("mbuf_length").return
{
j = 0;
for(i = 1; i <= 16; i++) {
if(($return > j) && ($return < j+INC_NUM))
mbuf_size[i]++;
j += RANGE_BY;
}
}
probe timer.s(1)
{
print_head();
printf("Mbuf_range\tCount\n");
j = 0;
for(i = 1; i <= 16; i++) {
printf("%5d-%d\t%d\n", j, j+INC_NUM, mbuf_size[i]);
j += RANGE_BY;
}
delete mbuf_size;
}