remove cpu split logic

This commit is contained in:
msukkari 2025-02-22 17:23:48 -08:00
parent e648ed3a7e
commit d70b729ee8
5 changed files with 10 additions and 30 deletions

View file

@ -87,9 +87,6 @@ ENV DATABASE_URL="postgresql://postgres@localhost:5432/sourcebot"
ENV REDIS_URL="redis://localhost:6379"
ENV SRC_TENANT_ENFORCEMENT_MODE=strict
# @nocheckin: we likely want to have a better solution for the self host case
ENV BACKEND_CORES_FACTOR="0.5"
ARG SOURCEBOT_VERSION=unknown
ENV SOURCEBOT_VERSION=$SOURCEBOT_VERSION
RUN echo "Sourcebot Version: $SOURCEBOT_VERSION"

View file

@ -203,30 +203,5 @@ fi
echo -e "\e[34m[Info] Running database migration...\e[0m"
yarn workspace @sourcebot/db prisma:migrate:prod
# Get total CPU cores
TOTAL_CORES=$(nproc)
echo -e "\e[34m[Info] Total CPU cores available: $TOTAL_CORES\e[0m"
# Default to 50/50 split if BACKEND_CORES_FACTOR not set
BACKEND_CORES_FACTOR=${BACKEND_CORES_FACTOR:-0.5}
# Calculate number of cores for backend (rounded down)
BACKEND_CORES=$(printf "%.0f" $(echo "$TOTAL_CORES * $BACKEND_CORES_FACTOR" | bc))
# Ensure at least 1 core for each
if [ $BACKEND_CORES -lt 1 ]; then
BACKEND_CORES=1
fi
if [ $BACKEND_CORES -ge $TOTAL_CORES ]; then
BACKEND_CORES=$(($TOTAL_CORES - 1))
fi
# Generate CPU lists
export BACKEND_CPU_LIST=$(seq -s, 0 $(($BACKEND_CORES - 1)))
export FRONTEND_CPU_LIST=$(seq -s, $BACKEND_CORES $(($TOTAL_CORES - 1)))
echo -e "\e[34m[Info] Backend will use CPUs: $BACKEND_CPU_LIST\e[0m"
echo -e "\e[34m[Info] Frontend will use CPUs: $FRONTEND_CPU_LIST\e[0m"
# Run supervisord
exec supervisord -c /etc/supervisor/conf.d/supervisord.conf

View file

@ -48,6 +48,7 @@ const schema = {
"type": "string",
"pattern": "^[\\w.-]+$"
},
"default": [],
"examples": [
[
"torvalds",
@ -80,6 +81,7 @@ const schema = {
"type": "string",
"pattern": "^[\\w.-]+\\/[\\w.-]+$"
},
"default": [],
"description": "List of individual repositories to sync with. Expected to be formatted as '{orgName}/{repoName}' or '{userName}/{repoName}'."
},
"topics": {
@ -88,6 +90,7 @@ const schema = {
"type": "string"
},
"minItems": 1,
"default": [],
"description": "List of repository topics to include when syncing. Only repositories that match at least one of the provided `topics` will be synced. If not specified, all repositories will be synced, unless explicitly defined in the `exclude` property. Glob patterns are supported.",
"examples": [
[
@ -122,6 +125,7 @@ const schema = {
"items": {
"type": "string"
},
"default": [],
"description": "List of repository topics to exclude when syncing. Repositories that match one of the provided `topics` will be excluded from syncing. Glob patterns are supported.",
"examples": [
[

View file

@ -44,6 +44,7 @@ const schema = {
"type": "string",
"pattern": "^[\\w.-]+$"
},
"default": [],
"examples": [
[
"torvalds",
@ -76,6 +77,7 @@ const schema = {
"type": "string",
"pattern": "^[\\w.-]+\\/[\\w.-]+$"
},
"default": [],
"description": "List of individual repositories to sync with. Expected to be formatted as '{orgName}/{repoName}' or '{userName}/{repoName}'."
},
"topics": {
@ -84,6 +86,7 @@ const schema = {
"type": "string"
},
"minItems": 1,
"default": [],
"description": "List of repository topics to include when syncing. Only repositories that match at least one of the provided `topics` will be synced. If not specified, all repositories will be synced, unless explicitly defined in the `exclude` property. Glob patterns are supported.",
"examples": [
[
@ -118,6 +121,7 @@ const schema = {
"items": {
"type": "string"
},
"default": [],
"description": "List of repository topics to exclude when syncing. Repositories that match one of the provided `topics` will be excluded from syncing. Glob patterns are supported.",
"examples": [
[

View file

@ -4,7 +4,7 @@ logfile=/dev/null
logfile_maxbytes=0
[program:zoekt]
command=taskset -c %(ENV_BACKEND_CPU_LIST)s ./prefix-output.sh zoekt-webserver -index %(ENV_DATA_CACHE_DIR)s/index -rpc
command=./prefix-output.sh zoekt-webserver -index %(ENV_DATA_CACHE_DIR)s/index -rpc
autostart=true
autorestart=true
startretries=3
@ -13,7 +13,7 @@ stdout_logfile_maxbytes=0
redirect_stderr=true
[program:web]
command=taskset -c %(ENV_FRONTEND_CPU_LIST)s ./prefix-output.sh node packages/web/server.js
command=./prefix-output.sh node packages/web/server.js
autostart=true
autorestart=true
startretries=3