-
Notifications
You must be signed in to change notification settings - Fork 149
feat: implement hybrid cache architecture #1246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 31 commits
956f388
cc49057
d6413ce
cf76665
e998d07
734621c
452eb18
168d9b0
08116ba
992c862
d5e1b5b
6d5f886
6bc0ddc
627137b
235e152
c762b5e
ab28d78
88bbce8
1737bfd
d35d109
0a54773
133e5e6
f03d686
bc0be9f
d07ed9c
2acaee7
49695ff
b5bc3d8
d110463
b073eb3
928846d
5b94ec9
7c05bfb
a42bd2e
fd23676
bd14e59
e67ff36
7e97d9e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,205 @@ | ||||||
| #!/bin/bash | ||||||
|
|
||||||
| set -e | ||||||
|
|
||||||
| # Colors for output | ||||||
| RED='\033[0;31m' | ||||||
| GREEN='\033[0;32m' | ||||||
| YELLOW='\033[1;33m' | ||||||
| BLUE='\033[0;34m' | ||||||
| NC='\033[0m' # No Color | ||||||
|
|
||||||
| echo -e "${BLUE}=== Git Proxy Hybrid Cache Benchmark ===${NC}" | ||||||
| echo "" | ||||||
|
|
||||||
| # Configuration | ||||||
| PROXY_URL="http://localhost:8000" | ||||||
| GITHUB_REPO="${1:-fabiovincenzi/open-webui}" | ||||||
|
||||||
| TEST_BRANCH="${2:-main}" | ||||||
| NUM_PUSHES="${3:-3}" | ||||||
|
|
||||||
| # Construct proxy URL (format: http://localhost:8000/github.com/user/repo.git) | ||||||
| PROXY_REPO_URL="$PROXY_URL/github.com/$GITHUB_REPO.git" | ||||||
|
|
||||||
| echo "Configuration:" | ||||||
| echo " Proxy URL: $PROXY_URL" | ||||||
| echo " GitHub Repo: $GITHUB_REPO" | ||||||
| echo " Proxy Repo URL: $PROXY_REPO_URL" | ||||||
| echo " Branch: $TEST_BRANCH" | ||||||
| echo " Number of pushes: $NUM_PUSHES" | ||||||
| echo "" | ||||||
|
|
||||||
| # Check if git-proxy is running | ||||||
| echo -e "${YELLOW}Checking if git-proxy is running...${NC}" | ||||||
| if ! curl -s "$PROXY_URL" > /dev/null 2>&1; then | ||||||
| echo -e "${RED}ERROR: git-proxy is not running on $PROXY_URL${NC}" | ||||||
| echo "Please start git-proxy with: npm start" | ||||||
| exit 1 | ||||||
| fi | ||||||
| echo -e "${GREEN}✓ git-proxy is running${NC}" | ||||||
| echo "" | ||||||
|
|
||||||
| # Get GitHub credentials from git credential helper | ||||||
| echo -e "${YELLOW}Retrieving GitHub credentials...${NC}" | ||||||
| CREDENTIALS=$(echo -e "protocol=https\nhost=github.com\n" | git credential fill 2>/dev/null) | ||||||
| if [ -z "$CREDENTIALS" ]; then | ||||||
| echo -e "${RED}ERROR: No GitHub credentials found${NC}" | ||||||
| echo "Please configure git credentials first:" | ||||||
| echo " git config --global credential.helper store" | ||||||
| echo " git clone https://github.com/your-repo.git" | ||||||
| exit 1 | ||||||
| fi | ||||||
|
|
||||||
| GITHUB_USERNAME=$(echo "$CREDENTIALS" | grep "^username=" | cut -d= -f2) | ||||||
| GITHUB_TOKEN=$(echo "$CREDENTIALS" | grep "^password=" | cut -d= -f2) | ||||||
|
|
||||||
| if [ -z "$GITHUB_USERNAME" ] || [ -z "$GITHUB_TOKEN" ]; then | ||||||
| echo -e "${RED}ERROR: Could not extract GitHub credentials${NC}" | ||||||
| exit 1 | ||||||
| fi | ||||||
|
|
||||||
| echo -e "${GREEN}✓ GitHub credentials retrieved for user: $GITHUB_USERNAME${NC}" | ||||||
| echo "" | ||||||
|
|
||||||
| # Setup test directory | ||||||
| TEST_DIR="./benchmark-test-$(date +%s)" | ||||||
| echo -e "${YELLOW}Creating test directory: $TEST_DIR${NC}" | ||||||
| mkdir -p "$TEST_DIR" | ||||||
| cd "$TEST_DIR" | ||||||
|
|
||||||
| REPO_NAME=$(basename "$GITHUB_REPO") | ||||||
|
|
||||||
| # Clear cache before starting | ||||||
| echo -e "${YELLOW}Clearing cache before benchmark...${NC}" | ||||||
| rm -rf ../.remote/cache/* ../.remote/work/* 2>/dev/null || true | ||||||
| echo -e "${GREEN}✓ Cache cleared${NC}" | ||||||
| echo "" | ||||||
|
|
||||||
| measure_push() { | ||||||
|
||||||
| local push_number=$1 | ||||||
| local is_first=$2 | ||||||
|
|
||||||
| echo -e "${BLUE}=== Push #$push_number $([ "$is_first" = "true" ] && echo "(COLD CACHE)" || echo "(WARM CACHE)") ===${NC}" | ||||||
|
|
||||||
| # Clone repo through proxy | ||||||
| echo "Cloning repository..." | ||||||
| START_CLONE=$(date +%s.%N) | ||||||
|
|
||||||
| rm -rf "$REPO_NAME" 2>/dev/null || true | ||||||
| git clone "$PROXY_REPO_URL" "$REPO_NAME" > clone.log 2>&1 | ||||||
|
||||||
| git clone "$PROXY_REPO_URL" "$REPO_NAME" > clone.log 2>&1 | |
| git clone "$PROXY_REPO_URL" "$REPO_NAME" 2>&1 | tee clone.log |
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we should add the resulting .csvs to .gitignore? 🤔

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: We might want to add an explicit error message when executing
benchmark-cache.shbut the chosen repo is not added to the authorised list.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just edited to show original errors everywhere