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,527,137,0,1,52.83
2,212,112,100,0,3,79.79
3,673,537,136,0,1,80.87
4,711,575,136,0,1,68.99
5,345,238,107,0,2,79.35
6,649,515,134,0,1,43.8
7,137,60,77,0,5,80.32
8,681,547,134,0,1,79.97
9,689,551,138,0,1,79.31
10,667,529,138,0,1,68.29
11,328,224,104,0,2,80.2
12,692,555,137,0,1,80.09
13,683,547,136,0,1,80.6
14,696,561,135,0,1,67.15
15,344,231,113,0,2,65.64
16,326,214,112,0,2,80.12
17,689,552,137,0,1,80.32
18,691,555,136,0,1,55.71
19,219,122,97,0,3,80.87
20,732,592,140,0,1,81.33
21,739,601,138,0,1,79.8
22,683,545,138,0,1,79.85
23,670,535,135,0,1,67.07
24,331,222,109,0,2,80.66
25,724,584,140,0,1,80.35
26,692,556,136,0,1,80.85
27,705,570,135,0,1,43.8
28,137,60,77,0,5,79.76
29,672,536,136,0,1,79.83
30,694,554,140,0,1,79.82
31,674,538,136,0,1,47.92
32,144,69,75,0,4,79.55
33,670,533,137,0,1,43.26
34,141,61,80,0,4,79.51
35,659,524,135,0,1,80.03
36,691,553,138,0,1,80.73
37,737,595,142,0,1,57.08
38,219,125,94,0,3,37.0
39,100,37,63,0,8,80.39
40,714,574,140,0,1,50.54
41,184,93,91,0,4,47.83
42,161,77,84,0,4,68.51
43,362,248,114,0,2,80.6
44,696,561,135,0,1,78.63
45,627,493,134,0,1,79.63
46,648,516,132,0,1,24.53
47,53,13,40,0,10,79.73
48,676,539,137,0,1,78.68
49,638,502,136,0,1,79.35
50,673,534,139,0,1,42.97
51,128,55,73,0,5,30.59
52,85,26,59,0,9,81.12
53,747,606,141,0,1,81.0
54,700,567,133,0,1,80.2
55,687,551,136,0,1,81.25
56,720,585,135,0,1,79.57
57,690,549,141,0,1,12.5
58,40,5,35,0,17,65.72
59,318,209,109,0,2,79.82
60,674,538,136,0,1,21.74
61,23,5,18,0,26,80.94
62,724,586,138,0,1,78.34
63,628,492,136,0,1,66.96
64,345,231,114,0,2,80.62
65,681,549,132,0,1,28.77
66,73,21,52,0,10,79.57
67,651,518,133,0,1,0.0
68,10,0,10,0,69,78.46
69,636,499,137,0,1,79.73
70,656,523,133,0,1,67.74
71,372,252,120,0,2,80.38
72,678,545,133,0,1,79.31
73,638,506,132,0,1,79.85
74,685,547,138,0,1,52.24
75,201,105,96,0,3,65.99
76,344,227,117,0,2,68.41
77,345,236,109,0,2,59.0
78,261,154,107,0,3,14.89
79,47,7,40,0,15,79.7
80,660,526,134,0,1,79.02
81,634,501,133,0,1,43.07
82,137,59,78,0,5,65.05
83,309,201,108,0,2,80.47
84,686,552,134,0,1,79.47
85,682,542,140,0,1,64.91
86,322,209,113,0,2,79.14
87,676,535,141,0,1,65.23
88,325,212,113,0,2,80.41
89,689,554,135,0,1,80.43
90,695,559,136,0,1,67.59
91,324,219,105,0,2,67.36
92,337,227,110,0,2,56.76
93,222,126,96,0,3,79.74
94,686,547,139,0,1,68.38
95,351,240,111,0,2,80.61
96,717,578,139,0,1,79.52
97,664,528,136,0,1,17.39
98,23,4,19,0,37,53.04
99,181,96,85,0,4,68.25
1 access_count hits misses mu lambda hit_rate
2 1 664 527 137 0 1 52.83
3 2 212 112 100 0 3 79.79
4 3 673 537 136 0 1 80.87
5 4 711 575 136 0 1 68.99
6 5 345 238 107 0 2 79.35
7 6 649 515 134 0 1 43.8
8 7 137 60 77 0 5 80.32
9 8 681 547 134 0 1 79.97
10 9 689 551 138 0 1 79.31
11 10 667 529 138 0 1 68.29
12 11 328 224 104 0 2 80.2
13 12 692 555 137 0 1 80.09
14 13 683 547 136 0 1 80.6
15 14 696 561 135 0 1 67.15
16 15 344 231 113 0 2 65.64
17 16 326 214 112 0 2 80.12
18 17 689 552 137 0 1 80.32
19 18 691 555 136 0 1 55.71
20 19 219 122 97 0 3 80.87
21 20 732 592 140 0 1 81.33
22 21 739 601 138 0 1 79.8
23 22 683 545 138 0 1 79.85
24 23 670 535 135 0 1 67.07
25 24 331 222 109 0 2 80.66
26 25 724 584 140 0 1 80.35
27 26 692 556 136 0 1 80.85
28 27 705 570 135 0 1 43.8
29 28 137 60 77 0 5 79.76
30 29 672 536 136 0 1 79.83
31 30 694 554 140 0 1 79.82
32 31 674 538 136 0 1 47.92
33 32 144 69 75 0 4 79.55
34 33 670 533 137 0 1 43.26
35 34 141 61 80 0 4 79.51
36 35 659 524 135 0 1 80.03
37 36 691 553 138 0 1 80.73
38 37 737 595 142 0 1 57.08
39 38 219 125 94 0 3 37.0
40 39 100 37 63 0 8 80.39
41 40 714 574 140 0 1 50.54
42 41 184 93 91 0 4 47.83
43 42 161 77 84 0 4 68.51
44 43 362 248 114 0 2 80.6
45 44 696 561 135 0 1 78.63
46 45 627 493 134 0 1 79.63
47 46 648 516 132 0 1 24.53
48 47 53 13 40 0 10 79.73
49 48 676 539 137 0 1 78.68
50 49 638 502 136 0 1 79.35
51 50 673 534 139 0 1 42.97
52 51 128 55 73 0 5 30.59
53 52 85 26 59 0 9 81.12
54 53 747 606 141 0 1 81.0
55 54 700 567 133 0 1 80.2
56 55 687 551 136 0 1 81.25
57 56 720 585 135 0 1 79.57
58 57 690 549 141 0 1 12.5
59 58 40 5 35 0 17 65.72
60 59 318 209 109 0 2 79.82
61 60 674 538 136 0 1 21.74
62 61 23 5 18 0 26 80.94
63 62 724 586 138 0 1 78.34
64 63 628 492 136 0 1 66.96
65 64 345 231 114 0 2 80.62
66 65 681 549 132 0 1 28.77
67 66 73 21 52 0 10 79.57
68 67 651 518 133 0 1 0.0
69 68 10 0 10 0 69 78.46
70 69 636 499 137 0 1 79.73
71 70 656 523 133 0 1 67.74
72 71 372 252 120 0 2 80.38
73 72 678 545 133 0 1 79.31
74 73 638 506 132 0 1 79.85
75 74 685 547 138 0 1 52.24
76 75 201 105 96 0 3 65.99
77 76 344 227 117 0 2 68.41
78 77 345 236 109 0 2 59.0
79 78 261 154 107 0 3 14.89
80 79 47 7 40 0 15 79.7
81 80 660 526 134 0 1 79.02
82 81 634 501 133 0 1 43.07
83 82 137 59 78 0 5 65.05
84 83 309 201 108 0 2 80.47
85 84 686 552 134 0 1 79.47
86 85 682 542 140 0 1 64.91
87 86 322 209 113 0 2 79.14
88 87 676 535 141 0 1 65.23
89 88 325 212 113 0 2 80.41
90 89 689 554 135 0 1 80.43
91 90 695 559 136 0 1 67.59
92 91 324 219 105 0 2 67.36
93 92 337 227 110 0 2 56.76
94 93 222 126 96 0 3 79.74
95 94 686 547 139 0 1 68.38
96 95 351 240 111 0 2 80.61
97 96 717 578 139 0 1 79.52
98 97 664 528 136 0 1 17.39
99 98 23 4 19 0 37 53.04
100 99 181 96 85 0 4 68.25

View File

@@ -0,0 +1,101 @@
obj_id,hit_rate,avg_age
1,0.7936746987951807,1.9316888045540797
2,0.5283018867924528,2.080357142857143
3,0.7979197622585439,2.0242085661080074
4,0.8087201125175809,2.1339130434782607
5,0.6898550724637681,2.168067226890756
6,0.7935285053929122,1.9300970873786407
7,0.43795620437956206,1.9333333333333333
8,0.8032305433186491,2.03290676416819
9,0.7997097242380261,1.9945553539019965
10,0.7931034482758621,2.007561436672968
11,0.6829268292682927,1.9866071428571428
12,0.8020231213872833,1.936936936936937
13,0.8008784773060029,2.113345521023766
14,0.8060344827586207,1.9946524064171123
15,0.6715116279069767,1.8874458874458875
16,0.656441717791411,2.046728971962617
17,0.8011611030478955,1.9728260869565217
18,0.8031837916063675,2.045045045045045
19,0.5570776255707762,1.9344262295081966
20,0.8087431693989071,2.0591216216216215
21,0.8132611637347767,2.043261231281198
22,0.7979502196193266,1.9064220183486238
23,0.7985074626865671,1.97196261682243
24,0.6706948640483383,2.1036036036036037
25,0.8066298342541437,1.9777397260273972
26,0.8034682080924855,2.1097122302158273
27,0.8085106382978723,2.1070175438596492
28,0.43795620437956206,2.1666666666666665
29,0.7976190476190477,1.9011194029850746
30,0.7982708933717579,1.96028880866426
31,0.798219584569733,2.0780669144981414
32,0.4791666666666667,2.1594202898550723
33,0.7955223880597015,1.8818011257035647
34,0.4326241134751773,2.2131147540983607
35,0.795144157814871,2.068702290076336
36,0.8002894356005789,1.9620253164556962
37,0.8073270013568521,1.946218487394958
38,0.5707762557077626,2.096
39,0.37,2.27027027027027
40,0.803921568627451,2.06794425087108
41,0.5054347826086957,2.204301075268817
42,0.4782608695652174,2.1948051948051948
43,0.6850828729281768,1.8830645161290323
44,0.8060344827586207,2.0089126559714794
45,0.7862838915470495,1.997971602434077
46,0.7962962962962963,2.0174418604651163
47,0.24528301886792453,2.1538461538461537
48,0.7973372781065089,1.9851576994434137
49,0.786833855799373,2.0358565737051793
50,0.7934621099554234,1.9194756554307115
51,0.4296875,1.6363636363636365
52,0.3058823529411765,1.8846153846153846
53,0.8112449799196787,2.0132013201320134
54,0.81,2.0
55,0.8020378457059679,1.9310344827586208
56,0.8125,1.982905982905983
57,0.7956521739130434,2.0491803278688523
58,0.125,2.2
59,0.6572327044025157,1.9569377990430623
60,0.798219584569733,2.029739776951673
61,0.21739130434782608,0.6
62,0.8093922651933702,1.9112627986348123
63,0.7834394904458599,1.8333333333333333
64,0.6695652173913044,1.948051948051948
65,0.8061674008810573,2.034608378870674
66,0.2876712328767123,2.0952380952380953
67,0.7956989247311828,2.0656370656370657
68,0.0,0.0
69,0.7845911949685535,1.9799599198396793
70,0.7972560975609756,2.0095602294455066
71,0.6774193548387096,1.9722222222222223
72,0.803834808259587,1.891743119266055
73,0.7931034482758621,1.8893280632411067
74,0.7985401459854015,2.043875685557587
75,0.5223880597014925,2.2095238095238097
76,0.6598837209302325,1.9955947136563876
77,0.6840579710144927,2.0254237288135593
78,0.5900383141762452,2.0064935064935066
79,0.14893617021276595,1.5714285714285714
80,0.796969696969697,2.0
81,0.7902208201892744,2.0339321357285427
82,0.4306569343065693,1.8644067796610169
83,0.6504854368932039,2.2487562189054726
84,0.8046647230320699,1.9909420289855073
85,0.7947214076246334,1.985239852398524
86,0.6490683229813664,1.8229665071770336
87,0.7914201183431953,2.0261682242990653
88,0.6523076923076923,1.9575471698113207
89,0.8040638606676342,1.94043321299639
90,0.8043165467625899,2.0697674418604652
91,0.6759259259259259,1.9680365296803652
92,0.6735905044510386,1.9162995594713657
93,0.5675675675675675,1.9523809523809523
94,0.7973760932944607,2.1316270566727606
95,0.6837606837606838,2.0208333333333335
96,0.806136680613668,2.0328719723183393
97,0.7951807228915663,1.9109848484848484
98,0.17391304347826086,3.0
99,0.5303867403314917,1.8854166666666667
100,0.6824925816023739,1.8956521739130434
1 obj_id hit_rate avg_age
2 1 0.7936746987951807 1.9316888045540797
3 2 0.5283018867924528 2.080357142857143
4 3 0.7979197622585439 2.0242085661080074
5 4 0.8087201125175809 2.1339130434782607
6 5 0.6898550724637681 2.168067226890756
7 6 0.7935285053929122 1.9300970873786407
8 7 0.43795620437956206 1.9333333333333333
9 8 0.8032305433186491 2.03290676416819
10 9 0.7997097242380261 1.9945553539019965
11 10 0.7931034482758621 2.007561436672968
12 11 0.6829268292682927 1.9866071428571428
13 12 0.8020231213872833 1.936936936936937
14 13 0.8008784773060029 2.113345521023766
15 14 0.8060344827586207 1.9946524064171123
16 15 0.6715116279069767 1.8874458874458875
17 16 0.656441717791411 2.046728971962617
18 17 0.8011611030478955 1.9728260869565217
19 18 0.8031837916063675 2.045045045045045
20 19 0.5570776255707762 1.9344262295081966
21 20 0.8087431693989071 2.0591216216216215
22 21 0.8132611637347767 2.043261231281198
23 22 0.7979502196193266 1.9064220183486238
24 23 0.7985074626865671 1.97196261682243
25 24 0.6706948640483383 2.1036036036036037
26 25 0.8066298342541437 1.9777397260273972
27 26 0.8034682080924855 2.1097122302158273
28 27 0.8085106382978723 2.1070175438596492
29 28 0.43795620437956206 2.1666666666666665
30 29 0.7976190476190477 1.9011194029850746
31 30 0.7982708933717579 1.96028880866426
32 31 0.798219584569733 2.0780669144981414
33 32 0.4791666666666667 2.1594202898550723
34 33 0.7955223880597015 1.8818011257035647
35 34 0.4326241134751773 2.2131147540983607
36 35 0.795144157814871 2.068702290076336
37 36 0.8002894356005789 1.9620253164556962
38 37 0.8073270013568521 1.946218487394958
39 38 0.5707762557077626 2.096
40 39 0.37 2.27027027027027
41 40 0.803921568627451 2.06794425087108
42 41 0.5054347826086957 2.204301075268817
43 42 0.4782608695652174 2.1948051948051948
44 43 0.6850828729281768 1.8830645161290323
45 44 0.8060344827586207 2.0089126559714794
46 45 0.7862838915470495 1.997971602434077
47 46 0.7962962962962963 2.0174418604651163
48 47 0.24528301886792453 2.1538461538461537
49 48 0.7973372781065089 1.9851576994434137
50 49 0.786833855799373 2.0358565737051793
51 50 0.7934621099554234 1.9194756554307115
52 51 0.4296875 1.6363636363636365
53 52 0.3058823529411765 1.8846153846153846
54 53 0.8112449799196787 2.0132013201320134
55 54 0.81 2.0
56 55 0.8020378457059679 1.9310344827586208
57 56 0.8125 1.982905982905983
58 57 0.7956521739130434 2.0491803278688523
59 58 0.125 2.2
60 59 0.6572327044025157 1.9569377990430623
61 60 0.798219584569733 2.029739776951673
62 61 0.21739130434782608 0.6
63 62 0.8093922651933702 1.9112627986348123
64 63 0.7834394904458599 1.8333333333333333
65 64 0.6695652173913044 1.948051948051948
66 65 0.8061674008810573 2.034608378870674
67 66 0.2876712328767123 2.0952380952380953
68 67 0.7956989247311828 2.0656370656370657
69 68 0.0 0.0
70 69 0.7845911949685535 1.9799599198396793
71 70 0.7972560975609756 2.0095602294455066
72 71 0.6774193548387096 1.9722222222222223
73 72 0.803834808259587 1.891743119266055
74 73 0.7931034482758621 1.8893280632411067
75 74 0.7985401459854015 2.043875685557587
76 75 0.5223880597014925 2.2095238095238097
77 76 0.6598837209302325 1.9955947136563876
78 77 0.6840579710144927 2.0254237288135593
79 78 0.5900383141762452 2.0064935064935066
80 79 0.14893617021276595 1.5714285714285714
81 80 0.796969696969697 2.0
82 81 0.7902208201892744 2.0339321357285427
83 82 0.4306569343065693 1.8644067796610169
84 83 0.6504854368932039 2.2487562189054726
85 84 0.8046647230320699 1.9909420289855073
86 85 0.7947214076246334 1.985239852398524
87 86 0.6490683229813664 1.8229665071770336
88 87 0.7914201183431953 2.0261682242990653
89 88 0.6523076923076923 1.9575471698113207
90 89 0.8040638606676342 1.94043321299639
91 90 0.8043165467625899 2.0697674418604652
92 91 0.6759259259259259 1.9680365296803652
93 92 0.6735905044510386 1.9162995594713657
94 93 0.5675675675675675 1.9523809523809523
95 94 0.7973760932944607 2.1316270566727606
96 95 0.6837606837606838 2.0208333333333335
97 96 0.806136680613668 2.0328719723183393
98 97 0.7951807228915663 1.9109848484848484
99 98 0.17391304347826086 3.0
100 99 0.5303867403314917 1.8854166666666667
101 100 0.6824925816023739 1.8956521739130434

View File

@@ -0,0 +1,9 @@
,hit_rate,avg_age
count,100.0,100.0
mean,0.6783420943812974,1.9802754170895376
std,0.18732473237217517,0.28636988978093675
min,0.0,0.0
25%,0.6501311584152445,1.9341530054644809
50%,0.7932827791156427,1.9989858012170385
75%,0.800949133741476,2.0662138619455694
max,0.8132611637347767,3.0
1 hit_rate avg_age
2 count 100.0 100.0
3 mean 0.6783420943812974 1.9802754170895376
4 std 0.18732473237217517 0.28636988978093675
5 min 0.0 0.0
6 25% 0.6501311584152445 1.9341530054644809
7 50% 0.7932827791156427 1.9989858012170385
8 75% 0.800949133741476 2.0662138619455694
9 max 0.8132611637347767 3.0