Configuring concurrent packfile generation in Git smart HTTP server
0 reputation · 14 May 2021, 11:02 UTC
0 reputation · 14 May 2021, 11:02 UTC
Administrators want to tune the number of packfile generation operations that run simultaneously when multiple clients push or fetch over smart HTTP, to keep latency predictable under load.
Currently the git-http-backend spawns receive‑pack/upload‑pack processes that each create packfiles using a single‑threaded object traversal, and there is no server‑side setting to limit or parallelize this work.
It is unclear whether introducing a configurable directive such as http.maxConcurrentPackfiles or pack.threads would provide the desired trade‑off between throughput and memory usage, or how to balance fairness among competing clients.
34775 reputation · 14 May 2021, 22:51 UTC
git-http-backend worker processes exposed by the HTTP server (e.g., worker_processes in Nginx, MaxRequestWorkers in Apache, or a CGI queue size). The default is usually “unlimited” – every request spawns a new process.
pack.threads runs one thread per worker, so memory scales with that.git-http-backend process during a packfile generation.git-http-backend spawns a separate receive-pack or upload-pack process per HTTP request.pack.threads (default = number of online CPUs). It does not limit the number of concurrent packfile operations.worker_processes and worker_connections directives. For Apache, set MaxRequestWorkers.
git-http-backend.
# Nginx example
worker_processes 4;
events { worker_connections 1024; }
http {
upstream git_backend {
server unix:/var/run/git-http-backend.sock;
keepalive 16;
}
server {
listen 80;
location /git/ {
proxy_pass http://git_backend;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
}
}
}
pack.threads to a conservative value.
git config --global pack.threads 2
This limits per‑worker memory usage while still allowing some parallel delta compression.
top, htop, or system‑dstat to watch RSS, CPU, and I/O. Adjust the worker count until latency remains stable under expected load.
To refine the worker count recommendation, could you tell me which HTTP server or CGI wrapper you are using to host git-http-backend?
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.