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,445,219,0,1,37.74
2,212,80,132,0,3,66.42
3,673,447,226,0,1,67.37
4,711,479,232,0,1,51.01
5,345,176,169,0,2,64.56
6,649,419,230,0,1,29.2
7,137,40,97,0,5,66.37
8,681,452,229,0,1,66.76
9,689,460,229,0,1,66.57
10,667,444,223,0,1,52.13
11,328,171,157,0,2,67.92
12,692,470,222,0,1,66.03
13,683,451,232,0,1,66.67
14,696,464,232,0,1,48.55
15,344,167,177,0,2,48.47
16,326,158,168,0,2,66.33
17,689,457,232,0,1,65.99
18,691,456,235,0,1,41.1
19,219,90,129,0,3,68.58
20,732,502,230,0,1,68.88
21,739,509,230,0,1,66.76
22,683,456,227,0,1,66.57
23,670,446,224,0,1,49.85
24,331,165,166,0,2,68.09
25,724,493,231,0,1,66.91
26,692,463,229,0,1,68.09
27,705,480,225,0,1,28.47
28,137,39,98,0,5,65.92
29,672,443,229,0,1,66.28
30,694,460,234,0,1,66.62
31,674,449,225,0,1,29.17
32,144,42,102,0,4,66.72
33,670,447,223,0,1,26.95
34,141,38,103,0,4,66.77
35,659,440,219,0,1,67.15
36,691,464,227,0,1,69.06
37,737,509,228,0,1,39.27
38,219,86,133,0,3,21.0
39,100,21,79,0,8,66.81
40,714,477,237,0,1,32.07
41,184,59,125,0,4,34.78
42,161,56,105,0,4,53.87
43,362,195,167,0,2,66.52
44,696,463,233,0,1,64.59
45,627,405,222,0,1,64.97
46,648,421,227,0,1,9.43
47,53,5,48,0,10,64.79
48,676,438,238,0,1,65.52
49,638,418,220,0,1,66.12
50,673,445,228,0,1,29.69
51,128,38,90,0,5,16.47
52,85,14,71,0,9,68.14
53,747,509,238,0,1,67.71
54,700,474,226,0,1,66.67
55,687,458,229,0,1,68.89
56,720,496,224,0,1,67.25
57,690,464,226,0,1,5.0
58,40,2,38,0,17,48.11
59,318,153,165,0,2,66.32
60,674,447,227,0,1,17.39
61,23,4,19,0,26,68.09
62,724,493,231,0,1,64.49
63,628,405,223,0,1,52.46
64,345,181,164,0,2,67.11
65,681,457,224,0,1,16.44
66,73,12,61,0,10,66.36
67,651,432,219,0,1,0.0
68,10,0,10,0,69,65.41
69,636,416,220,0,1,65.7
70,656,431,225,0,1,50.81
71,372,189,183,0,2,67.7
72,678,459,219,0,1,66.14
73,638,422,216,0,1,65.69
74,685,450,235,0,1,32.84
75,201,66,135,0,3,52.33
76,344,180,164,0,2,51.88
77,345,179,166,0,2,41.76
78,261,109,152,0,3,10.64
79,47,5,42,0,15,66.52
80,660,439,221,0,1,65.3
81,634,414,220,0,1,29.2
82,137,40,97,0,5,46.93
83,309,145,164,0,2,67.49
84,686,463,223,0,1,66.72
85,682,455,227,0,1,49.07
86,322,158,164,0,2,64.94
87,676,439,237,0,1,48.92
88,325,159,166,0,2,66.62
89,689,459,230,0,1,67.05
90,695,466,229,0,1,51.23
91,324,166,158,0,2,51.63
92,337,174,163,0,2,39.64
93,222,88,134,0,3,66.18
94,686,454,232,0,1,50.71
95,351,178,173,0,2,67.78
96,717,486,231,0,1,66.72
97,664,443,221,0,1,0.0
98,23,0,23,0,37,38.12
99,181,69,112,0,4,50.15
1 access_count hits misses mu lambda hit_rate
2 1 664 445 219 0 1 37.74
3 2 212 80 132 0 3 66.42
4 3 673 447 226 0 1 67.37
5 4 711 479 232 0 1 51.01
6 5 345 176 169 0 2 64.56
7 6 649 419 230 0 1 29.2
8 7 137 40 97 0 5 66.37
9 8 681 452 229 0 1 66.76
10 9 689 460 229 0 1 66.57
11 10 667 444 223 0 1 52.13
12 11 328 171 157 0 2 67.92
13 12 692 470 222 0 1 66.03
14 13 683 451 232 0 1 66.67
15 14 696 464 232 0 1 48.55
16 15 344 167 177 0 2 48.47
17 16 326 158 168 0 2 66.33
18 17 689 457 232 0 1 65.99
19 18 691 456 235 0 1 41.1
20 19 219 90 129 0 3 68.58
21 20 732 502 230 0 1 68.88
22 21 739 509 230 0 1 66.76
23 22 683 456 227 0 1 66.57
24 23 670 446 224 0 1 49.85
25 24 331 165 166 0 2 68.09
26 25 724 493 231 0 1 66.91
27 26 692 463 229 0 1 68.09
28 27 705 480 225 0 1 28.47
29 28 137 39 98 0 5 65.92
30 29 672 443 229 0 1 66.28
31 30 694 460 234 0 1 66.62
32 31 674 449 225 0 1 29.17
33 32 144 42 102 0 4 66.72
34 33 670 447 223 0 1 26.95
35 34 141 38 103 0 4 66.77
36 35 659 440 219 0 1 67.15
37 36 691 464 227 0 1 69.06
38 37 737 509 228 0 1 39.27
39 38 219 86 133 0 3 21.0
40 39 100 21 79 0 8 66.81
41 40 714 477 237 0 1 32.07
42 41 184 59 125 0 4 34.78
43 42 161 56 105 0 4 53.87
44 43 362 195 167 0 2 66.52
45 44 696 463 233 0 1 64.59
46 45 627 405 222 0 1 64.97
47 46 648 421 227 0 1 9.43
48 47 53 5 48 0 10 64.79
49 48 676 438 238 0 1 65.52
50 49 638 418 220 0 1 66.12
51 50 673 445 228 0 1 29.69
52 51 128 38 90 0 5 16.47
53 52 85 14 71 0 9 68.14
54 53 747 509 238 0 1 67.71
55 54 700 474 226 0 1 66.67
56 55 687 458 229 0 1 68.89
57 56 720 496 224 0 1 67.25
58 57 690 464 226 0 1 5.0
59 58 40 2 38 0 17 48.11
60 59 318 153 165 0 2 66.32
61 60 674 447 227 0 1 17.39
62 61 23 4 19 0 26 68.09
63 62 724 493 231 0 1 64.49
64 63 628 405 223 0 1 52.46
65 64 345 181 164 0 2 67.11
66 65 681 457 224 0 1 16.44
67 66 73 12 61 0 10 66.36
68 67 651 432 219 0 1 0.0
69 68 10 0 10 0 69 65.41
70 69 636 416 220 0 1 65.7
71 70 656 431 225 0 1 50.81
72 71 372 189 183 0 2 67.7
73 72 678 459 219 0 1 66.14
74 73 638 422 216 0 1 65.69
75 74 685 450 235 0 1 32.84
76 75 201 66 135 0 3 52.33
77 76 344 180 164 0 2 51.88
78 77 345 179 166 0 2 41.76
79 78 261 109 152 0 3 10.64
80 79 47 5 42 0 15 66.52
81 80 660 439 221 0 1 65.3
82 81 634 414 220 0 1 29.2
83 82 137 40 97 0 5 46.93
84 83 309 145 164 0 2 67.49
85 84 686 463 223 0 1 66.72
86 85 682 455 227 0 1 49.07
87 86 322 158 164 0 2 64.94
88 87 676 439 237 0 1 48.92
89 88 325 159 166 0 2 66.62
90 89 689 459 230 0 1 67.05
91 90 695 466 229 0 1 51.23
92 91 324 166 158 0 2 51.63
93 92 337 174 163 0 2 39.64
94 93 222 88 134 0 3 66.18
95 94 686 454 232 0 1 50.71
96 95 351 178 173 0 2 67.78
97 96 717 486 231 0 1 66.72
98 97 664 443 221 0 1 0.0
99 98 23 0 23 0 37 38.12
100 99 181 69 112 0 4 50.15

View File

@@ -0,0 +1,101 @@
obj_id,hit_rate,avg_age
1,0.6701807228915663,1.0269662921348315
2,0.37735849056603776,1.2375
3,0.6641901931649331,0.9574944071588367
4,0.6736990154711674,1.0041753653444676
5,0.5101449275362319,0.9829545454545454
6,0.6456086286594761,0.9260143198090692
7,0.291970802919708,1.125
8,0.6637298091042585,0.9867256637168141
9,0.6676342525399129,0.9760869565217392
10,0.6656671664167916,0.9954954954954955
11,0.5213414634146342,0.9883040935672515
12,0.6791907514450867,0.9702127659574468
13,0.6603221083455344,1.0532150776053215
14,0.6666666666666666,1.0668103448275863
15,0.48546511627906974,1.0658682634730539
16,0.48466257668711654,1.0253164556962024
17,0.6632801161103048,1.0284463894967177
18,0.6599131693198264,0.9912280701754386
19,0.410958904109589,1.0
20,0.6857923497267759,1.00199203187251
21,0.6887686062246279,0.9194499017681729
22,0.6676427525622255,0.9780701754385965
23,0.6656716417910448,0.9618834080717489
24,0.4984894259818731,0.9939393939393939
25,0.680939226519337,1.028397565922921
26,0.6690751445086706,1.0172786177105833
27,0.6808510638297872,0.9458333333333333
28,0.2846715328467153,1.1538461538461537
29,0.6592261904761905,0.9616252821670429
30,0.6628242074927954,1.0456521739130435
31,0.6661721068249258,1.0311804008908685
32,0.2916666666666667,0.9523809523809523
33,0.6671641791044776,1.0067114093959733
34,0.2695035460992908,1.105263157894737
35,0.6676783004552352,1.0
36,0.6714905933429812,1.0581896551724137
37,0.6906377204884667,0.9823182711198428
38,0.3926940639269406,1.1162790697674418
39,0.21,1.1904761904761905
40,0.6680672268907563,1.0377358490566038
41,0.32065217391304346,0.8983050847457628
42,0.34782608695652173,1.0892857142857142
43,0.5386740331491713,0.958974358974359
44,0.6652298850574713,0.9395248380129589
45,0.645933014354067,1.0148148148148148
46,0.6496913580246914,1.0332541567695963
47,0.09433962264150944,0.6
48,0.6479289940828402,0.8972602739726028
49,0.6551724137931034,0.9497607655502392
50,0.6612184249628529,0.9775280898876404
51,0.296875,0.8947368421052632
52,0.16470588235294117,0.7857142857142857
53,0.6813922356091031,0.9960707269155207
54,0.6771428571428572,1.0168776371308017
55,0.6666666666666666,0.9541484716157205
56,0.6888888888888889,1.002016129032258
57,0.672463768115942,0.9612068965517241
58,0.05,1.0
59,0.4811320754716981,1.0065359477124183
60,0.6632047477744807,0.9798657718120806
61,0.17391304347826086,0.25
62,0.680939226519337,1.026369168356998
63,0.6449044585987261,0.945679012345679
64,0.5246376811594203,1.0165745856353592
65,0.671071953010279,1.0087527352297594
66,0.1643835616438356,1.0833333333333333
67,0.663594470046083,0.9652777777777778
68,0.0,0.0
69,0.6540880503144654,0.9447115384615384
70,0.6570121951219512,1.0092807424593968
71,0.5080645161290323,1.0052910052910053
72,0.6769911504424779,0.9368191721132898
73,0.6614420062695925,0.9881516587677726
74,0.656934306569343,0.94
75,0.3283582089552239,0.9393939393939394
76,0.5232558139534884,1.0055555555555555
77,0.518840579710145,0.994413407821229
78,0.41762452107279696,0.9724770642201835
79,0.10638297872340426,0.8
80,0.6651515151515152,1.0227790432801822
81,0.6529968454258676,0.9154589371980676
82,0.291970802919708,1.1
83,0.4692556634304207,1.0689655172413792
84,0.6749271137026239,0.9848812095032398
85,0.6671554252199413,0.9956043956043956
86,0.4906832298136646,1.0949367088607596
87,0.6494082840236687,1.0501138952164009
88,0.48923076923076925,0.9748427672955975
89,0.6661828737300436,0.9564270152505446
90,0.6705035971223021,0.9463519313304721
91,0.5123456790123457,1.0602409638554218
92,0.516320474777448,1.0
93,0.3963963963963964,0.9204545454545454
94,0.6618075801749271,1.002202643171806
95,0.5071225071225072,0.9157303370786517
96,0.6778242677824268,0.9732510288065843
97,0.6671686746987951,0.9977426636568849
98,0.0,0.0
99,0.3812154696132597,1.0289855072463767
100,0.5014836795252225,0.9467455621301775
1 obj_id hit_rate avg_age
2 1 0.6701807228915663 1.0269662921348315
3 2 0.37735849056603776 1.2375
4 3 0.6641901931649331 0.9574944071588367
5 4 0.6736990154711674 1.0041753653444676
6 5 0.5101449275362319 0.9829545454545454
7 6 0.6456086286594761 0.9260143198090692
8 7 0.291970802919708 1.125
9 8 0.6637298091042585 0.9867256637168141
10 9 0.6676342525399129 0.9760869565217392
11 10 0.6656671664167916 0.9954954954954955
12 11 0.5213414634146342 0.9883040935672515
13 12 0.6791907514450867 0.9702127659574468
14 13 0.6603221083455344 1.0532150776053215
15 14 0.6666666666666666 1.0668103448275863
16 15 0.48546511627906974 1.0658682634730539
17 16 0.48466257668711654 1.0253164556962024
18 17 0.6632801161103048 1.0284463894967177
19 18 0.6599131693198264 0.9912280701754386
20 19 0.410958904109589 1.0
21 20 0.6857923497267759 1.00199203187251
22 21 0.6887686062246279 0.9194499017681729
23 22 0.6676427525622255 0.9780701754385965
24 23 0.6656716417910448 0.9618834080717489
25 24 0.4984894259818731 0.9939393939393939
26 25 0.680939226519337 1.028397565922921
27 26 0.6690751445086706 1.0172786177105833
28 27 0.6808510638297872 0.9458333333333333
29 28 0.2846715328467153 1.1538461538461537
30 29 0.6592261904761905 0.9616252821670429
31 30 0.6628242074927954 1.0456521739130435
32 31 0.6661721068249258 1.0311804008908685
33 32 0.2916666666666667 0.9523809523809523
34 33 0.6671641791044776 1.0067114093959733
35 34 0.2695035460992908 1.105263157894737
36 35 0.6676783004552352 1.0
37 36 0.6714905933429812 1.0581896551724137
38 37 0.6906377204884667 0.9823182711198428
39 38 0.3926940639269406 1.1162790697674418
40 39 0.21 1.1904761904761905
41 40 0.6680672268907563 1.0377358490566038
42 41 0.32065217391304346 0.8983050847457628
43 42 0.34782608695652173 1.0892857142857142
44 43 0.5386740331491713 0.958974358974359
45 44 0.6652298850574713 0.9395248380129589
46 45 0.645933014354067 1.0148148148148148
47 46 0.6496913580246914 1.0332541567695963
48 47 0.09433962264150944 0.6
49 48 0.6479289940828402 0.8972602739726028
50 49 0.6551724137931034 0.9497607655502392
51 50 0.6612184249628529 0.9775280898876404
52 51 0.296875 0.8947368421052632
53 52 0.16470588235294117 0.7857142857142857
54 53 0.6813922356091031 0.9960707269155207
55 54 0.6771428571428572 1.0168776371308017
56 55 0.6666666666666666 0.9541484716157205
57 56 0.6888888888888889 1.002016129032258
58 57 0.672463768115942 0.9612068965517241
59 58 0.05 1.0
60 59 0.4811320754716981 1.0065359477124183
61 60 0.6632047477744807 0.9798657718120806
62 61 0.17391304347826086 0.25
63 62 0.680939226519337 1.026369168356998
64 63 0.6449044585987261 0.945679012345679
65 64 0.5246376811594203 1.0165745856353592
66 65 0.671071953010279 1.0087527352297594
67 66 0.1643835616438356 1.0833333333333333
68 67 0.663594470046083 0.9652777777777778
69 68 0.0 0.0
70 69 0.6540880503144654 0.9447115384615384
71 70 0.6570121951219512 1.0092807424593968
72 71 0.5080645161290323 1.0052910052910053
73 72 0.6769911504424779 0.9368191721132898
74 73 0.6614420062695925 0.9881516587677726
75 74 0.656934306569343 0.94
76 75 0.3283582089552239 0.9393939393939394
77 76 0.5232558139534884 1.0055555555555555
78 77 0.518840579710145 0.994413407821229
79 78 0.41762452107279696 0.9724770642201835
80 79 0.10638297872340426 0.8
81 80 0.6651515151515152 1.0227790432801822
82 81 0.6529968454258676 0.9154589371980676
83 82 0.291970802919708 1.1
84 83 0.4692556634304207 1.0689655172413792
85 84 0.6749271137026239 0.9848812095032398
86 85 0.6671554252199413 0.9956043956043956
87 86 0.4906832298136646 1.0949367088607596
88 87 0.6494082840236687 1.0501138952164009
89 88 0.48923076923076925 0.9748427672955975
90 89 0.6661828737300436 0.9564270152505446
91 90 0.6705035971223021 0.9463519313304721
92 91 0.5123456790123457 1.0602409638554218
93 92 0.516320474777448 1.0
94 93 0.3963963963963964 0.9204545454545454
95 94 0.6618075801749271 1.002202643171806
96 95 0.5071225071225072 0.9157303370786517
97 96 0.6778242677824268 0.9732510288065843
98 97 0.6671686746987951 0.9977426636568849
99 98 0.0 0.0
100 99 0.3812154696132597 1.0289855072463767
101 100 0.5014836795252225 0.9467455621301775

View File

@@ -0,0 +1,9 @@
,hit_rate,avg_age
count,100.0,100.0
mean,0.5381173912695726,0.966399936751214
std,0.18361763609229173,0.17530494397945118
min,0.0,0.0
25%,0.47816297246137873,0.9537065918070284
50%,0.6546302320537845,0.9949544516583623
75%,0.667165303003057,1.0265184493014563
max,0.6906377204884667,1.2375
1 hit_rate avg_age
2 count 100.0 100.0
3 mean 0.5381173912695726 0.966399936751214
4 std 0.18361763609229173 0.17530494397945118
5 min 0.0 0.0
6 25% 0.47816297246137873 0.9537065918070284
7 50% 0.6546302320537845 0.9949544516583623
8 75% 0.667165303003057 1.0265184493014563
9 max 0.6906377204884667 1.2375