The Art of Data Residency and Application Architecture
/* A demo of multi-region capabilities in CockroachDB. */
Why a multi-region database?
When your application serves users across states, countries, or continents, you need to make sure you keep your latency low, meet local regulations, and deliver an always-on experience.
The solution: running a multi-region database.
Setting up and managing a multi-region database with traditional tools can be labor intensive. But CockroachDB can help. A distributed SQL database, CockroachDB lets you pin data to specific locations (servers, availability zones, or cloud regions) to optimize latency, comply with regional regulations, and maintain high availability.
In this demo, we illustrate CockroachDB's multi-region capabilities. We're running a single logical CockroachDB serverless instance spanning three AWS regions:
us-east-1
us-west-2
eu-central-1
Make your own art
In this demo, you'll create art that resides in specific cloud regions. Some data is stored in either the United States or Europe, while other data is stored in both places. That's because the app can write to any region from anywhere.
Try the demoView the Gallery
When you view the Gallery, you'll only see art that resides in your current location. That's because the app can only read data from your closest region(s). Some data crosses all regions, so you'll always see it.
View the GalleryGlobal data
The artwork's pattern and logo settings are stored in both the United States and Europe, and are made available for viewing globally. The data is replicated across all three regions in the CockroachDB cluster. This setting is useful for application data that's universally relevant.
Use the toggle below to understand how the Gallery data is represented in CockroachDB.
User ID | Image | Data | Region |
---|---|---|---|
a_123 | us_unsplash.com_18RFbOQGCi0.jpg | #B31942#0A3161 | πΊπΈus-east-1 |
a_123 | topleft,whiteblack | πglobal | |
a_123 | eu_unsplash.com_2MoEcGNUj-I.jpg | #FFD700#00966E#D62612 | π©πͺeu-central-1 |
b_456 | us_unsplash.com_42gFAgdIUC8.jpg | #0A3161#FFFFFF | πΊπΈus-east-1 |
b_456 | bottomright,purplewhite | πglobal | |
b_456 | eu_unsplash.com_hxhZMwfiGdQ.jpg | #0000FF#0B2C5F | π©πͺeu-central-1 |
c_789 | us_unsplash.com_688Fna1pwOQ.jpg | #B31942#0A3161#FFFFFF | πΊπΈus-east-1 |
c_789 | rightbottom,blackpurple | πglobal | |
c_789 | eu_unsplash.com_jIh1QFf1naY.jpg | #AE1C28 | π©πͺeu-central-1 |
United States data
Certain images and colors in the demo are stored in the United States. If you're located anywhere in the world except Europe, you can only see United States data in the Gallery.
The data is replicated between CockroachDB instances on the East coast and West coast to provide high availability and guard against regional outages.
European data
Certain images and colors in the demo are stored in Europe and will never be available outside of it. If you're located in Europe, you can only see European data. Given the stringent European data privacy regulations, this capability is especially important.
Try the demoLearn how it works
We've written an in-depth blog post explaining how we used multi-region AWS architecture together with CockroachDB Serverless to make this demo.
Get started withCockroachDB today
- No credit card required
- Free storage up to 10 GB
- Single-click deployment