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,494,170,0,1,45.28
2,212,96,116,0,3,74.15
3,673,499,174,0,1,76.65
4,711,545,166,0,1,60.0
5,345,207,138,0,2,73.96
6,649,480,169,0,1,38.69
7,137,53,84,0,5,74.3
8,681,506,175,0,1,74.6
9,689,514,175,0,1,74.66
10,667,498,169,0,1,60.37
11,328,198,130,0,2,75.29
12,692,521,171,0,1,74.96
13,683,512,171,0,1,74.71
14,696,520,176,0,1,60.76
15,344,209,135,0,2,59.2
16,326,193,133,0,2,75.47
17,689,520,169,0,1,75.11
18,691,519,172,0,1,51.6
19,219,113,106,0,3,75.96
20,732,556,176,0,1,76.32
21,739,564,175,0,1,75.26
22,683,514,169,0,1,74.78
23,670,501,169,0,1,57.4
24,331,190,141,0,2,75.83
25,724,549,175,0,1,74.86
26,692,518,174,0,1,75.74
27,705,534,171,0,1,37.23
28,137,51,86,0,5,75.15
29,672,505,167,0,1,74.64
30,694,518,176,0,1,74.78
31,674,504,170,0,1,38.89
32,144,56,88,0,4,74.93
33,670,502,168,0,1,31.91
34,141,45,96,0,4,74.66
35,659,492,167,0,1,75.4
36,691,521,170,0,1,76.12
37,737,561,176,0,1,48.86
38,219,107,112,0,3,28.0
39,100,28,72,0,8,75.91
40,714,542,172,0,1,42.39
41,184,78,106,0,4,43.48
42,161,70,91,0,4,61.88
43,362,224,138,0,2,75.43
44,696,525,171,0,1,73.21
45,627,459,168,0,1,75.15
46,648,487,161,0,1,22.64
47,53,12,41,0,10,74.85
48,676,506,170,0,1,73.98
49,638,472,166,0,1,74.59
50,673,502,171,0,1,39.06
51,128,50,78,0,5,21.18
52,85,18,67,0,9,76.57
53,747,572,175,0,1,76.0
54,700,532,168,0,1,75.25
55,687,517,170,0,1,75.42
56,720,543,177,0,1,75.36
57,690,520,170,0,1,10.0
58,40,4,36,0,17,60.69
59,318,193,125,0,2,74.93
60,674,505,169,0,1,21.74
61,23,5,18,0,26,75.55
62,724,547,177,0,1,74.2
63,628,466,162,0,1,60.29
64,345,208,137,0,2,74.89
65,681,510,171,0,1,23.29
66,73,17,56,0,10,74.35
67,651,484,167,0,1,0.0
68,10,0,10,0,69,73.9
69,636,470,166,0,1,74.7
70,656,490,166,0,1,61.56
71,372,229,143,0,2,75.52
72,678,512,166,0,1,73.51
73,638,469,169,0,1,74.89
74,685,513,172,0,1,44.28
75,201,89,112,0,3,59.88
76,344,206,138,0,2,61.45
77,345,212,133,0,2,50.19
78,261,131,130,0,3,10.64
79,47,5,42,0,15,75.3
80,660,497,163,0,1,74.29
81,634,471,163,0,1,37.96
82,137,52,85,0,5,57.28
83,309,177,132,0,2,75.51
84,686,518,168,0,1,74.63
85,682,509,173,0,1,58.39
86,322,188,134,0,2,74.7
87,676,505,171,0,1,58.15
88,325,189,136,0,2,75.62
89,689,521,168,0,1,75.11
90,695,522,173,0,1,62.35
91,324,202,122,0,2,60.53
92,337,204,133,0,2,47.75
93,222,106,116,0,3,75.07
94,686,515,171,0,1,62.39
95,351,219,132,0,2,76.29
96,717,547,170,0,1,74.4
97,664,494,170,0,1,8.7
98,23,2,21,0,37,46.96
99,181,85,96,0,4,59.64
1 access_count hits misses mu lambda hit_rate
2 1 664 494 170 0 1 45.28
3 2 212 96 116 0 3 74.15
4 3 673 499 174 0 1 76.65
5 4 711 545 166 0 1 60.0
6 5 345 207 138 0 2 73.96
7 6 649 480 169 0 1 38.69
8 7 137 53 84 0 5 74.3
9 8 681 506 175 0 1 74.6
10 9 689 514 175 0 1 74.66
11 10 667 498 169 0 1 60.37
12 11 328 198 130 0 2 75.29
13 12 692 521 171 0 1 74.96
14 13 683 512 171 0 1 74.71
15 14 696 520 176 0 1 60.76
16 15 344 209 135 0 2 59.2
17 16 326 193 133 0 2 75.47
18 17 689 520 169 0 1 75.11
19 18 691 519 172 0 1 51.6
20 19 219 113 106 0 3 75.96
21 20 732 556 176 0 1 76.32
22 21 739 564 175 0 1 75.26
23 22 683 514 169 0 1 74.78
24 23 670 501 169 0 1 57.4
25 24 331 190 141 0 2 75.83
26 25 724 549 175 0 1 74.86
27 26 692 518 174 0 1 75.74
28 27 705 534 171 0 1 37.23
29 28 137 51 86 0 5 75.15
30 29 672 505 167 0 1 74.64
31 30 694 518 176 0 1 74.78
32 31 674 504 170 0 1 38.89
33 32 144 56 88 0 4 74.93
34 33 670 502 168 0 1 31.91
35 34 141 45 96 0 4 74.66
36 35 659 492 167 0 1 75.4
37 36 691 521 170 0 1 76.12
38 37 737 561 176 0 1 48.86
39 38 219 107 112 0 3 28.0
40 39 100 28 72 0 8 75.91
41 40 714 542 172 0 1 42.39
42 41 184 78 106 0 4 43.48
43 42 161 70 91 0 4 61.88
44 43 362 224 138 0 2 75.43
45 44 696 525 171 0 1 73.21
46 45 627 459 168 0 1 75.15
47 46 648 487 161 0 1 22.64
48 47 53 12 41 0 10 74.85
49 48 676 506 170 0 1 73.98
50 49 638 472 166 0 1 74.59
51 50 673 502 171 0 1 39.06
52 51 128 50 78 0 5 21.18
53 52 85 18 67 0 9 76.57
54 53 747 572 175 0 1 76.0
55 54 700 532 168 0 1 75.25
56 55 687 517 170 0 1 75.42
57 56 720 543 177 0 1 75.36
58 57 690 520 170 0 1 10.0
59 58 40 4 36 0 17 60.69
60 59 318 193 125 0 2 74.93
61 60 674 505 169 0 1 21.74
62 61 23 5 18 0 26 75.55
63 62 724 547 177 0 1 74.2
64 63 628 466 162 0 1 60.29
65 64 345 208 137 0 2 74.89
66 65 681 510 171 0 1 23.29
67 66 73 17 56 0 10 74.35
68 67 651 484 167 0 1 0.0
69 68 10 0 10 0 69 73.9
70 69 636 470 166 0 1 74.7
71 70 656 490 166 0 1 61.56
72 71 372 229 143 0 2 75.52
73 72 678 512 166 0 1 73.51
74 73 638 469 169 0 1 74.89
75 74 685 513 172 0 1 44.28
76 75 201 89 112 0 3 59.88
77 76 344 206 138 0 2 61.45
78 77 345 212 133 0 2 50.19
79 78 261 131 130 0 3 10.64
80 79 47 5 42 0 15 75.3
81 80 660 497 163 0 1 74.29
82 81 634 471 163 0 1 37.96
83 82 137 52 85 0 5 57.28
84 83 309 177 132 0 2 75.51
85 84 686 518 168 0 1 74.63
86 85 682 509 173 0 1 58.39
87 86 322 188 134 0 2 74.7
88 87 676 505 171 0 1 58.15
89 88 325 189 136 0 2 75.62
90 89 689 521 168 0 1 75.11
91 90 695 522 173 0 1 62.35
92 91 324 202 122 0 2 60.53
93 92 337 204 133 0 2 47.75
94 93 222 106 116 0 3 75.07
95 94 686 515 171 0 1 62.39
96 95 351 219 132 0 2 76.29
97 96 717 547 170 0 1 74.4
98 97 664 494 170 0 1 8.7
99 98 23 2 21 0 37 46.96
100 99 181 85 96 0 4 59.64

View File

@@ -0,0 +1,101 @@
obj_id,hit_rate,avg_age
1,0.7439759036144579,1.45748987854251
2,0.4528301886792453,1.5416666666666667
3,0.7414561664190193,1.4909819639278556
4,0.7665260196905767,1.6018348623853211
5,0.6,1.5507246376811594
6,0.7395993836671803,1.5833333333333333
7,0.38686131386861317,1.6603773584905661
8,0.7430249632892805,1.4703557312252964
9,0.7460087082728593,1.461089494163424
10,0.7466266866566716,1.4759036144578312
11,0.6036585365853658,1.4444444444444444
12,0.7528901734104047,1.4491362763915547
13,0.7496339677891655,1.537109375
14,0.7471264367816092,1.5596153846153846
15,0.6075581395348837,1.5023923444976077
16,0.5920245398773006,1.5803108808290156
17,0.7547169811320755,1.6423076923076922
18,0.7510853835021708,1.5260115606936415
19,0.5159817351598174,1.6106194690265487
20,0.7595628415300546,1.4460431654676258
21,0.7631935047361299,1.5088652482269505
22,0.7525622254758418,1.5291828793774318
23,0.7477611940298508,1.403193612774451
24,0.5740181268882175,1.563157894736842
25,0.7582872928176796,1.5136612021857923
26,0.7485549132947977,1.5347490347490347
27,0.7574468085106383,1.4138576779026217
28,0.3722627737226277,1.5098039215686274
29,0.7514880952380952,1.506930693069307
30,0.7463976945244957,1.555984555984556
31,0.7477744807121661,1.5297619047619047
32,0.3888888888888889,1.5
33,0.7492537313432835,1.4302788844621515
34,0.3191489361702128,1.3777777777777778
35,0.7465857359635811,1.5142276422764227
36,0.7539797395079595,1.5009596928982725
37,0.7611940298507462,1.5080213903743316
38,0.4885844748858447,1.5794392523364487
39,0.28,1.6785714285714286
40,0.7591036414565826,1.6199261992619927
41,0.42391304347826086,1.7179487179487178
42,0.43478260869565216,1.6857142857142857
43,0.6187845303867403,1.3392857142857142
44,0.7543103448275862,1.5447619047619048
45,0.7320574162679426,1.5359477124183007
46,0.7515432098765432,1.5010266940451746
47,0.22641509433962265,1.9166666666666667
48,0.7485207100591716,1.5118577075098814
49,0.7398119122257053,1.4406779661016949
50,0.7459138187221397,1.4760956175298805
51,0.390625,1.44
52,0.21176470588235294,1.2777777777777777
53,0.7657295850066934,1.4912587412587412
54,0.76,1.5432330827067668
55,0.75254730713246,1.4700193423597678
56,0.7541666666666667,1.3922651933701657
57,0.7536231884057971,1.5288461538461537
58,0.1,1.5
59,0.6069182389937107,1.5025906735751295
60,0.7492581602373887,1.508910891089109
61,0.21739130434782608,0.6
62,0.755524861878453,1.5045703839122486
63,0.7420382165605095,1.4785407725321889
64,0.6028985507246377,1.4519230769230769
65,0.748898678414097,1.4843137254901961
66,0.2328767123287671,1.588235294117647
67,0.7434715821812596,1.493801652892562
68,0.0,0.0
69,0.7389937106918238,1.553191489361702
70,0.7469512195121951,1.530612244897959
71,0.6155913978494624,1.5327510917030567
72,0.7551622418879056,1.484375
73,0.7351097178683386,1.4179104477611941
74,0.7489051094890511,1.557504873294347
75,0.4427860696517413,1.5056179775280898
76,0.5988372093023255,1.441747572815534
77,0.6144927536231884,1.4433962264150944
78,0.5019157088122606,1.4885496183206106
79,0.10638297872340426,0.8
80,0.753030303030303,1.5070422535211268
81,0.7429022082018928,1.4692144373673035
82,0.3795620437956204,1.5192307692307692
83,0.5728155339805825,1.5197740112994351
84,0.7551020408163265,1.494208494208494
85,0.7463343108504399,1.3889980353634577
86,0.5838509316770186,1.5106382978723405
87,0.7470414201183432,1.4792079207920792
88,0.5815384615384616,1.3915343915343916
89,0.7561683599419449,1.5335892514395393
90,0.7510791366906475,1.496168582375479
91,0.6234567901234568,1.5792079207920793
92,0.6053412462908012,1.392156862745098
93,0.4774774774774775,1.4622641509433962
94,0.750728862973761,1.5728155339805825
95,0.6239316239316239,1.5342465753424657
96,0.7629009762900977,1.4204753199268738
97,0.7439759036144579,1.4412955465587045
98,0.08695652173913043,3.0
99,0.4696132596685083,1.411764705882353
100,0.5964391691394659,1.328358208955224
1 obj_id hit_rate avg_age
2 1 0.7439759036144579 1.45748987854251
3 2 0.4528301886792453 1.5416666666666667
4 3 0.7414561664190193 1.4909819639278556
5 4 0.7665260196905767 1.6018348623853211
6 5 0.6 1.5507246376811594
7 6 0.7395993836671803 1.5833333333333333
8 7 0.38686131386861317 1.6603773584905661
9 8 0.7430249632892805 1.4703557312252964
10 9 0.7460087082728593 1.461089494163424
11 10 0.7466266866566716 1.4759036144578312
12 11 0.6036585365853658 1.4444444444444444
13 12 0.7528901734104047 1.4491362763915547
14 13 0.7496339677891655 1.537109375
15 14 0.7471264367816092 1.5596153846153846
16 15 0.6075581395348837 1.5023923444976077
17 16 0.5920245398773006 1.5803108808290156
18 17 0.7547169811320755 1.6423076923076922
19 18 0.7510853835021708 1.5260115606936415
20 19 0.5159817351598174 1.6106194690265487
21 20 0.7595628415300546 1.4460431654676258
22 21 0.7631935047361299 1.5088652482269505
23 22 0.7525622254758418 1.5291828793774318
24 23 0.7477611940298508 1.403193612774451
25 24 0.5740181268882175 1.563157894736842
26 25 0.7582872928176796 1.5136612021857923
27 26 0.7485549132947977 1.5347490347490347
28 27 0.7574468085106383 1.4138576779026217
29 28 0.3722627737226277 1.5098039215686274
30 29 0.7514880952380952 1.506930693069307
31 30 0.7463976945244957 1.555984555984556
32 31 0.7477744807121661 1.5297619047619047
33 32 0.3888888888888889 1.5
34 33 0.7492537313432835 1.4302788844621515
35 34 0.3191489361702128 1.3777777777777778
36 35 0.7465857359635811 1.5142276422764227
37 36 0.7539797395079595 1.5009596928982725
38 37 0.7611940298507462 1.5080213903743316
39 38 0.4885844748858447 1.5794392523364487
40 39 0.28 1.6785714285714286
41 40 0.7591036414565826 1.6199261992619927
42 41 0.42391304347826086 1.7179487179487178
43 42 0.43478260869565216 1.6857142857142857
44 43 0.6187845303867403 1.3392857142857142
45 44 0.7543103448275862 1.5447619047619048
46 45 0.7320574162679426 1.5359477124183007
47 46 0.7515432098765432 1.5010266940451746
48 47 0.22641509433962265 1.9166666666666667
49 48 0.7485207100591716 1.5118577075098814
50 49 0.7398119122257053 1.4406779661016949
51 50 0.7459138187221397 1.4760956175298805
52 51 0.390625 1.44
53 52 0.21176470588235294 1.2777777777777777
54 53 0.7657295850066934 1.4912587412587412
55 54 0.76 1.5432330827067668
56 55 0.75254730713246 1.4700193423597678
57 56 0.7541666666666667 1.3922651933701657
58 57 0.7536231884057971 1.5288461538461537
59 58 0.1 1.5
60 59 0.6069182389937107 1.5025906735751295
61 60 0.7492581602373887 1.508910891089109
62 61 0.21739130434782608 0.6
63 62 0.755524861878453 1.5045703839122486
64 63 0.7420382165605095 1.4785407725321889
65 64 0.6028985507246377 1.4519230769230769
66 65 0.748898678414097 1.4843137254901961
67 66 0.2328767123287671 1.588235294117647
68 67 0.7434715821812596 1.493801652892562
69 68 0.0 0.0
70 69 0.7389937106918238 1.553191489361702
71 70 0.7469512195121951 1.530612244897959
72 71 0.6155913978494624 1.5327510917030567
73 72 0.7551622418879056 1.484375
74 73 0.7351097178683386 1.4179104477611941
75 74 0.7489051094890511 1.557504873294347
76 75 0.4427860696517413 1.5056179775280898
77 76 0.5988372093023255 1.441747572815534
78 77 0.6144927536231884 1.4433962264150944
79 78 0.5019157088122606 1.4885496183206106
80 79 0.10638297872340426 0.8
81 80 0.753030303030303 1.5070422535211268
82 81 0.7429022082018928 1.4692144373673035
83 82 0.3795620437956204 1.5192307692307692
84 83 0.5728155339805825 1.5197740112994351
85 84 0.7551020408163265 1.494208494208494
86 85 0.7463343108504399 1.3889980353634577
87 86 0.5838509316770186 1.5106382978723405
88 87 0.7470414201183432 1.4792079207920792
89 88 0.5815384615384616 1.3915343915343916
90 89 0.7561683599419449 1.5335892514395393
91 90 0.7510791366906475 1.496168582375479
92 91 0.6234567901234568 1.5792079207920793
93 92 0.6053412462908012 1.392156862745098
94 93 0.4774774774774775 1.4622641509433962
95 94 0.750728862973761 1.5728155339805825
96 95 0.6239316239316239 1.5342465753424657
97 96 0.7629009762900977 1.4204753199268738
98 97 0.7439759036144579 1.4412955465587045
99 98 0.08695652173913043 3.0
100 99 0.4696132596685083 1.411764705882353
101 100 0.5964391691394659 1.328358208955224

View File

@@ -0,0 +1,9 @@
,hit_rate,avg_age
count,100.0,100.0
mean,0.6224679450442043,1.4900421658850633
std,0.18900729549961315,0.2559552015594171
min,0.0,0.0
25%,0.5737174786613087,1.4512263767901963
50%,0.7429635857455866,1.5035805287436892
75%,0.7511860614361519,1.5382486979166667
max,0.7665260196905767,3.0
1 hit_rate avg_age
2 count 100.0 100.0
3 mean 0.6224679450442043 1.4900421658850633
4 std 0.18900729549961315 0.2559552015594171
5 min 0.0 0.0
6 25% 0.5737174786613087 1.4512263767901963
7 50% 0.7429635857455866 1.5035805287436892
8 75% 0.7511860614361519 1.5382486979166667
9 max 0.7665260196905767 3.0