adjusted lambda for inter arrival time

Signed-off-by: Tuan-Dat Tran <tuan-dat.tran@tudattr.dev>
master
Tuan-Dat Tran 2024-11-13 12:00:18 +01:00
parent 594873c472
commit 8e1376cc44
3 changed files with 16549 additions and 658 deletions

File diff suppressed because one or more lines are too long

100
export.csv Normal file
View File

@ -0,0 +1,100 @@
,access_count,hits,misses,mu,lambda,hit_rate
1,63,57,6,5.399654088863246,1,90.91
2,66,60,6,4.890335658893015,1,86.54
3,52,45,7,4.375444630275031,1,93.75
4,48,45,3,1.358965695760079,1,40.0
5,10,4,6,7.946779823996088,5,93.9
6,82,77,5,3.18260808979361,1,80.65
7,31,25,6,5.605947602976087,2,66.67
8,6,4,2,3.5941156596303507,21,91.67
9,72,66,6,3.8666443154519476,1,89.09
10,55,49,6,3.9010358263416967,1,78.38
11,37,29,8,3.956909570230068,2,93.62
12,47,44,3,1.730567205003155,1,83.93
13,56,47,9,5.904039737486446,1,92.06
14,63,58,5,6.0088737342639815,1,79.31
15,29,23,6,7.357737678743373,2,60.0
16,5,3,2,1.450213741204231,9,37.5
17,8,3,5,5.826606789353313,8,66.67
18,15,10,5,9.95812133184028,3,77.78
19,36,28,8,7.712014479036094,2,91.25
20,80,73,7,4.633712335874409,1,81.4
21,43,35,8,7.911648101723665,1,82.05
22,39,32,7,7.3654252444495425,1,92.54
23,67,62,5,2.2670795468704905,1,85.19
24,54,46,8,8.134847295147168,1,94.92
25,59,56,3,1.2117597080749123,1,80.77
26,26,21,5,3.3524134464900266,2,91.67
27,60,55,5,2.7158732876992437,1,87.88
28,66,58,8,4.804077627549259,1,92.31
29,65,60,5,4.2833971305094645,1,80.0
30,35,28,7,9.583225049197923,2,91.8
31,61,56,5,3.53247508842331,1,40.0
32,5,2,3,9.558530824564308,25,72.73
33,22,16,6,8.094454978234637,3,86.67
34,60,52,8,8.888543618416357,1,94.03
35,67,63,4,2.453624754290659,1,76.19
36,21,16,5,3.806350449396821,3,86.44
37,59,51,8,7.129451257264811,1,0.0
38,4,0,4,5.744097564369153,9,87.84
39,74,65,9,8.55536941450684,1,94.34
40,53,50,3,2.0343384453691136,1,83.05
41,59,49,10,9.397972944585163,1,63.64
42,11,7,4,6.121601715336887,5,50.0
43,10,5,5,4.851318863875822,6,97.06
44,34,33,1,1.1351296943911597,2,92.19
45,64,59,5,4.125874686055022,1,87.84
46,74,65,9,9.358024125232479,1,89.8
47,49,44,5,2.4843778719133423,1,86.27
48,51,44,7,7.286472514468783,1,97.83
49,46,45,1,1.004347586977225,1,86.27
50,51,44,7,9.455432928862624,1,56.25
51,16,9,7,8.86206095462283,4,89.33
52,75,67,8,8.07417789759667,1,86.79
53,53,46,7,3.0669146526063695,1,87.72
54,57,50,7,3.2235153877813585,1,88.06
55,67,59,8,4.968519133955913,1,76.0
56,25,19,6,6.100212072996646,2,0.0
57,1,0,1,5.7982474925454675,28,87.76
58,49,43,6,6.981561582145566,1,81.82
59,33,27,6,3.884026094257262,2,90.48
60,21,19,2,1.4233483791426025,3,87.93
61,58,51,7,5.338026073258696,1,84.85
62,33,28,5,3.660265149660588,2,50.0
63,10,5,5,9.767449091292056,5,95.0
64,60,57,3,1.201834548613872,1,91.07
65,56,51,5,4.987309597274194,1,61.54
66,13,8,5,8.525418306404905,4,91.38
67,58,53,5,6.3843811037941745,1,76.19
68,21,16,5,5.159531220600393,2,86.21
69,29,25,4,8.23605831735192,2,80.0
70,25,20,5,6.466763192894339,3,0.0
71,3,0,3,4.350935520897277,19,86.79
72,53,46,7,9.80846133788532,1,96.67
73,60,58,2,1.1679092884069515,1,66.67
74,3,2,1,1.18334302651572,34,91.18
75,68,62,6,1.983734112137778,1,79.31
76,29,23,6,3.103107885085463,2,90.62
77,64,58,6,3.5224268491508823,1,87.72
78,57,50,7,7.146369144646693,1,94.92
79,59,56,3,1.629455019599476,1,64.29
80,14,9,5,5.643369483405839,4,93.33
81,15,14,1,1.1732603718777255,4,74.19
82,31,23,8,7.1503989550318225,2,86.21
83,58,50,8,8.797436025155585,1,80.0
84,25,20,5,1.9671577189537692,2,86.89
85,61,53,8,9.617953205825893,1,91.78
86,73,67,6,3.326125890288469,1,96.36
87,55,53,2,1.1485674376739077,1,65.0
88,20,13,7,7.033453848869293,3,70.0
89,20,14,6,2.980219690735362,2,94.2
90,69,65,4,1.9069516378037399,1,84.21
91,57,48,9,7.690296524981362,1,66.67
92,3,2,1,6.794130441019814,13,72.0
93,25,18,7,4.972131019351156,3,44.44
94,9,4,5,8.769662570180895,7,86.79
95,53,46,7,4.07981809741165,1,90.77
96,65,59,6,7.308754805712177,1,77.42
97,31,24,7,3.0787732999641575,2,98.15
98,54,53,1,1.515769438886239,1,86.67
99,45,39,6,4.25741567806571,1,28.57
1 access_count hits misses mu lambda hit_rate
2 1 63 57 6 5.399654088863246 1 90.91
3 2 66 60 6 4.890335658893015 1 86.54
4 3 52 45 7 4.375444630275031 1 93.75
5 4 48 45 3 1.358965695760079 1 40.0
6 5 10 4 6 7.946779823996088 5 93.9
7 6 82 77 5 3.18260808979361 1 80.65
8 7 31 25 6 5.605947602976087 2 66.67
9 8 6 4 2 3.5941156596303507 21 91.67
10 9 72 66 6 3.8666443154519476 1 89.09
11 10 55 49 6 3.9010358263416967 1 78.38
12 11 37 29 8 3.956909570230068 2 93.62
13 12 47 44 3 1.730567205003155 1 83.93
14 13 56 47 9 5.904039737486446 1 92.06
15 14 63 58 5 6.0088737342639815 1 79.31
16 15 29 23 6 7.357737678743373 2 60.0
17 16 5 3 2 1.450213741204231 9 37.5
18 17 8 3 5 5.826606789353313 8 66.67
19 18 15 10 5 9.95812133184028 3 77.78
20 19 36 28 8 7.712014479036094 2 91.25
21 20 80 73 7 4.633712335874409 1 81.4
22 21 43 35 8 7.911648101723665 1 82.05
23 22 39 32 7 7.3654252444495425 1 92.54
24 23 67 62 5 2.2670795468704905 1 85.19
25 24 54 46 8 8.134847295147168 1 94.92
26 25 59 56 3 1.2117597080749123 1 80.77
27 26 26 21 5 3.3524134464900266 2 91.67
28 27 60 55 5 2.7158732876992437 1 87.88
29 28 66 58 8 4.804077627549259 1 92.31
30 29 65 60 5 4.2833971305094645 1 80.0
31 30 35 28 7 9.583225049197923 2 91.8
32 31 61 56 5 3.53247508842331 1 40.0
33 32 5 2 3 9.558530824564308 25 72.73
34 33 22 16 6 8.094454978234637 3 86.67
35 34 60 52 8 8.888543618416357 1 94.03
36 35 67 63 4 2.453624754290659 1 76.19
37 36 21 16 5 3.806350449396821 3 86.44
38 37 59 51 8 7.129451257264811 1 0.0
39 38 4 0 4 5.744097564369153 9 87.84
40 39 74 65 9 8.55536941450684 1 94.34
41 40 53 50 3 2.0343384453691136 1 83.05
42 41 59 49 10 9.397972944585163 1 63.64
43 42 11 7 4 6.121601715336887 5 50.0
44 43 10 5 5 4.851318863875822 6 97.06
45 44 34 33 1 1.1351296943911597 2 92.19
46 45 64 59 5 4.125874686055022 1 87.84
47 46 74 65 9 9.358024125232479 1 89.8
48 47 49 44 5 2.4843778719133423 1 86.27
49 48 51 44 7 7.286472514468783 1 97.83
50 49 46 45 1 1.004347586977225 1 86.27
51 50 51 44 7 9.455432928862624 1 56.25
52 51 16 9 7 8.86206095462283 4 89.33
53 52 75 67 8 8.07417789759667 1 86.79
54 53 53 46 7 3.0669146526063695 1 87.72
55 54 57 50 7 3.2235153877813585 1 88.06
56 55 67 59 8 4.968519133955913 1 76.0
57 56 25 19 6 6.100212072996646 2 0.0
58 57 1 0 1 5.7982474925454675 28 87.76
59 58 49 43 6 6.981561582145566 1 81.82
60 59 33 27 6 3.884026094257262 2 90.48
61 60 21 19 2 1.4233483791426025 3 87.93
62 61 58 51 7 5.338026073258696 1 84.85
63 62 33 28 5 3.660265149660588 2 50.0
64 63 10 5 5 9.767449091292056 5 95.0
65 64 60 57 3 1.201834548613872 1 91.07
66 65 56 51 5 4.987309597274194 1 61.54
67 66 13 8 5 8.525418306404905 4 91.38
68 67 58 53 5 6.3843811037941745 1 76.19
69 68 21 16 5 5.159531220600393 2 86.21
70 69 29 25 4 8.23605831735192 2 80.0
71 70 25 20 5 6.466763192894339 3 0.0
72 71 3 0 3 4.350935520897277 19 86.79
73 72 53 46 7 9.80846133788532 1 96.67
74 73 60 58 2 1.1679092884069515 1 66.67
75 74 3 2 1 1.18334302651572 34 91.18
76 75 68 62 6 1.983734112137778 1 79.31
77 76 29 23 6 3.103107885085463 2 90.62
78 77 64 58 6 3.5224268491508823 1 87.72
79 78 57 50 7 7.146369144646693 1 94.92
80 79 59 56 3 1.629455019599476 1 64.29
81 80 14 9 5 5.643369483405839 4 93.33
82 81 15 14 1 1.1732603718777255 4 74.19
83 82 31 23 8 7.1503989550318225 2 86.21
84 83 58 50 8 8.797436025155585 1 80.0
85 84 25 20 5 1.9671577189537692 2 86.89
86 85 61 53 8 9.617953205825893 1 91.78
87 86 73 67 6 3.326125890288469 1 96.36
88 87 55 53 2 1.1485674376739077 1 65.0
89 88 20 13 7 7.033453848869293 3 70.0
90 89 20 14 6 2.980219690735362 2 94.2
91 90 69 65 4 1.9069516378037399 1 84.21
92 91 57 48 9 7.690296524981362 1 66.67
93 92 3 2 1 6.794130441019814 13 72.0
94 93 25 18 7 4.972131019351156 3 44.44
95 94 9 4 5 8.769662570180895 7 86.79
96 95 53 46 7 4.07981809741165 1 90.77
97 96 65 59 6 7.308754805712177 1 77.42
98 97 31 24 7 3.0787732999641575 2 98.15
99 98 54 53 1 1.515769438886239 1 86.67
100 99 45 39 6 4.25741567806571 1 28.57

10
note.md
View File

@ -1,6 +1,7 @@
System Design # Age Caching Simulation
Client -> TTL Cache -> Database Client -> TTL Cache -> Database
Capacity C Capacity C (C = n (example: 100))
TTL increases on cache hit TTL increases on cache hit
Age of information / Age of the entry in the cache Age of information / Age of the entry in the cache
@ -18,7 +19,4 @@ lambda(i) is zipf distribution describing the rate the client requests the objec
Inter arrival time of each object => exponential Inter arrival time of each object => exponential
We need Hit rate and the average age of the object based on TTL
Hit rate and the average age of the object based on TTL and
C = n (example: 100)