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

49
note.md
View File

@@ -42,38 +42,45 @@ miss requests and cache updates should not go over the bandwidth
### Two versions
1.
- [x] Default
- Do Refresh
- Do Request
- Do Refresh
- Do Request
2.
- [x] No Refresh
- Just Request
- No Refresh
- Just Request
- No Refresh
3.
- [x] Infinite TTL
- LRU
- Infinite TTL
- No Refresh
- LRU
- Infinite TTL
- No Refresh
4.
- [x] Random Eviction
- Random eviction
- Regular TTL
- With Refresh
5.
- Random eviction
- Regular TTL
- Without Refresh
- Random eviction
- Regular TTL
- With Refresh
- [x] Random Eviction w/o Refresh
- Random eviction
- Regular TTL
- No Refresh
| Name | Cache Capacity | MAX_REFRESH_RATE | cache_type | CACHE_TTL |
| -------------------- | -------------------- | ---------------- | ------------------------- | --------- |
| Default | DATABASE_OBJECTS | 1< | CacheType.LRU | 5 |
| No Refresh | DATABASE_OBJECTS | 0 | CacheType.LRU | 5 |
| Infinite TTL | DATABASE_OBJECTS / 2 | 0 | CacheType.LRU | 0 |
| Random Eviction (RE) | DATABASE_OBJECTS / 2 | 1< | CacheType.RANDOM_EVICTION | 5 |
| RE without Refresh | DATABASE_OBJECTS / 2 | 0 | CacheType.RANDOM_EVICTION | 5 |
### Runtime
CPU times: user 3min 46s, sys: 43 s, total: 4min 29s
Wall time: 4min 29s
for ACCESS_COUNT_LIMIT = 10_000 # Total time to run the simulation
for ACCESS_COUNT_LIMIT = 10_000 # Total time to run the simulation
## Notes 11/27/2024