Skip to content
This repository has been archived by the owner on Jul 12, 2023. It is now read-only.

Docs for Estimating Costs #633

Merged
merged 7 commits into from
Jun 16, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/_data/navigation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ docs:
url: /getting-started/publishing-temporary-exposure-keys
- title: How to Download Keys
url: /getting-started/downloading-export-batches-keys
- title: Estimating the Cost of Deployment
url: /getting-started/estimating-costs
- title: Design
children:
- title: Server Deployment Options
Expand Down
112 changes: 112 additions & 0 deletions docs/getting-started/estimating-costs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
---
layout: default
---
# Estimating costs of hosting the Exposure Notifications Server


NOTE: This is for informational purposes only. This doesn't account for all
costs of operating. It gives an approximate sizing of the cost. This document
should be used to assist in understanding how to calculate the cost of
deploying this service.

This page explains how you might estimate the cost to deploy servers within the
Exposure Notification Reference implementation. Cost estimates assume the use
of Google Cloud and use
[published pricing rates](https://cloud.google.com/pricing), but similar
calculations could be done for other cloud providers as well as self-hosted
machines.

Much of this is simplified. It doesn't
fully account for free-tier exceptions, or tiered pricing. This is meant
to assist in having an approximate idea of cost to operate. This also assumes
the defaults at the time of authoring in [vars.tf](https:/google/exposure-notifications-server/blob/master/terraform/vars.tf).

These estimates also don't include CDN costs. For simplicity they assume
direct access to Cloud Storage.

# Calculating the overall cost
There are a number of variables that need to be figured out to determine cost.

Let's assume that we are calculating the cost of operating for an area with:

* A population of 10 Million (10,000,000) people.
* An exposure window of 14 days
* 50% adoption of an exposure notifications system
* 1,250 new cases daily (approximately .01% new cases per day)

From which we can derive:
* Each new set of keys is 280 bytes (14 days * 20 bytes)
* Each daily batch is 1,250 * 280 bytes = .35 MB
* That file is downloaded 5 Million times per day (1.75 GB/day downloaded),
52.5 GB monthly.

# Cloud Components and Pricing

## Cloud Run Costs
https://cloud.google.com/run/pricing

There are multiple containers needed for a complete deployment:

* Export Cleanup
* Exposure Cleanup
* Export
* Exposure
* Federation In
* Federation Out

Let's assume we run ~4 containers constantly as much of the operation is batch
and won't account for constant use. Also, we can reflect on the default
[terraform resource limits](https:/google/exposure-notifications-server/blob/master/terraform/service_federationin.tf#L63)
of 2 CPU and 1G memory per container.

**Projected Monthly Cost: $500 - 1000**

## SQL Database Costs
https://cloud.google.com/sql/pricing

The default size for SQL Database is configured to:
* 8 vCPU
* 30720 MB Memory
* 256 GB SSD

The cost of this component can vary greatly on the scale is configured to.
Depending on the needed scale of your deployment this could require a different
configuration.

**Project Monthly Cost: $1000 - $1250**

## Storage Costs
https://cloud.google.com/storage/pricing

### Data Storage Cost
The last 14 days of batches are stored with older batches being deleted. This
is a small amount of data storage.

**Projected Monthly Cost: $0 - $20**

### Network Usage Cost
Each user will download one of the daily batch files.

**Projected Monthly Cost: $5 - $20**

### Operations Cost
There are two tiers of operations.

#### Class A
$0.05 per 10,000 operations

Relevant operations from this include `INSERT`, `UPDATE`, and `LIST`. These
will occur as part of batching of exposure keys. These operations will likely
remain under 10,000 for storage as creation of files is batched.

**Projected Monthly Cost: $0 - $20**

#### Class B
$0.004 per 10,000 operations

Relevant operations from this include `GET` requests for key batches.

For each user, there will be a minimum of one `GET` operation per day.

**Projected Monthly Cost: $50 - $100**