Pin projects to specific database workers, scale to 4 in dev#11386
Draft
Pin projects to specific database workers, scale to 4 in dev#11386
Conversation
- Hash project ID (crc32) modulo _APP_DATABASE_WORKERS to determine which database worker queue to use for each project - Add _APP_DATABASE_WORKERS env var (default 4) - Replace single appwrite-worker-databases service with 4 partitioned workers (appwrite-worker-databases-0 through 3) - Update health check endpoint default queue name - Update install template with 4 database worker services - Update health check test for new queue naming Co-authored-by: abnegate <5857008+abnegate@users.noreply.github.com>
Co-authored-by: abnegate <5857008+abnegate@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Pin projects to specific database worker and scale to four workers
Pin projects to specific database workers, scale to 4 by default
Feb 24, 2026
Co-authored-by: abnegate <5857008+abnegate@users.noreply.github.com>
Copilot
AI
changed the title
Pin projects to specific database workers, scale to 4 by default
Pin projects to specific database workers, scale to 4 in dev
Feb 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Deterministically route each project's database events to a specific worker using
crc32(projectId) % numWorkers, preventing all projects from funneling into a single queue. Scale to 4 workers in dev, default to 1 for self-hosted.Event routing (
src/Appwrite/Event/Database.php){dbHost}-{workerIndex}_APP_DATABASE_WORKERS(default: 1 for self-hosted safety)Infrastructure
docker-compose.yml: 4 worker services (appwrite-worker-databases-{0..3}), each with_APP_QUEUE_NAME=database_db_main-{i}. Dev.envsets_APP_DATABASE_WORKERS=4.compose.phtml(self-hosted install): 1 worker by default — self-hosted users can scale by setting_APP_DATABASE_WORKERSand adding worker containers.app/worker.php: Default queue name updated todatabase_db_main-0.Health check
/health/queue/databasesupdated todatabase_db_main-0.DatabasesQueueTestupdated accordingly.✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.