Skip to content

Capacity planning

This section provides guidance on sizing disk, memory, CPU, and database resources based on registry type and expected usage.

Artifact storage sizing

Artifact size varies dramatically by ecosystem. Use these typical values to estimate max_artifact_size_bytes and total storage needs:

Registry typeTypical artifact sizeRecommended max_artifact_size_bytes
npm50 KB – 5 MB50 MiB
Cargo100 KB – 10 MB50 MiB
PyPI (wheel)1 MB – 100 MB200 MiB
Maven (JAR)1 MB – 200 MB256 MiB
NuGet100 KB – 50 MB100 MiB
Conda50 MB – 500 MB512 MiB
Docker (layer)1 MB – 2 GB4 GiB
JetBrains IDE500 MB – 2 GB4 GiB
Debian / RPM100 KB – 500 MB512 MiB
Terraform provider5 MB – 100 MB256 MiB

For a proxy-only deployment: size storage at (unique packages cached) × (average artifact size) × (versions per package). A practical starting point for a small team is 100 GB.

For a local-mode deployment: add the total size of all artifacts you plan to publish, and keep a separate backup (see disaster recovery).

Memory

BatleHub's in-process memory use is low (< 200 MB baseline). Most memory is consumed by:

  • The metadata cache (configurable TTL; use [cache] type = "redis" to offload it).
  • Per-request buffering for streaming large artifacts.

Recommended minimum: 512 MB RAM for a small deployment. For high concurrency (> 100 simultaneous downloads), allocate 2 GB to accommodate in-flight buffers.

CPU

BatleHub is I/O-bound, not CPU-bound. Even a 2-core instance handles several hundred requests/second for cached artifacts. CPU spikes occur during:

  • SBOM extraction (ZIP decompression + JSON serialization).
  • TLS termination (offload to a reverse proxy / load balancer for very high traffic).
  • Vulnerability scanning (periodic, not on the hot path).

Recommended: 2–4 vCPUs for most deployments.

Database (PostgreSQL)

  • Connections: Default max_connections = 10 is fine for < 50 concurrent requests. Increase to 25–50 for busy deployments. The DB itself should allow at least max_connections * (number of instances) + 10 headroom.
  • Disk: The access_events table grows ~1 KB per event. At 1,000 events/day, that is ~365 MB/year. Schedule periodic purges: batlehub-cli admin audit-log --purge-before 2024-01-01T00:00:00Z.
  • IOPS: Metadata reads and record_access writes are the hottest paths. An SSD with 3,000 IOPS is sufficient for most teams.

Set per registry, not globally, to avoid a large JetBrains IDE download from blocking smaller npm installs that share a connection pool:

toml
[[registries]]
name = "npm-proxy"
type = "npm"
[registries.local_registry]
max_artifact_size_bytes = 52428800   # 50 MiB

[[registries]]
name = "jetbrains-proxy"
type = "jetbrains"
[registries.local_registry]
max_artifact_size_bytes = 4294967296  # 4 GiB

Released under the Apache 2.0 License. Made with ❤️ and too much ☕.