feat: add cache simulation with experiments for TTL and eviction strategies

Introduce a new simulation for Age of Information (AoI) cache management, focusing on varying TTL values and eviction strategies (LRU and Random Eviction). This includes:
- New Python script  for event-driven cache simulations using .
- Experiments for "No Refresh" across multiple TTL configurations (, , ..., ) with:
  - Hit rate and object age tracking (, , etc.).
  - Visualizations (e.g., , ).
- Updated  to describe experimental setup and configurations.
- Log export file () for simulation results.
- Refactor of  with detailed strategy configurations and runtime notes.

### Reason
The commit enhances the project by enabling detailed experiments with configurable cache parameters, supporting analysis of cache efficiency and AoI under varying conditions. This provides a foundation for more sophisticated simulations and insights.

### Performance
- Runtime: ~4m 29s for .

Co-authored experiments introduce structured data files and visualizations, improving clarity for future iterations.

Signed-off-by: Tuan-Dat Tran <tuan-dat.tran@tudattr.dev>
This commit is contained in:
Tuan-Dat Tran
2024-11-27 16:31:46 +01:00
parent 912b97a06e
commit 6e8a742705
38 changed files with 2337 additions and 216 deletions

View File

@@ -0,0 +1,100 @@
,access_count,hits,misses,mu,lambda,hit_rate
1,664,224,440,0,1,10.38
2,212,22,190,0,3,32.39
3,673,218,455,0,1,34.6
4,711,246,465,0,1,19.13
5,345,66,279,0,2,31.74
6,649,206,443,0,1,10.22
7,137,14,123,0,5,32.45
8,681,221,460,0,1,34.4
9,689,237,452,0,1,34.18
10,667,228,439,0,1,21.95
11,328,72,256,0,2,34.97
12,692,242,450,0,1,32.21
13,683,220,463,0,1,33.62
14,696,234,462,0,1,20.35
15,344,70,274,0,2,18.4
16,326,60,266,0,2,29.9
17,689,206,483,0,1,32.85
18,691,227,464,0,1,11.87
19,219,26,193,0,3,34.84
20,732,255,477,0,1,35.05
21,739,259,480,0,1,34.55
22,683,236,447,0,1,35.22
23,670,236,434,0,1,19.94
24,331,66,265,0,2,34.67
25,724,251,473,0,1,32.08
26,692,222,470,0,1,34.18
27,705,241,464,0,1,8.76
28,137,12,125,0,5,34.23
29,672,230,442,0,1,31.7
30,694,220,474,0,1,33.09
31,674,223,451,0,1,9.03
32,144,13,131,0,4,34.63
33,670,232,438,0,1,7.09
34,141,10,131,0,4,32.78
35,659,216,443,0,1,32.27
36,691,223,468,0,1,36.91
37,737,272,465,0,1,14.16
38,219,31,188,0,3,5.0
39,100,5,95,0,8,32.77
40,714,234,480,0,1,12.5
41,184,23,161,0,4,7.45
42,161,12,149,0,4,21.55
43,362,78,284,0,2,32.61
44,696,227,469,0,1,29.98
45,627,188,439,0,1,32.56
46,648,211,437,0,1,1.89
47,53,1,52,0,10,31.51
48,676,213,463,0,1,31.35
49,638,200,438,0,1,32.69
50,673,220,453,0,1,12.5
51,128,16,112,0,5,3.53
52,85,3,82,0,9,33.33
53,747,249,498,0,1,33.0
54,700,231,469,0,1,35.08
55,687,241,446,0,1,37.5
56,720,270,450,0,1,31.3
57,690,216,474,0,1,0.0
58,40,0,40,0,17,19.18
59,318,61,257,0,2,31.31
60,674,211,463,0,1,13.04
61,23,3,20,0,26,35.22
62,724,255,469,0,1,32.32
63,628,203,425,0,1,24.93
64,345,86,259,0,2,35.1
65,681,239,442,0,1,4.11
66,73,3,70,0,10,33.79
67,651,220,431,0,1,0.0
68,10,0,10,0,69,33.02
69,636,210,426,0,1,32.77
70,656,215,441,0,1,22.58
71,372,84,288,0,2,33.48
72,678,227,451,0,1,33.7
73,638,215,423,0,1,33.28
74,685,228,457,0,1,10.45
75,201,21,180,0,3,20.35
76,344,70,274,0,2,21.16
77,345,73,272,0,2,17.24
78,261,45,216,0,3,4.26
79,47,2,45,0,15,33.79
80,660,223,437,0,1,30.28
81,634,192,442,0,1,5.84
82,137,8,129,0,5,18.45
83,309,57,252,0,2,34.11
84,686,234,452,0,1,32.99
85,682,225,457,0,1,19.25
86,322,62,260,0,2,32.99
87,676,223,453,0,1,20.92
88,325,68,257,0,2,35.27
89,689,243,446,0,1,32.95
90,695,229,466,0,1,21.91
91,324,71,253,0,2,20.47
92,337,69,268,0,2,13.96
93,222,31,191,0,3,31.78
94,686,218,468,0,1,19.94
95,351,70,281,0,2,33.89
96,717,243,474,0,1,32.53
97,664,216,448,0,1,0.0
98,23,0,23,0,37,11.6
99,181,21,160,0,4,22.85
1 access_count hits misses mu lambda hit_rate
2 1 664 224 440 0 1 10.38
3 2 212 22 190 0 3 32.39
4 3 673 218 455 0 1 34.6
5 4 711 246 465 0 1 19.13
6 5 345 66 279 0 2 31.74
7 6 649 206 443 0 1 10.22
8 7 137 14 123 0 5 32.45
9 8 681 221 460 0 1 34.4
10 9 689 237 452 0 1 34.18
11 10 667 228 439 0 1 21.95
12 11 328 72 256 0 2 34.97
13 12 692 242 450 0 1 32.21
14 13 683 220 463 0 1 33.62
15 14 696 234 462 0 1 20.35
16 15 344 70 274 0 2 18.4
17 16 326 60 266 0 2 29.9
18 17 689 206 483 0 1 32.85
19 18 691 227 464 0 1 11.87
20 19 219 26 193 0 3 34.84
21 20 732 255 477 0 1 35.05
22 21 739 259 480 0 1 34.55
23 22 683 236 447 0 1 35.22
24 23 670 236 434 0 1 19.94
25 24 331 66 265 0 2 34.67
26 25 724 251 473 0 1 32.08
27 26 692 222 470 0 1 34.18
28 27 705 241 464 0 1 8.76
29 28 137 12 125 0 5 34.23
30 29 672 230 442 0 1 31.7
31 30 694 220 474 0 1 33.09
32 31 674 223 451 0 1 9.03
33 32 144 13 131 0 4 34.63
34 33 670 232 438 0 1 7.09
35 34 141 10 131 0 4 32.78
36 35 659 216 443 0 1 32.27
37 36 691 223 468 0 1 36.91
38 37 737 272 465 0 1 14.16
39 38 219 31 188 0 3 5.0
40 39 100 5 95 0 8 32.77
41 40 714 234 480 0 1 12.5
42 41 184 23 161 0 4 7.45
43 42 161 12 149 0 4 21.55
44 43 362 78 284 0 2 32.61
45 44 696 227 469 0 1 29.98
46 45 627 188 439 0 1 32.56
47 46 648 211 437 0 1 1.89
48 47 53 1 52 0 10 31.51
49 48 676 213 463 0 1 31.35
50 49 638 200 438 0 1 32.69
51 50 673 220 453 0 1 12.5
52 51 128 16 112 0 5 3.53
53 52 85 3 82 0 9 33.33
54 53 747 249 498 0 1 33.0
55 54 700 231 469 0 1 35.08
56 55 687 241 446 0 1 37.5
57 56 720 270 450 0 1 31.3
58 57 690 216 474 0 1 0.0
59 58 40 0 40 0 17 19.18
60 59 318 61 257 0 2 31.31
61 60 674 211 463 0 1 13.04
62 61 23 3 20 0 26 35.22
63 62 724 255 469 0 1 32.32
64 63 628 203 425 0 1 24.93
65 64 345 86 259 0 2 35.1
66 65 681 239 442 0 1 4.11
67 66 73 3 70 0 10 33.79
68 67 651 220 431 0 1 0.0
69 68 10 0 10 0 69 33.02
70 69 636 210 426 0 1 32.77
71 70 656 215 441 0 1 22.58
72 71 372 84 288 0 2 33.48
73 72 678 227 451 0 1 33.7
74 73 638 215 423 0 1 33.28
75 74 685 228 457 0 1 10.45
76 75 201 21 180 0 3 20.35
77 76 344 70 274 0 2 21.16
78 77 345 73 272 0 2 17.24
79 78 261 45 216 0 3 4.26
80 79 47 2 45 0 15 33.79
81 80 660 223 437 0 1 30.28
82 81 634 192 442 0 1 5.84
83 82 137 8 129 0 5 18.45
84 83 309 57 252 0 2 34.11
85 84 686 234 452 0 1 32.99
86 85 682 225 457 0 1 19.25
87 86 322 62 260 0 2 32.99
88 87 676 223 453 0 1 20.92
89 88 325 68 257 0 2 35.27
90 89 689 243 446 0 1 32.95
91 90 695 229 466 0 1 21.91
92 91 324 71 253 0 2 20.47
93 92 337 69 268 0 2 13.96
94 93 222 31 191 0 3 31.78
95 94 686 218 468 0 1 19.94
96 95 351 70 281 0 2 33.89
97 96 717 243 474 0 1 32.53
98 97 664 216 448 0 1 0.0
99 98 23 0 23 0 37 11.6
100 99 181 21 160 0 4 22.85

View File

@@ -0,0 +1,101 @@
obj_id,hit_rate,avg_age
1,0.3373493975903614,0.25892857142857145
2,0.10377358490566038,0.36363636363636365
3,0.32392273402674593,0.24311926605504589
4,0.3459915611814346,0.25609756097560976
5,0.19130434782608696,0.24242424242424243
6,0.31741140215716485,0.24757281553398058
7,0.10218978102189781,0.21428571428571427
8,0.3245227606461087,0.2579185520361991
9,0.3439767779390421,0.23628691983122363
10,0.34182908545727136,0.2236842105263158
11,0.21951219512195122,0.2361111111111111
12,0.34971098265895956,0.30578512396694213
13,0.32210834553440704,0.22727272727272727
14,0.33620689655172414,0.2692307692307692
15,0.20348837209302326,0.2
16,0.18404907975460122,0.2
17,0.29898403483309144,0.2524271844660194
18,0.32850940665701883,0.24669603524229075
19,0.1187214611872146,0.2692307692307692
20,0.3483606557377049,0.25882352941176473
21,0.35047361299052776,0.21235521235521235
22,0.34553440702781846,0.288135593220339
23,0.3522388059701492,0.19915254237288135
24,0.19939577039274925,0.18181818181818182
25,0.34668508287292815,0.2589641434262948
26,0.3208092485549133,0.2072072072072072
27,0.34184397163120567,0.23651452282157676
28,0.08759124087591241,0.16666666666666666
29,0.34226190476190477,0.24782608695652175
30,0.3170028818443804,0.2818181818181818
31,0.33086053412462907,0.2600896860986547
32,0.09027777777777778,0.3076923076923077
33,0.34626865671641793,0.24568965517241378
34,0.07092198581560284,0.3
35,0.3277693474962064,0.2638888888888889
36,0.3227206946454414,0.29596412556053814
37,0.36906377204884666,0.22058823529411764
38,0.1415525114155251,0.3870967741935484
39,0.05,0.2
40,0.3277310924369748,0.27350427350427353
41,0.125,0.30434782608695654
42,0.07453416149068323,0.25
43,0.2154696132596685,0.32051282051282054
44,0.3261494252873563,0.24669603524229075
45,0.29984051036682613,0.3404255319148936
46,0.3256172839506173,0.27014218009478674
47,0.018867924528301886,0.0
48,0.3150887573964497,0.23943661971830985
49,0.31347962382445144,0.27
50,0.32689450222882616,0.22727272727272727
51,0.125,0.25
52,0.03529411764705882,0.3333333333333333
53,0.3333333333333333,0.26506024096385544
54,0.33,0.24675324675324675
55,0.3508005822416303,0.24481327800829875
56,0.375,0.25925925925925924
57,0.3130434782608696,0.2638888888888889
58,0.0,0.0
59,0.1918238993710692,0.14754098360655737
60,0.31305637982195844,0.1990521327014218
61,0.13043478260869565,0.0
62,0.35220994475138123,0.2549019607843137
63,0.3232484076433121,0.2315270935960591
64,0.2492753623188406,0.3372093023255814
65,0.3509544787077827,0.2803347280334728
66,0.0410958904109589,0.3333333333333333
67,0.3379416282642089,0.20909090909090908
68,0.0,0.0
69,0.330188679245283,0.32857142857142857
70,0.3277439024390244,0.26046511627906976
71,0.22580645161290322,0.2261904761904762
72,0.33480825958702065,0.2422907488986784
73,0.33699059561128525,0.2930232558139535
74,0.33284671532846716,0.19736842105263158
75,0.1044776119402985,0.2857142857142857
76,0.20348837209302326,0.3
77,0.21159420289855072,0.2054794520547945
78,0.1724137931034483,0.2
79,0.0425531914893617,0.0
80,0.3378787878787879,0.27802690582959644
81,0.3028391167192429,0.2604166666666667
82,0.058394160583941604,0.125
83,0.18446601941747573,0.24561403508771928
84,0.34110787172011664,0.2905982905982906
85,0.32991202346041054,0.26222222222222225
86,0.19254658385093168,0.3064516129032258
87,0.32988165680473375,0.20179372197309417
88,0.20923076923076922,0.25
89,0.35268505079825835,0.22633744855967078
90,0.3294964028776978,0.2794759825327511
91,0.2191358024691358,0.30985915492957744
92,0.20474777448071216,0.21739130434782608
93,0.13963963963963963,0.25806451612903225
94,0.3177842565597668,0.2889908256880734
95,0.19943019943019943,0.3142857142857143
96,0.3389121338912134,0.2139917695473251
97,0.3253012048192771,0.26851851851851855
98,0.0,0.0
99,0.11602209944751381,0.3333333333333333
100,0.228486646884273,0.24675324675324675
1 obj_id hit_rate avg_age
2 1 0.3373493975903614 0.25892857142857145
3 2 0.10377358490566038 0.36363636363636365
4 3 0.32392273402674593 0.24311926605504589
5 4 0.3459915611814346 0.25609756097560976
6 5 0.19130434782608696 0.24242424242424243
7 6 0.31741140215716485 0.24757281553398058
8 7 0.10218978102189781 0.21428571428571427
9 8 0.3245227606461087 0.2579185520361991
10 9 0.3439767779390421 0.23628691983122363
11 10 0.34182908545727136 0.2236842105263158
12 11 0.21951219512195122 0.2361111111111111
13 12 0.34971098265895956 0.30578512396694213
14 13 0.32210834553440704 0.22727272727272727
15 14 0.33620689655172414 0.2692307692307692
16 15 0.20348837209302326 0.2
17 16 0.18404907975460122 0.2
18 17 0.29898403483309144 0.2524271844660194
19 18 0.32850940665701883 0.24669603524229075
20 19 0.1187214611872146 0.2692307692307692
21 20 0.3483606557377049 0.25882352941176473
22 21 0.35047361299052776 0.21235521235521235
23 22 0.34553440702781846 0.288135593220339
24 23 0.3522388059701492 0.19915254237288135
25 24 0.19939577039274925 0.18181818181818182
26 25 0.34668508287292815 0.2589641434262948
27 26 0.3208092485549133 0.2072072072072072
28 27 0.34184397163120567 0.23651452282157676
29 28 0.08759124087591241 0.16666666666666666
30 29 0.34226190476190477 0.24782608695652175
31 30 0.3170028818443804 0.2818181818181818
32 31 0.33086053412462907 0.2600896860986547
33 32 0.09027777777777778 0.3076923076923077
34 33 0.34626865671641793 0.24568965517241378
35 34 0.07092198581560284 0.3
36 35 0.3277693474962064 0.2638888888888889
37 36 0.3227206946454414 0.29596412556053814
38 37 0.36906377204884666 0.22058823529411764
39 38 0.1415525114155251 0.3870967741935484
40 39 0.05 0.2
41 40 0.3277310924369748 0.27350427350427353
42 41 0.125 0.30434782608695654
43 42 0.07453416149068323 0.25
44 43 0.2154696132596685 0.32051282051282054
45 44 0.3261494252873563 0.24669603524229075
46 45 0.29984051036682613 0.3404255319148936
47 46 0.3256172839506173 0.27014218009478674
48 47 0.018867924528301886 0.0
49 48 0.3150887573964497 0.23943661971830985
50 49 0.31347962382445144 0.27
51 50 0.32689450222882616 0.22727272727272727
52 51 0.125 0.25
53 52 0.03529411764705882 0.3333333333333333
54 53 0.3333333333333333 0.26506024096385544
55 54 0.33 0.24675324675324675
56 55 0.3508005822416303 0.24481327800829875
57 56 0.375 0.25925925925925924
58 57 0.3130434782608696 0.2638888888888889
59 58 0.0 0.0
60 59 0.1918238993710692 0.14754098360655737
61 60 0.31305637982195844 0.1990521327014218
62 61 0.13043478260869565 0.0
63 62 0.35220994475138123 0.2549019607843137
64 63 0.3232484076433121 0.2315270935960591
65 64 0.2492753623188406 0.3372093023255814
66 65 0.3509544787077827 0.2803347280334728
67 66 0.0410958904109589 0.3333333333333333
68 67 0.3379416282642089 0.20909090909090908
69 68 0.0 0.0
70 69 0.330188679245283 0.32857142857142857
71 70 0.3277439024390244 0.26046511627906976
72 71 0.22580645161290322 0.2261904761904762
73 72 0.33480825958702065 0.2422907488986784
74 73 0.33699059561128525 0.2930232558139535
75 74 0.33284671532846716 0.19736842105263158
76 75 0.1044776119402985 0.2857142857142857
77 76 0.20348837209302326 0.3
78 77 0.21159420289855072 0.2054794520547945
79 78 0.1724137931034483 0.2
80 79 0.0425531914893617 0.0
81 80 0.3378787878787879 0.27802690582959644
82 81 0.3028391167192429 0.2604166666666667
83 82 0.058394160583941604 0.125
84 83 0.18446601941747573 0.24561403508771928
85 84 0.34110787172011664 0.2905982905982906
86 85 0.32991202346041054 0.26222222222222225
87 86 0.19254658385093168 0.3064516129032258
88 87 0.32988165680473375 0.20179372197309417
89 88 0.20923076923076922 0.25
90 89 0.35268505079825835 0.22633744855967078
91 90 0.3294964028776978 0.2794759825327511
92 91 0.2191358024691358 0.30985915492957744
93 92 0.20474777448071216 0.21739130434782608
94 93 0.13963963963963963 0.25806451612903225
95 94 0.3177842565597668 0.2889908256880734
96 95 0.19943019943019943 0.3142857142857143
97 96 0.3389121338912134 0.2139917695473251
98 97 0.3253012048192771 0.26851851851851855
99 98 0.0 0.0
100 99 0.11602209944751381 0.3333333333333333
101 100 0.228486646884273 0.24675324675324675

View File

@@ -0,0 +1,9 @@
,hit_rate,avg_age
count,100.0,100.0
mean,0.24997190226308422,0.24085664637735987
std,0.10967384888958667,0.07537398148292249
min,0.0,0.0
25%,0.1843617845017571,0.21978900255754474
50%,0.3172071420007726,0.25
75%,0.3351579188281965,0.2796906689079315
max,0.375,0.3870967741935484
1 hit_rate avg_age
2 count 100.0 100.0
3 mean 0.24997190226308422 0.24085664637735987
4 std 0.10967384888958667 0.07537398148292249
5 min 0.0 0.0
6 25% 0.1843617845017571 0.21978900255754474
7 50% 0.3172071420007726 0.25
8 75% 0.3351579188281965 0.2796906689079315
9 max 0.375 0.3870967741935484