Skip to content

Commit

Permalink
chore: increase SHARED_BUFFERS and WORK_MEM (#1354)
Browse files Browse the repository at this point in the history
  • Loading branch information
raphael0202 committed Jul 4, 2024
1 parent b49836b commit f26fdba
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 4 deletions.
9 changes: 8 additions & 1 deletion .env
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,11 @@ ENABLE_MONGODB_ACCESS=0
GUNICORN_PRELOAD_APP=0

# The log level for the robotoff service
LOG_LEVEL=DEBUG
LOG_LEVEL=DEBUG

# PostgreSQL configuration

# Use 16G in production
ROBOTOFF_POSTGRES_SHARED_BUFFERS=1GB
# Use 1G in production
ROBOTOFF_POSTGRES_WORK_MEM=64MB
6 changes: 5 additions & 1 deletion .github/workflows/container-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,14 @@ jobs:
echo "INFLUXDB_BUCKET=off_metrics" >> .env
echo "INFLUXDB_AUTH_TOKEN=${{ secrets.INFLUXDB_AUTH_TOKEN }}" >> .env
echo "SLACK_TOKEN=${{ secrets.SLACK_TOKEN }}" >> .env
echo "GUNICORN_NUM_WORKERS=8"
echo "GUNICORN_NUM_WORKERS=8" >> .env
echo "EVENTS_API_URL=https://event.openfoodfacts.${{ env.ROBOTOFF_TLD }}" >> .env
echo "IMAGE_MODERATION_SERVICE_URL=${{ env.IMAGE_MODERATION_SERVICE_URL }}" >> .env
# PostgreSQL config
echo "ROBOTOFF_POSTGRES_SHARED_BUFFERS=16GB" >> .env
echo "ROBOTOFF_POSTGRES_WORK_MEM=1GB" >> .env
- name: Create Docker volumes
uses: appleboy/ssh-action@master
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ services:
- postgres-data:/var/lib/postgresql/data
- backup:/opt/robotoff-backups
- ./scripts/backup_postgres.sh:/opt/backup_postgres.sh
command: postgres -c shared_buffers=1024MB -c work_mem=64MB
mem_limit: 4g
command: postgres -c shared_buffers=${ROBOTOFF_POSTGRES_SHARED_BUFFERS} -c work_mem=${ROBOTOFF_POSTGRES_WORK_MEM}
mem_limit: 20g
shm_size: 1g
ports:
- "${POSTGRES_EXPOSE:-127.0.0.1:5432}:5432"
Expand Down

0 comments on commit f26fdba

Please sign in to comment.