# Architecture

The DBNL platform architecture consists of a set of [Services](#services) packaged as Docker images and a set of standard [Infrastructure](#infrastructure) components that are [deployed](https://docs.dbnl.com/v0.27.x/platform/deployment) into your infrastructure (e.g. a VPC in AWS or GCP, or on-premise). The platform is scalable, modular, and self contained. It does not require an external connection to hosted Distributional services to operate.

<figure><img src="https://content.gitbook.com/content/8N8zzLtIch6ZiTSwWtXD/blobs/wXNgXhxu5nRTcBtNSBvB/image%20(31).png" alt=""><figcaption><p>DBNL platform architecture</p></figcaption></figure>

## Infrastructure

The DBNL platform requires the following infrastructure:

* A Kubernetes cluster to host the DBNL platform services.
* A PostgreSQL database to store metadata.
* An object store bucket to store raw data (e.g. S3 or GCS).
* A Redis database to serve as a messaging queue.
* A load balancer to route traffic to the API or UI service.
* (Optional) A Clickhouse database to store trace data.

### Infrastructure Sizing Requirements

#### Kubernetes Cluster

| Environment                      | Nodes | CPU per Node | Memory per Node | Total Resources        |
| -------------------------------- | ----- | ------------ | --------------- | ---------------------- |
| **Minimum** (POC/Testing)        | 3     | 4 vCPU       | 16 GB           | 12 vCPU, 48 GB RAM     |
| **Recommended** (Production)     | 5+    | 8 vCPU       | 32 GB           | 40+ vCPU, 160+ GB RAM  |
| **High Volume** (>100k logs/day) | 10+   | 16 vCPU      | 64 GB           | 160+ vCPU, 640+ GB RAM |

#### PostgreSQL Database

| Environment     | Instance Type (AWS) | Instance Type (GCP) | vCPU | Memory |
| --------------- | ------------------- | ------------------- | ---- | ------ |
| **Minimum**     | db.t3.medium        | db-n1-standard-2    | 2    | 4 GB   |
| **Recommended** | db.r5.large         | db-n1-highmem-4     | 2-4  | 16 GB  |
| **High Volume** | db.r5.xlarge+       | db-n1-highmem-8+    | 4-8+ | 32+ GB |

#### Object Store

| Environment     | Storage                                       |
| --------------- | --------------------------------------------- |
| **Minimum**     | 100 GB                                        |
| **Recommended** | 1 TB                                          |
| **High Volume** | 10+ TB (scales with log volume and retention) |

#### Redis

| Environment     | Instance Type (AWS) | Instance Type (GCP) | Memory |
| --------------- | ------------------- | ------------------- | ------ |
| **Minimum**     | cache.t3.medium     | M1                  | 3.2 GB |
| **Recommended** | cache.r5.large      | M3                  | 13+ GB |
| **High Volume** | cache.r5.xlarge+    | M4+                 | 25+ GB |

#### Clickhouse (Optional - Required for OTEL Trace Ingestion)

| Environment     | vCPU | Memory | Storage |
| --------------- | ---- | ------ | ------- |
| **Minimum**     | 4    | 16 GB  | 100 GB  |
| **Recommended** | 8    | 32 GB  | 500 GB  |
| **High Volume** | 16+  | 64+ GB | 2+ TB   |

### Estimated Monthly Costs

Costs vary by cloud provider and region. Approximate ranges (as of 2025):

* **Minimum Setup**: $300-500/month (suitable for POC/testing)
* **Recommended Production**: $800-1500/month (handles typical production workloads)
* **High Volume**: $2000-5000+/month (depends on log volume and retention requirements)

{% hint style="info" %}
These estimates assume standard cloud provider pricing. Costs can be reduced with reserved instances, committed use discounts, or on-premise deployments.
{% endhint %}

## Services

The DBNL platform consists of three core services that run within the Kubernetes cluster:

* The API service (api-srv) serves the DBNL API and orchestrates work across the dbnl platform.
* The worker service (worker-srv) processes async jobs scheduled by the API service.
* The UI service (ui-srv) serves the DBNL UI assets.
