Skip to content

Commit 54fd2e6

Browse files
committed
Squashed commit of the following:
commit 480c8e5 Merge: e468ceb 232bf26 Author: Gemma Shay <[email protected]> Date: Thu Jun 23 16:14:50 2022 -0400 Merge branch 'master' into DOC-2827-serverless-movr merge master commit e468ceb Author: Gemma Shay <[email protected]> Date: Thu Jun 23 15:52:51 2022 -0400 emily review and create database commit 898fc63 Author: Gemma Shay <[email protected]> Date: Thu Jun 9 15:39:42 2022 -0400 andy review and emily follow up suggestion draft commit f8b6f77 Author: Gemma Shay <[email protected]> Date: Thu Jun 2 18:09:36 2022 -0400 calculation commit b98ca17 Merge: f3cbd9e 43c5144 Author: Gemma Shay <[email protected]> Date: Thu Jun 2 17:40:25 2022 -0400 Merge branch 'master' into DOC-2827-serverless-movr commit f3cbd9e Author: Gemma Shay <[email protected]> Date: Tue Mar 29 14:05:02 2022 -0400 edit commit b3be052 Author: Gemma Shay <[email protected]> Date: Tue Mar 29 13:42:06 2022 -0400 edit and formatting commit 7402854 Merge: 1bd49ae 7118111 Author: Gemma Shay <[email protected]> Date: Mon Mar 28 14:30:08 2022 -0400 Merge branch 'DOC-2827-serverless-movr' of https://github.com/cockroachdb/docs into DOC-2827-serverless-movr commit 1bd49ae Author: Gemma Shay <[email protected]> Date: Mon Mar 28 14:30:04 2022 -0400 link fix commit 7118111 Merge: 32d6766 43bd4b5 Author: Gemma Shay <[email protected]> Date: Fri Mar 25 14:32:40 2022 -0400 Merge branch 'master' into DOC-2827-serverless-movr commit 32d6766 Author: Gemma Shay <[email protected]> Date: Fri Mar 25 14:30:40 2022 -0400 draft commit 69ad3c6 Author: Gemma Shay <[email protected]> Date: Thu Mar 24 13:17:42 2022 -0400 draft commit 0b30677 Author: Gemma Shay <[email protected]> Date: Mon Mar 14 11:57:19 2022 -0400 draft squashh
1 parent 232bf26 commit 54fd2e6

File tree

3 files changed

+144
-0
lines changed

3 files changed

+144
-0
lines changed

_includes/v21.2/sidebar-data/get-started.json

+6
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@
9090
"/${VERSION}/deploy-app-gcr.html"
9191
]
9292
},
93+
{
94+
"title": "Estimate Serverless Usage with MovR",
95+
"urls": [
96+
"/cockroachcloud/serverless-movr.html"
97+
]
98+
},
9399
{
94100
"title": "Netlify",
95101
"urls": [

_includes/v22.1/sidebar-data/get-started.json

+6
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@
9090
"/${VERSION}/deploy-app-gcr.html"
9191
]
9292
},
93+
{
94+
"title": "Estimate Serverless Usage with MovR",
95+
"urls": [
96+
"/cockroachcloud/serverless-movr.html"
97+
]
98+
},
9399
{
94100
"title": "Netlify",
95101
"urls": [

cockroachcloud/serverless-movr.md

+132
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
get-the-cluster-connection-string---
2+
title: Estimate Serverless Usage with MovR
3+
summary: Run the MovR sample application to estimate RU usage in CockroachDB Serverless.
4+
toc: true
5+
referral_id: docs_serverless_movr
6+
docs_area: get_started
7+
---
8+
9+
This tutorial shows you how to initialize and run the MovR workload on a {{ site.data.products.serverless }} cluster, then use the Request Unit consumption data to estimate a sufficient budget for the MovR workload.
10+
11+
## Overview
12+
13+
MovR is a fictional company that offers users a platform for sharing vehicles, like scooters, bicycles, and skateboards, in select cities across the United States and Europe. The MovR team wants to use {{ site.data.products.serverless }} to run their high-growth, variable workload. They decide to test out a sample workload to see how it will perform and how much it will cost to run.
14+
15+
## Before you begin
16+
17+
- Make sure you have already [installed CockroachDB](../{{site.versions["stable"]}}/install-cockroachdb.html).
18+
- [Create a {{ site.data.products.serverless }} cluster](quickstart.html).
19+
20+
## Step 1. Get the cluster connection string
21+
22+
1. On the cluster's **Overview** page, click **Connect**.
23+
1. Select **General connection string** from the **Select option** dropdown.
24+
1. Open the **General connection string** section, then copy the connection string provided and save it in a secure location.
25+
26+
## Step 2. Create the `movr` database
27+
28+
1. Connect to the SQL shell using the connection string you copied in [Step 1](#step-1-get-the-cluster-connection-string):
29+
30+
{% include copy-clipboard.html %}
31+
~~~ shell
32+
cockroach sql --url \
33+
'postgresql://<username>:<password>@serverless-host>:26257/defaultdb?sslmode=verify-full&options=--cluster%3D<routing-id>'
34+
~~~
35+
36+
Where:
37+
- `<username>` is the SQL user. By default, this is your {{ site.data.products.db }} account username.
38+
- `<password>` is the password for the SQL user. The password will be shown only once in the **Connect to cluster** dialog after creating the cluster.
39+
- `<serverless-host>` is the hostname of the {{ site.data.products.serverless }} cluster.
40+
- `<routing-id>` identifies your tenant cluster on a [multi-tenant host](https://www.cockroachlabs.com/docs/cockroachcloud/architecture.html#architecture). For example, `funny-skunk-123`.
41+
42+
1. In the SQL shell, create the `movr` database:
43+
44+
{% include copy-clipboard.html %}
45+
~~~ shell
46+
CREATE DATABASE movr;
47+
~~~
48+
49+
1. Exit the SQL shell:
50+
51+
{% include copy-clipboard.html %}
52+
~~~ shell
53+
quit
54+
~~~
55+
56+
1. Return to the **Connect to cluster** dialog from [Step 1](#step-1-set-up-your-cluster-connection) and select `movr` from the **Database** dropdown.
57+
58+
1. Copy the new **General connection string**.
59+
60+
## Step 3. Load the `movr` workload
61+
62+
Load the `movr` dataset using the new connection string:
63+
64+
{% include copy-clipboard.html %}
65+
~~~ shell
66+
cockroach workload init movr \
67+
'postgresql://<username>:<password>@serverless-host>:26257/movr?sslmode=verify-full&options=--cluster%3D<routing-id>'
68+
~~~
69+
70+
## Step 4. Run the workload
71+
72+
Run the `movr` workload for 1 minute using the same SQL connection string as before:
73+
74+
{% include copy-clipboard.html %}
75+
~~~ shell
76+
cockroach workload run movr \
77+
--duration=1m \
78+
'postgresql://<username>:<password>@serverless-host>:26257/movr?sslmode=verify-full&options=--cluster%3D<routing-id>'
79+
~~~
80+
81+
You'll see per-operation statistics print to standard output every second:
82+
83+
~~~
84+
_elapsed___errors__ops/sec(inst)___ops/sec(cum)__p50(ms)__p95(ms)__p99(ms)_pMax(ms)
85+
1.0s 0 31.9 32.0 0.5 0.6 1.4 1.4 addUser
86+
1.0s 0 6.0 6.0 1.2 1.4 1.4 1.4 addVehicle
87+
1.0s 0 10.0 10.0 2.2 6.3 6.3 6.3 applyPromoCode
88+
1.0s 0 2.0 2.0 0.5 0.6 0.6 0.6 createPromoCode
89+
1.0s 0 9.0 9.0 0.9 1.6 1.6 1.6 endRide
90+
1.0s 0 1407.5 1407.8 0.3 0.5 0.7 4.1 readVehicles
91+
1.0s 0 27.0 27.0 2.1 3.1 4.7 4.7 startRide
92+
1.0s 0 86.8 86.9 4.7 8.4 11.5 15.2 updateActiveRides
93+
2.0s 0 26.0 29.0 0.5 1.1 1.4 1.4 addUser
94+
2.0s 0 8.0 7.0 1.2 2.8 2.8 2.8 addVehicle
95+
2.0s 0 2.0 6.0 2.6 2.8 2.8 2.8 applyPromoCode
96+
2.0s 0 0.0 1.0 0.0 0.0 0.0 0.0 createPromoCode
97+
2.0s 0 6.0 7.5 0.8 1.7 1.7 1.7 endRide
98+
2.0s 0 1450.4 1429.1 0.3 0.6 0.9 2.6 readVehicles
99+
2.0s 0 17.0 22.0 2.1 3.3 5.5 5.5 startRide
100+
2.0s 0 59.0 72.9 6.3 11.5 11.5 14.2 updateActiveRides
101+
...
102+
~~~
103+
104+
After the specified duration (1 minute in this case), the workload will stop and you'll see totals printed to standard output:
105+
106+
~~~
107+
_elapsed___errors_____ops(total)___ops/sec(cum)__avg(ms)__p50(ms)__p95(ms)__p99(ms)_pMax(ms)__result
108+
60.0s 0 85297 1421.6 0.7 0.3 2.6 7.1 30.4
109+
~~~
110+
111+
## Step 5. Calculate your budget
112+
113+
1. In the {{ site.data.products.db }} Console, close the **Connect to cluster** dialog to return to your cluster's [**Overview** page](cluster-overview-page.html).
114+
115+
1. In the **Usage this month** section, note the number of RUs your cluster used. You can also see the **Request Units** graph for a breakdown of how many RUs per second you were using over the last minute.
116+
117+
1. Multiply your usage over one minute by the number of minutes in a month (43800) to estimate how many RUs the workload would use in a month. For example, if you used 1800 RUs: 1800 RUs/min * 43800 min = 78,840,000 RUs.
118+
119+
1. Calculate your budget. The workload is estimated to use about 79 million RUs per month, and you are given up to 250M free RUs per month, so the free {{ site.data.products.serverless }} offering should be sufficient for your usage.
120+
121+
## Next steps
122+
123+
The MovR team can monitor their usage in the {{ site.data.products.db }} Console, and they will receive email alerts when the cluster approaches 50%, 75%, and 100% of its spend limit. If their workload grows and they reach the limits of the {{ site.data.products.serverless }} free offering, they can then set a spend limit.
124+
125+
To estimate an actual budget for your cluster, you should run your real workload and gather usage data. You can always [edit your spend limit](serverless-cluster-management.html) if your initial estimate turns out to be inaccurate.
126+
127+
## See also
128+
129+
- [Serverless Performance Benchmarking](serverless-benchmarking.html)
130+
- [Manage a CockroachDB Serverless Cluster](serverless-cluster-management.html)
131+
- [The MovR Example Application](../stable/movr.html)
132+
- [Example Apps](../stable/example-apps.html)

0 commit comments

Comments
 (0)