From 50b5ea0acde8fdc4e71a2120c72d3b357288ed92 Mon Sep 17 00:00:00 2001
From: Arthur Lu <learthurgo@gmail.com>
Date: Sat, 1 Mar 2025 00:35:51 +0000
Subject: [PATCH] update configs for new database size, add simulated 10ms
 delay to database, updated test script naming to better convey the experiment
 method

---
 app/config_baseline.yaml                                    | 6 +++---
 app/config_prefetch.yaml                                    | 6 +++---
 app/config_seive.yaml                                       | 6 +++---
 app/config_tiered.yaml                                      | 6 +++---
 app/main.py                                                 | 1 +
 ...andom_friend_readonly.py => weighred_freind_readonly.py} | 0
 ...ndom_readwrite.py => weighted_frequentuser_readwrite.py} | 0
 7 files changed, 13 insertions(+), 12 deletions(-)
 rename tests/{random_friend_readonly.py => weighred_freind_readonly.py} (100%)
 rename tests/{random_readwrite.py => weighted_frequentuser_readwrite.py} (100%)

diff --git a/app/config_baseline.yaml b/app/config_baseline.yaml
index c8eb188..145755d 100644
--- a/app/config_baseline.yaml
+++ b/app/config_baseline.yaml
@@ -1,4 +1,4 @@
-cache_strategy: "Baseline"  # Change this to "Prefetch" or "Tiered" or "Seive"
-cache_limit: 10
-l2_cache_limit: 100
+cache_strategy: "Baseline"
+cache_limit: 50
+l2_cache_limit: 100 # unused
 db_file: "llmData_sns.json" # Change this to the name of any json file within the "database/datastore" folder
\ No newline at end of file
diff --git a/app/config_prefetch.yaml b/app/config_prefetch.yaml
index 162518f..2e098d5 100644
--- a/app/config_prefetch.yaml
+++ b/app/config_prefetch.yaml
@@ -1,4 +1,4 @@
-cache_strategy: "Prefetch"  # Change this to "Prefetch" or "Tiered" or "Seive"
-cache_limit: 10
-l2_cache_limit: 100
+cache_strategy: "Prefetch"
+cache_limit: 50
+l2_cache_limit: 100 # unused
 db_file: "llmData_sns.json" # Change this to the name of any json file within the "database/datastore" folder
\ No newline at end of file
diff --git a/app/config_seive.yaml b/app/config_seive.yaml
index 884cba0..bc86953 100644
--- a/app/config_seive.yaml
+++ b/app/config_seive.yaml
@@ -1,4 +1,4 @@
-cache_strategy: "Seive"  # Change this to "Prefetch" or "Tiered" or "Seive"
-cache_limit: 10
-l2_cache_limit: 100
+cache_strategy: "Seive"
+cache_limit: 50
+l2_cache_limit: 100 # unused
 db_file: "llmData_sns.json" # Change this to the name of any json file within the "database/datastore" folder
\ No newline at end of file
diff --git a/app/config_tiered.yaml b/app/config_tiered.yaml
index 99494e9..ef08530 100644
--- a/app/config_tiered.yaml
+++ b/app/config_tiered.yaml
@@ -1,4 +1,4 @@
-cache_strategy: "Tiered"  # Change this to "Prefetch" or "Tiered" or "Seive"
-cache_limit: 10
-l2_cache_limit: 100
+cache_strategy: "Tiered"
+cache_limit: 25
+l2_cache_limit: 175
 db_file: "llmData_sns.json" # Change this to the name of any json file within the "database/datastore" folder
\ No newline at end of file
diff --git a/app/main.py b/app/main.py
index 8fef2e2..5b80676 100644
--- a/app/main.py
+++ b/app/main.py
@@ -42,6 +42,7 @@ def fetch_user_profile(user_id: str):
         return {"user_id": user_id, "profile": cached_profile, "source": "cache", "time_ms": (time.time() - start) * 1000}
 
     profile = get_user_profile(user_id)
+    time.sleep(10 / 1000) # simulate 10 ms db delay
     if profile is None:
         raise HTTPException(status_code=404, detail="User not found")
 
diff --git a/tests/random_friend_readonly.py b/tests/weighred_freind_readonly.py
similarity index 100%
rename from tests/random_friend_readonly.py
rename to tests/weighred_freind_readonly.py
diff --git a/tests/random_readwrite.py b/tests/weighted_frequentuser_readwrite.py
similarity index 100%
rename from tests/random_readwrite.py
rename to tests/weighted_frequentuser_readwrite.py