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,550,114,0,1,58.49
2,212,124,88,0,3,83.21
3,673,560,113,0,1,84.11
4,711,598,113,0,1,72.17
5,345,249,96,0,2,82.43
6,649,535,114,0,1,50.36
7,137,69,68,0,5,83.41
8,681,568,113,0,1,83.74
9,689,577,112,0,1,82.91
10,667,553,114,0,1,71.34
11,328,234,94,0,2,83.67
12,692,579,113,0,1,83.46
13,683,570,113,0,1,83.48
14,696,581,115,0,1,70.64
15,344,243,101,0,2,71.78
16,326,234,92,0,2,83.45
17,689,575,114,0,1,83.65
18,691,578,113,0,1,62.56
19,219,137,82,0,3,84.29
20,732,617,115,0,1,84.44
21,739,624,115,0,1,83.31
22,683,569,114,0,1,83.13
23,670,557,113,0,1,71.3
24,331,236,95,0,2,83.84
25,724,607,117,0,1,83.38
26,692,577,115,0,1,83.69
27,705,590,115,0,1,48.18
28,137,66,71,0,5,83.04
29,672,558,114,0,1,83.43
30,694,579,115,0,1,83.23
31,674,561,113,0,1,51.39
32,144,74,70,0,4,83.13
33,670,557,113,0,1,48.94
34,141,69,72,0,4,83.0
35,659,547,112,0,1,83.36
36,691,576,115,0,1,84.67
37,737,624,113,0,1,62.56
38,219,137,82,0,3,41.0
39,100,41,59,0,8,83.61
40,714,597,117,0,1,55.98
41,184,103,81,0,4,57.14
42,161,92,69,0,4,73.76
43,362,267,95,0,2,83.91
44,696,584,112,0,1,82.46
45,627,517,110,0,1,82.72
46,648,536,112,0,1,30.19
47,53,16,37,0,10,83.14
48,676,562,114,0,1,82.29
49,638,525,113,0,1,83.06
50,673,559,114,0,1,49.22
51,128,63,65,0,5,34.12
52,85,29,56,0,9,84.34
53,747,630,117,0,1,83.86
54,700,587,113,0,1,83.41
55,687,573,114,0,1,83.75
56,720,603,117,0,1,83.33
57,690,575,115,0,1,17.5
58,40,7,33,0,17,70.13
59,318,223,95,0,2,82.94
60,674,559,115,0,1,21.74
61,23,5,18,0,26,83.84
62,724,607,117,0,1,82.17
63,628,516,112,0,1,71.59
64,345,247,98,0,2,83.11
65,681,566,115,0,1,31.51
66,73,23,50,0,10,83.1
67,651,541,110,0,1,0.0
68,10,0,10,0,69,82.55
69,636,525,111,0,1,82.62
70,656,542,114,0,1,73.12
71,372,272,100,0,2,83.48
72,678,566,112,0,1,82.13
73,638,524,114,0,1,82.92
74,685,568,117,0,1,57.71
75,201,116,85,0,3,72.67
76,344,250,94,0,2,72.17
77,345,249,96,0,2,64.75
78,261,169,92,0,3,19.15
79,47,9,38,0,15,83.48
80,660,551,109,0,1,82.18
81,634,521,113,0,1,51.09
82,137,70,67,0,5,69.58
83,309,215,94,0,2,83.53
84,686,573,113,0,1,82.84
85,682,565,117,0,1,71.12
86,322,229,93,0,2,83.28
87,676,563,113,0,1,68.62
88,325,223,102,0,2,83.16
89,689,573,116,0,1,83.31
90,695,579,116,0,1,73.15
91,324,237,87,0,2,72.11
92,337,243,94,0,2,63.51
93,222,141,81,0,3,83.09
94,686,570,116,0,1,71.79
95,351,252,99,0,2,84.66
96,717,607,110,0,1,83.28
97,664,553,111,0,1,21.74
98,23,5,18,0,37,56.91
99,181,103,78,0,4,70.62
1 access_count hits misses mu lambda hit_rate
2 1 664 550 114 0 1 58.49
3 2 212 124 88 0 3 83.21
4 3 673 560 113 0 1 84.11
5 4 711 598 113 0 1 72.17
6 5 345 249 96 0 2 82.43
7 6 649 535 114 0 1 50.36
8 7 137 69 68 0 5 83.41
9 8 681 568 113 0 1 83.74
10 9 689 577 112 0 1 82.91
11 10 667 553 114 0 1 71.34
12 11 328 234 94 0 2 83.67
13 12 692 579 113 0 1 83.46
14 13 683 570 113 0 1 83.48
15 14 696 581 115 0 1 70.64
16 15 344 243 101 0 2 71.78
17 16 326 234 92 0 2 83.45
18 17 689 575 114 0 1 83.65
19 18 691 578 113 0 1 62.56
20 19 219 137 82 0 3 84.29
21 20 732 617 115 0 1 84.44
22 21 739 624 115 0 1 83.31
23 22 683 569 114 0 1 83.13
24 23 670 557 113 0 1 71.3
25 24 331 236 95 0 2 83.84
26 25 724 607 117 0 1 83.38
27 26 692 577 115 0 1 83.69
28 27 705 590 115 0 1 48.18
29 28 137 66 71 0 5 83.04
30 29 672 558 114 0 1 83.43
31 30 694 579 115 0 1 83.23
32 31 674 561 113 0 1 51.39
33 32 144 74 70 0 4 83.13
34 33 670 557 113 0 1 48.94
35 34 141 69 72 0 4 83.0
36 35 659 547 112 0 1 83.36
37 36 691 576 115 0 1 84.67
38 37 737 624 113 0 1 62.56
39 38 219 137 82 0 3 41.0
40 39 100 41 59 0 8 83.61
41 40 714 597 117 0 1 55.98
42 41 184 103 81 0 4 57.14
43 42 161 92 69 0 4 73.76
44 43 362 267 95 0 2 83.91
45 44 696 584 112 0 1 82.46
46 45 627 517 110 0 1 82.72
47 46 648 536 112 0 1 30.19
48 47 53 16 37 0 10 83.14
49 48 676 562 114 0 1 82.29
50 49 638 525 113 0 1 83.06
51 50 673 559 114 0 1 49.22
52 51 128 63 65 0 5 34.12
53 52 85 29 56 0 9 84.34
54 53 747 630 117 0 1 83.86
55 54 700 587 113 0 1 83.41
56 55 687 573 114 0 1 83.75
57 56 720 603 117 0 1 83.33
58 57 690 575 115 0 1 17.5
59 58 40 7 33 0 17 70.13
60 59 318 223 95 0 2 82.94
61 60 674 559 115 0 1 21.74
62 61 23 5 18 0 26 83.84
63 62 724 607 117 0 1 82.17
64 63 628 516 112 0 1 71.59
65 64 345 247 98 0 2 83.11
66 65 681 566 115 0 1 31.51
67 66 73 23 50 0 10 83.1
68 67 651 541 110 0 1 0.0
69 68 10 0 10 0 69 82.55
70 69 636 525 111 0 1 82.62
71 70 656 542 114 0 1 73.12
72 71 372 272 100 0 2 83.48
73 72 678 566 112 0 1 82.13
74 73 638 524 114 0 1 82.92
75 74 685 568 117 0 1 57.71
76 75 201 116 85 0 3 72.67
77 76 344 250 94 0 2 72.17
78 77 345 249 96 0 2 64.75
79 78 261 169 92 0 3 19.15
80 79 47 9 38 0 15 83.48
81 80 660 551 109 0 1 82.18
82 81 634 521 113 0 1 51.09
83 82 137 70 67 0 5 69.58
84 83 309 215 94 0 2 83.53
85 84 686 573 113 0 1 82.84
86 85 682 565 117 0 1 71.12
87 86 322 229 93 0 2 83.28
88 87 676 563 113 0 1 68.62
89 88 325 223 102 0 2 83.16
90 89 689 573 116 0 1 83.31
91 90 695 579 116 0 1 73.15
92 91 324 237 87 0 2 72.11
93 92 337 243 94 0 2 63.51
94 93 222 141 81 0 3 83.09
95 94 686 570 116 0 1 71.79
96 95 351 252 99 0 2 84.66
97 96 717 607 110 0 1 83.28
98 97 664 553 111 0 1 21.74
99 98 23 5 18 0 37 56.91
100 99 181 103 78 0 4 70.62

View File

@@ -0,0 +1,101 @@
obj_id,hit_rate,avg_age
1,0.8283132530120482,2.596363636363636
2,0.5849056603773585,2.524193548387097
3,0.8320950965824666,2.405357142857143
4,0.8410689170182841,2.4013377926421406
5,0.7217391304347827,2.4698795180722892
6,0.8243451463790447,2.3906542056074764
7,0.5036496350364964,2.739130434782609
8,0.8340675477239354,2.433098591549296
9,0.8374455732946299,2.5095320623916813
10,0.8290854572713643,2.5750452079566
11,0.7134146341463414,2.4188034188034186
12,0.8367052023121387,2.5250431778929188
13,0.8345534407027818,2.5526315789473686
14,0.8347701149425287,2.495697074010327
15,0.7063953488372093,2.522633744855967
16,0.7177914110429447,2.7777777777777777
17,0.8345428156748912,2.4991304347826087
18,0.8364688856729378,2.48961937716263
19,0.6255707762557078,2.562043795620438
20,0.842896174863388,2.521880064829822
21,0.8443843031123139,2.4759615384615383
22,0.8330893118594437,2.4938488576449913
23,0.8313432835820895,2.466786355475763
24,0.7129909365558912,2.5466101694915255
25,0.8383977900552486,2.3789126853377267
26,0.8338150289017341,2.5753899480069324
27,0.8368794326241135,2.422033898305085
28,0.48175182481751827,2.5757575757575757
29,0.8303571428571429,2.4408602150537635
30,0.8342939481268011,2.597582037996546
31,0.8323442136498517,2.443850267379679
32,0.5138888888888888,2.554054054054054
33,0.8313432835820895,2.443447037701975
34,0.48936170212765956,2.6231884057971016
35,0.8300455235204856,2.409506398537477
36,0.8335745296671491,2.4444444444444446
37,0.8466757123473542,2.3846153846153846
38,0.6255707762557078,2.81021897810219
39,0.41,2.5121951219512195
40,0.8361344537815126,2.5008375209380236
41,0.5597826086956522,2.5728155339805827
42,0.5714285714285714,2.6847826086956523
43,0.7375690607734806,2.397003745318352
44,0.8390804597701149,2.4914383561643834
45,0.8245614035087719,2.4545454545454546
46,0.8271604938271605,2.5167910447761193
47,0.3018867924528302,2.9375
48,0.8313609467455622,2.597864768683274
49,0.822884012539185,2.5238095238095237
50,0.8306092124814265,2.4991055456171734
51,0.4921875,2.3492063492063493
52,0.3411764705882353,2.1724137931034484
53,0.8433734939759037,2.5365079365079364
54,0.8385714285714285,2.5792163543441227
55,0.834061135371179,2.4223385689354275
56,0.8375,2.527363184079602
57,0.8333333333333334,2.3756521739130436
58,0.175,3.0
59,0.7012578616352201,2.506726457399103
60,0.8293768545994066,2.4686940966010735
61,0.21739130434782608,0.6
62,0.8383977900552486,2.6227347611202636
63,0.821656050955414,2.4108527131782944
64,0.7159420289855073,2.42914979757085
65,0.8311306901615272,2.57773851590106
66,0.3150684931506849,2.782608695652174
67,0.8310291858678955,2.478743068391867
68,0.0,0.0
69,0.8254716981132075,2.459047619047619
70,0.8262195121951219,2.559040590405904
71,0.7311827956989247,2.6544117647058822
72,0.8348082595870207,2.487632508833922
73,0.8213166144200627,2.427480916030534
74,0.8291970802919708,2.482394366197183
75,0.5771144278606966,2.7327586206896552
76,0.7267441860465116,2.576
77,0.7217391304347827,2.4859437751004014
78,0.6475095785440613,2.5562130177514795
79,0.19148936170212766,2.5555555555555554
80,0.8348484848484848,2.6515426497277677
81,0.8217665615141956,2.44721689059501
82,0.5109489051094891,2.557142857142857
83,0.6957928802588996,2.7209302325581395
84,0.8352769679300291,2.4694589877835953
85,0.8284457478005866,2.320353982300885
86,0.7111801242236024,2.6026200873362444
87,0.8328402366863905,2.644760213143872
88,0.6861538461538461,2.4260089686098656
89,0.8316400580551524,2.5095986038394416
90,0.8330935251798561,2.542314335060449
91,0.7314814814814815,2.261603375527426
92,0.7210682492581603,2.316872427983539
93,0.6351351351351351,2.5106382978723403
94,0.8309037900874635,2.507017543859649
95,0.717948717948718,2.373015873015873
96,0.8465829846582985,2.4365733113673804
97,0.8328313253012049,2.54249547920434
98,0.21739130434782608,3.4
99,0.569060773480663,2.320388349514563
100,0.7062314540059347,2.3529411764705883
1 obj_id hit_rate avg_age
2 1 0.8283132530120482 2.596363636363636
3 2 0.5849056603773585 2.524193548387097
4 3 0.8320950965824666 2.405357142857143
5 4 0.8410689170182841 2.4013377926421406
6 5 0.7217391304347827 2.4698795180722892
7 6 0.8243451463790447 2.3906542056074764
8 7 0.5036496350364964 2.739130434782609
9 8 0.8340675477239354 2.433098591549296
10 9 0.8374455732946299 2.5095320623916813
11 10 0.8290854572713643 2.5750452079566
12 11 0.7134146341463414 2.4188034188034186
13 12 0.8367052023121387 2.5250431778929188
14 13 0.8345534407027818 2.5526315789473686
15 14 0.8347701149425287 2.495697074010327
16 15 0.7063953488372093 2.522633744855967
17 16 0.7177914110429447 2.7777777777777777
18 17 0.8345428156748912 2.4991304347826087
19 18 0.8364688856729378 2.48961937716263
20 19 0.6255707762557078 2.562043795620438
21 20 0.842896174863388 2.521880064829822
22 21 0.8443843031123139 2.4759615384615383
23 22 0.8330893118594437 2.4938488576449913
24 23 0.8313432835820895 2.466786355475763
25 24 0.7129909365558912 2.5466101694915255
26 25 0.8383977900552486 2.3789126853377267
27 26 0.8338150289017341 2.5753899480069324
28 27 0.8368794326241135 2.422033898305085
29 28 0.48175182481751827 2.5757575757575757
30 29 0.8303571428571429 2.4408602150537635
31 30 0.8342939481268011 2.597582037996546
32 31 0.8323442136498517 2.443850267379679
33 32 0.5138888888888888 2.554054054054054
34 33 0.8313432835820895 2.443447037701975
35 34 0.48936170212765956 2.6231884057971016
36 35 0.8300455235204856 2.409506398537477
37 36 0.8335745296671491 2.4444444444444446
38 37 0.8466757123473542 2.3846153846153846
39 38 0.6255707762557078 2.81021897810219
40 39 0.41 2.5121951219512195
41 40 0.8361344537815126 2.5008375209380236
42 41 0.5597826086956522 2.5728155339805827
43 42 0.5714285714285714 2.6847826086956523
44 43 0.7375690607734806 2.397003745318352
45 44 0.8390804597701149 2.4914383561643834
46 45 0.8245614035087719 2.4545454545454546
47 46 0.8271604938271605 2.5167910447761193
48 47 0.3018867924528302 2.9375
49 48 0.8313609467455622 2.597864768683274
50 49 0.822884012539185 2.5238095238095237
51 50 0.8306092124814265 2.4991055456171734
52 51 0.4921875 2.3492063492063493
53 52 0.3411764705882353 2.1724137931034484
54 53 0.8433734939759037 2.5365079365079364
55 54 0.8385714285714285 2.5792163543441227
56 55 0.834061135371179 2.4223385689354275
57 56 0.8375 2.527363184079602
58 57 0.8333333333333334 2.3756521739130436
59 58 0.175 3.0
60 59 0.7012578616352201 2.506726457399103
61 60 0.8293768545994066 2.4686940966010735
62 61 0.21739130434782608 0.6
63 62 0.8383977900552486 2.6227347611202636
64 63 0.821656050955414 2.4108527131782944
65 64 0.7159420289855073 2.42914979757085
66 65 0.8311306901615272 2.57773851590106
67 66 0.3150684931506849 2.782608695652174
68 67 0.8310291858678955 2.478743068391867
69 68 0.0 0.0
70 69 0.8254716981132075 2.459047619047619
71 70 0.8262195121951219 2.559040590405904
72 71 0.7311827956989247 2.6544117647058822
73 72 0.8348082595870207 2.487632508833922
74 73 0.8213166144200627 2.427480916030534
75 74 0.8291970802919708 2.482394366197183
76 75 0.5771144278606966 2.7327586206896552
77 76 0.7267441860465116 2.576
78 77 0.7217391304347827 2.4859437751004014
79 78 0.6475095785440613 2.5562130177514795
80 79 0.19148936170212766 2.5555555555555554
81 80 0.8348484848484848 2.6515426497277677
82 81 0.8217665615141956 2.44721689059501
83 82 0.5109489051094891 2.557142857142857
84 83 0.6957928802588996 2.7209302325581395
85 84 0.8352769679300291 2.4694589877835953
86 85 0.8284457478005866 2.320353982300885
87 86 0.7111801242236024 2.6026200873362444
88 87 0.8328402366863905 2.644760213143872
89 88 0.6861538461538461 2.4260089686098656
90 89 0.8316400580551524 2.5095986038394416
91 90 0.8330935251798561 2.542314335060449
92 91 0.7314814814814815 2.261603375527426
93 92 0.7210682492581603 2.316872427983539
94 93 0.6351351351351351 2.5106382978723403
95 94 0.8309037900874635 2.507017543859649
96 95 0.717948717948718 2.373015873015873
97 96 0.8465829846582985 2.4365733113673804
98 97 0.8328313253012049 2.54249547920434
99 98 0.21739130434782608 3.4
100 99 0.569060773480663 2.320388349514563
101 100 0.7062314540059347 2.3529411764705883

View File

@@ -0,0 +1,9 @@
,hit_rate,avg_age
count,100.0,100.0
mean,0.7175225869007572,2.4791552890507336
std,0.1841955218651161,0.35131346514105605
min,0.0,0.0
25%,0.6933831217326363,2.4321113930546847
50%,0.8266900030111413,2.503781989168563
75%,0.8338765555190953,2.573372952474587
max,0.8466757123473542,3.4
1 hit_rate avg_age
2 count 100.0 100.0
3 mean 0.7175225869007572 2.4791552890507336
4 std 0.1841955218651161 0.35131346514105605
5 min 0.0 0.0
6 25% 0.6933831217326363 2.4321113930546847
7 50% 0.8266900030111413 2.503781989168563
8 75% 0.8338765555190953 2.573372952474587
9 max 0.8466757123473542 3.4