Sizing and infrastructure requirements

This page describes the infrastructure a Kubernetes deployment of Polytomic needs and offers starting points for sizing it. Every workload is different, so treat these numbers as a place to start and adjust once you can see your own usage. If you have questions, contact us and we'll be happy to help.

What you need

You deploy Polytomic with our Helm chart. It depends on the following:

  • A Kubernetes cluster running version 1.34 or later, with an ingress controller that can terminate TLS.
  • PostgreSQL 16 or later. We recommend a managed service such as Amazon RDS or Cloud SQL.
  • Redis 6.2 or later. We recommend a managed service such as Amazon ElastiCache or Memorystore.
  • An object storage bucket (Amazon S3 or Google Cloud Storage) that Polytomic can read and write.
  • A shared ReadWriteMany volume (recommended), such as Amazon EFS, Google Filestore, or another NFS-backed storage class.

The Helm chart can run PostgreSQL and Redis inside the cluster for evaluation. For production, use managed services so your provider handles backups, failover, and upgrades.

Kubernetes cluster

A Polytomic deployment has two kinds of workload:

  • Always-on services that serve the web interface and API, schedule syncs, and coordinate work. Their resource use is fairly stable and doesn't grow much with sync volume.
  • Executor pods that Polytomic launches on demand to do the work of a sync, then removes when the work is finished. A Bulk Sync launches one executor pod for each table it syncs. A single Bulk Sync can run many pods at once.

By default, both run on the same nodes, so a single node group with autoscaling enabled is enough. To keep bursts of executor pods away from the web interface and API, run executor pods on their own nodes.

Always-on services

For the always-on services, two nodes with 4 vCPU and 16 GiB of memory each is a comfortable starting point and leaves headroom for upgrades and a node failure. Executor pods need capacity beyond this.

In practice, the always-on services typically use under 1 vCPU and around 4 GiB of memory, with peaks near 4 vCPU and 10 GiB.

Executor pods

By default, each executor pod requests 1 vCPU and 2 GiB of memory, with a memory limit of 8 GiB. Set these values under polytomic.roles.task in the Helm chart:

ValueDefaultMeaning
cpu1000CPU request, in millicores
memory_reservation2048Memory request, in MiB
memory_maximum8192Memory limit, in MiB

Most executor pods use far less than they request. In one production deployment running thousands of Bulk Sync executor pods per day, we observed:

Median90th percentile99th percentileLargest
Peak memory170 MiB1.7 GiB4.2 GiB5.5 GiB
Average CPU0.1 vCPU0.8 vCPU1.7 vCPU3.7 vCPU

Your cluster autoscaler adds nodes based on what pods request, not what they use. If many tables sync at once, the default requests can cause the cluster to scale well beyond what the work needs. Once you've observed your own usage, consider lowering cpu and memory_reservation so that more executor pods fit on each node.

🚧

Memory limit

Keep memory_maximum high enough for your largest tables. Kubernetes stops any executor pod that exceeds its limit, which interrupts the work it was doing.

Concurrency

The number of executor pods running at once has the largest effect on cluster size. For Bulk Syncs, the Sync table concurrency setting on each sync controls it. The default is 50 tables at a time. Resyncs use a separate Resync table concurrency setting.

A rough estimate of the peak executor capacity you need is:

(bulk syncs running at the same time) × (table concurrency) × (executor pod request)

Lowering table concurrency makes each sync take longer but caps how large the cluster grows. Staggering sync schedules so they don't all start at once has a similar effect.

Separate executor nodes

You can run executor pods on a node group of their own, so that a large burst of syncs doesn't compete with the web interface and API for capacity. This takes three steps:

  1. Create a node group for executors with a label and a taint, for example the label polytomic/role=executor and the taint polytomic/role=executor:NoSchedule. The always-on services don't tolerate the taint, so they stay on your other nodes.
  2. Direct executor pods to those nodes with polytomic.kubernetes.nodeSelectors and polytomic.kubernetes.tolerations. Both are comma-separated strings: selectors as key=value, and tolerations as key=value:effect (or key:effect to tolerate any value).
  3. Add the same toleration to the Vector DaemonSet, which collects execution logs on every node. Without it, Vector doesn't run on the executor nodes, and Polytomic doesn't collect logs from executor pods. If you've enabled the Datadog agent, add the toleration there too.
polytomic:
  kubernetes:
    nodeSelectors: "polytomic/role=executor"
    tolerations: "polytomic/role=executor:NoSchedule"
  vector:
    daemonset:
      tolerations:
        - key: polytomic/role
          operator: Equal
          value: executor
          effect: NoSchedule

PostgreSQL

PostgreSQL stores Polytomic's configuration and the history of sync executions. It doesn't store the records you sync, so its size grows with the number of syncs and how often they run rather than with your data volume.

Start with 2 vCPU, 4 GiB of memory, and 50 GB of storage, with storage autoscaling enabled if your provider supports it. For production, we recommend a standby replica in a second availability zone.

Redis

Redis holds Polytomic's work queues and coordinates running syncs. Start with an instance with around 3 GiB of memory. Replication is recommended but not required.

Watch memory use, CPU use, and evicted keys. Any evictions mean the instance needs more memory.

Scaling up

Signs that a part of your deployment needs more resources:

SymptomWhat to change
Executor pods are stopped for running out of memory (OOMKilled)Raise memory_maximum, and memory_reservation if pods are being packed too tightly
Executor pods stay Pending for a long timeRaise the maximum size of the node group executors run on, or lower table concurrency
Syncs take longer than your schedule allowsRaise table concurrency and make sure the node group can grow to match
PostgreSQL CPU is consistently highMove to a larger instance class
Redis memory is near its limit or keys are being evictedMove to a larger instance

What affects sizing

The guidance above is a starting point. Your actual requirements depend on:

  • Data shape. Wide tables, large text or JSON columns, and deeply nested records use more memory per record than narrow tables of simple values.
  • Data volume. The first sync of a table reads all of its records, and resyncs do the same. Incremental syncs that follow are usually much smaller. Size for the initial load, then scale down if you like.
  • Sync frequency. Syncs that run often and overlap one another need more concurrent capacity than syncs that run once a day.
  • Source and destination limits. APIs with rate or concurrency limits may cause syncs to run longer, keeping executor pods running for more time.

Because these factors vary so much between deployments, we recommend starting small with autoscaling enabled. Watch resource use over a few sync cycles and adjust from there.

Object storage

Polytomic stores logs, query results, and job payloads in its object storage bucket. Grant Polytomic full access to its own bucket, and set a lifecycle rule to expire objects automatically.