Run MongoDB compatible apps on Firestore (Zero code changes)

Google Cloud Tech · Beginner ·🔧 Backend Engineering ·6mo ago

Key Takeaways

The video demonstrates how to run MongoDB compatible applications on Firestore with zero code changes by simply changing the connection string, leveraging Firestore's MongoDB compatible interface and serverless architecture.

Full Transcript

I have heard that you can now easily swap between MongoDB compatible databases and fire store. >> Yes, you can. Let me show you how. >> Welcome to the show, Patrick. What do you do here at Google? >> I lead the engineering team for cloud fire store. I originally joined the team 12 years ago when data store was only an integrated database for Google App Engine. >> Oh, I remember using App Engine with a built-in data store back in the day. So your team Patrick, you guys broke out App Engine's integrated data store and made it a standalone product and the result is Fire Store. >> Yep, that's pretty much the origin story. The App Engine data store was great, but it was tightly coupled to App Engine. People wanted to use a high-erformance and scalable NoSQL database like that from lots of other places. So we modernized it and made it available everywhere. And that became Fire Store back in 2017. >> Oh, 2017. How time flies. I still remember the announcement. >> I I hear you. Now we see Fire Store used all over the place. Folks are using it for mobile and web apps for things like collaborative productivity tools, game backends, and even LLM context stores. Fire store supports direct connections from mobile and web using our real-time SDKs or from serverside code running on something like cloud run or kubernetes engine which talk to fire store to handle all the data. >> Now, how is it even possible to switch to fire store? I've always been told that the database is the hardest and most expensive part to switch in any app. >> Well, in the Fire Store team, we built a MongoDB compatible interface from the ground up directly into Fire Store. We recently released it to Google Cloud and Firebase customers as part of our new enterprise edition. >> Okay. Uh, that sounds good in theory. Uh, how would it work in practice, Patrick? Here is a simple e-commerce application symbol direct. Let me place an order. The application uses Cloud Run and a MongoDB compatible database. Here is the order I placed in the database. >> Okay, so far so good. >> Let's say I want to try out Fire Store. I've prepared a Fire Store database ahead of time. I'll copy the fire store connection string from here into my application's environment variables here. Then I'll deploy a new version of my app that uses this new environment variable. Now I'll place another order. Here we can see my new order in Fire Store. That's cool. I shot a video a few years ago about switching between MongoDB and Fire Store. And in that video, we had to modify code to make it happen. But now you don't have to do that anymore. >> That's right. Now all you have to do is change a connection string. >> I liked your demo, Patrick, but I have so many questions. >> Go ahead, Martin. >> So why would I choose to use Fire Store? >> Well, many developers love serverless for its simplicity and pay-per-use model. It's why Cloud Run is so popular. But you need a database that works the same way. [snorts] >> And that's Fire Store. >> Yes, that's Fire Store. It's a serverless database that works well for one query per day or a 100,000 queries per second without you ever having to provision capacity, patch servers, or worry about sharding. It just works. You only pay for the reads and writes you actually use, not for idle time. And since it's fully integrated with Google Cloud, your AM networking and security are all in one place. Paired together, Cloud Run and Fire Store create a powerful, simple, and scalable stack for your application. >> Okay. Uh scalability. Uh let's talk about that. How does Fire Store handle performance under heavy load? >> Such a great question. Remember that online shoe store I showed you earlier where we placed those couple of orders? >> Uh yeah. Uh, symbol direct, right? >> Exactly. Well, I actually ran a pretty intense load test on it earlier today. You might think Fire Store can only handle an order every few minutes. >> That would be a pretty relaxed shoe store, >> right? But it can do so much more. Let me pull up the dashboard for that store. If you look at the top left graph here at the start of the test, we're seeing a few hundred orders per second. Then, as the load tester ramps up, we hit a peak of about 40,000 orders per second. >> Whoa, that's a lot of online purchases. I wish I had an online store that popular. >> Me, too. And if you look at the top right graph, as those orders surge, so do the Fire Store inserts. We see a direct correlation hitting 40,000 Fire Store inserts per second, which is what we'd expect. >> So, the database is keeping up with the incoming orders >> precisely. Now while fire store is handling the data the application itself runs on cloud run. Take a look at the lower right graph. You can see Google automatically scaled up the number of cloudr run instances from five to 100 to gracefully handle that massive load. >> And how did you configure that? >> I didn't. I deployed my cloud run service and Google took care of the autoscaling. No pre-provisioning, no manual intervention needed to handle 40,000 orders per second. It just worked. Very nice. Uh, but what if someone wanted to control costs and prevent Cloud Run from scaling up like that? >> Very valid concern. You can set a maximum number of instances for Cloud Run for this particular test. I didn't because I wouldn't want to turn away paying customers from my shoe store. And finally, to ensure our customers had a good experience, the lower left graph shows that the median latency for end users stayed around a snappy 18 milliseconds, even at peak order volume. >> 18 milliseconds. Not bad. Now, if I want to start using Fire Store, I'd have to move my existing data over. How would I do that? >> You would use data stream, Google's serverless replication service. It handles the initial copy of all your existing data and then uses change data capture to stream any new changes from your old database to fire store in real time. That way you can migrate with minimal downtime for your application. >> Great. Does this new uh compatibility support all my existing MongoDB queries? >> It supports over 200 of the most commonly used features and we keep adding support for more. Check the doc for details. >> Excellent. That was my last question. Uh, this was a lot of good info, maybe more than I can remember. Uh, what are the main takeaways here, Patrick? >> First, flexibility is good. Now, it's easier to switch between MongoDB and Fire Store in both directions. That's good for developers. Second, serverless is good. Fire store scales up and down with your needs with no need to provision ahead of time. And third, a single pane of glass is good. If you are using Google Cloud and Fire Store, you can manage your app and your database in one place. >> Good takeaways. Thanks for joining me, Patrick. >> Thank you so much for having me, Martin. >> And thank you everyone for watching. If you have any questions for Patrick or me, please add them in the comments. Also, let me know what you thought of this episode. I love hearing from you and I read every single comment. Can't wait to see what you build.

Original Description

Firestore with MongoDB compatibility overview → https://goo.gle/4rHxW5L Did you know you can point a MongoDB application at Firestore just by changing a connection string? Patrick Costello, Firestore Engineering Lead, joins Martin Omander to show exactly how the new interface works under the hood, without changing any code. Watch along as the duo switch an application from a MongoDB compatible database to Firestore, and then we put it to the test. Patrick ramps the load up to 40,000 orders per second, showing how Firestore handles the massive influx of writes while Cloud Run automatically scales the application instances to match. Key takeaways: 1️⃣ Flexibility: Easier switching between MongoDB compatible databases and Firestore (in both directions) using drivers and tools you already know. 2️⃣ True serverless: No sharding or provisioning capacity ahead of time. It scales to zero and handles spikes automatically. 3️⃣ Unified Ops: Manage your database, IAM, and networking in a "single pane of glass" alongside the rest of the Google Cloud resources. Chapters: 0:00 - Intro 1:01 - What is Firestore? 1:40 - Is it realistic to switch databases? 2:10 - Demo 3:18 - Why use Firestore? 4:14 - Scalability 6:26 - Database migration 7:15 - Takeaways 7:49 - Wrap up Watch more Serverless Expeditions → https://goo.gle/ServerlessExpeditions 🔔 Subscribe to Google Cloud Tech → https://goo.gle/GoogleCloudTech #GoogleCloud Speakers: Martin Omander, Patrick Costello Products Mentioned: MongoDB, Firestore, Cloud Run
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Google Cloud Tech · Google Cloud Tech · 0 of 60

← Previous Next →
1 I’m going for it #GoogleCloudCertified
I’m going for it #GoogleCloudCertified
Google Cloud Tech
2 I had to get #GoogleCloudCertified
I had to get #GoogleCloudCertified
Google Cloud Tech
3 Be better overall at what you do #GoogleCloudCertified
Be better overall at what you do #GoogleCloudCertified
Google Cloud Tech
4 Cloud Monitoring on our radar #Analysis #Uptime
Cloud Monitoring on our radar #Analysis #Uptime
Google Cloud Tech
5 Introduction to Generative AI Studio
Introduction to Generative AI Studio
Google Cloud Tech
6 How to use Github Actions with Google's Workload Identity Federation
How to use Github Actions with Google's Workload Identity Federation
Google Cloud Tech
7 Introduction to Responsible AI
Introduction to Responsible AI
Google Cloud Tech
8 Networking updates and CDMC-certified architecture
Networking updates and CDMC-certified architecture
Google Cloud Tech
9 Create and use a Cloud Storage bucket
Create and use a Cloud Storage bucket
Google Cloud Tech
10 How to digitize text from documents
How to digitize text from documents
Google Cloud Tech
11 Faster analytical queries with AlloyDB
Faster analytical queries with AlloyDB
Google Cloud Tech
12 Next ‘23 sessions and FaaS Wave
Next ‘23 sessions and FaaS Wave
Google Cloud Tech
13 Introduction to Assured Open Source Software
Introduction to Assured Open Source Software
Google Cloud Tech
14 BigQuery Cost Optimization: Storage
BigQuery Cost Optimization: Storage
Google Cloud Tech
15 BigQuery Cost Optimization: Compute
BigQuery Cost Optimization: Compute
Google Cloud Tech
16 BigQuery Cost Optimization: Select Queries
BigQuery Cost Optimization: Select Queries
Google Cloud Tech
17 Remote Field Equipment Management with Manufacturing Data Engine
Remote Field Equipment Management with Manufacturing Data Engine
Google Cloud Tech
18 Supercharging your applications with Cloud SQL Enterprise Plus
Supercharging your applications with Cloud SQL Enterprise Plus
Google Cloud Tech
19 Vector Support on our radar #GenAI
Vector Support on our radar #GenAI
Google Cloud Tech
20 Architecting a blockchain startup with Google Cloud
Architecting a blockchain startup with Google Cloud
Google Cloud Tech
21 Kubernetes and multitasking updates!
Kubernetes and multitasking updates!
Google Cloud Tech
22 GKE: Using Kubernetes Events
GKE: Using Kubernetes Events
Google Cloud Tech
23 How to configure firewall rules for Cloud Composer
How to configure firewall rules for Cloud Composer
Google Cloud Tech
24 Vertex AI Embeddings API + Matching Engine: Grounding LLMs made easy
Vertex AI Embeddings API + Matching Engine: Grounding LLMs made easy
Google Cloud Tech
25 Geospatial analytics on our radar #EarthEngine #BigQuery
Geospatial analytics on our radar #EarthEngine #BigQuery
Google Cloud Tech
26 Ensuring requests are set in Kubernetes
Ensuring requests are set in Kubernetes
Google Cloud Tech
27 Cloud Next 2023, Google research program, and more!
Cloud Next 2023, Google research program, and more!
Google Cloud Tech
28 How to migrate projects between organizations with Resource Manager
How to migrate projects between organizations with Resource Manager
Google Cloud Tech
29 How to run #MySQL in Google Cloud
How to run #MySQL in Google Cloud
Google Cloud Tech
30 #GenerativeAI for enterprises and #Next2023
#GenerativeAI for enterprises and #Next2023
Google Cloud Tech
31 How Google Photos scales to store 4 trillion photos and videos
How Google Photos scales to store 4 trillion photos and videos
Google Cloud Tech
32 Google Cross-Cloud Interconnect (Demo 2)
Google Cross-Cloud Interconnect (Demo 2)
Google Cloud Tech
33 GKE Cost Optimization Golden Signals: Introduction
GKE Cost Optimization Golden Signals: Introduction
Google Cloud Tech
34 GKE Cost Optimization Golden Signals: Workload Rightsizing
GKE Cost Optimization Golden Signals: Workload Rightsizing
Google Cloud Tech
35 GKE Load Balancing: Overview
GKE Load Balancing: Overview
Google Cloud Tech
36 GKE Load Balancing: Best Practices
GKE Load Balancing: Best Practices
Google Cloud Tech
37 Disaster Recovery in GKE
Disaster Recovery in GKE
Google Cloud Tech
38 How to configure IP masquerade agent in GKE Standard clusters
How to configure IP masquerade agent in GKE Standard clusters
Google Cloud Tech
39 Enable and use GKE Control plane logs
Enable and use GKE Control plane logs
Google Cloud Tech
40 Compliance in Australia with Assured Workloads
Compliance in Australia with Assured Workloads
Google Cloud Tech
41 Creating budgets and budget alerts in Google Cloud #FinOps
Creating budgets and budget alerts in Google Cloud #FinOps
Google Cloud Tech
42 Cloud SQL Enterprise Plus on our radar #mySQL
Cloud SQL Enterprise Plus on our radar #mySQL
Google Cloud Tech
43 What's Next for Google Cloud?
What's Next for Google Cloud?
Google Cloud Tech
44 How Loveholidays scaled with Contact Center AI
How Loveholidays scaled with Contact Center AI
Google Cloud Tech
45 What is fleet team management in GKE?
What is fleet team management in GKE?
Google Cloud Tech
46 Troubleshoot VPC Network Peering
Troubleshoot VPC Network Peering
Google Cloud Tech
47 Introduction to DocAI and Contact Center AI
Introduction to DocAI and Contact Center AI
Google Cloud Tech
48 Cloud Run Direct VPC egress explained
Cloud Run Direct VPC egress explained
Google Cloud Tech
49 Database deployment options in GKE
Database deployment options in GKE
Google Cloud Tech
50 Analyze cloud billing data with #BigQuery
Analyze cloud billing data with #BigQuery
Google Cloud Tech
51 Tips to becoming a world-class Prompt Engineer
Tips to becoming a world-class Prompt Engineer
Google Cloud Tech
52 Serverless is simple. Do I need CI/CD?
Serverless is simple. Do I need CI/CD?
Google Cloud Tech
53 Accelerating model deployment with MLOps
Accelerating model deployment with MLOps
Google Cloud Tech
54 How Hawaii's Department of Human Services scaled with CCAI
How Hawaii's Department of Human Services scaled with CCAI
Google Cloud Tech
55 Pricing API on our #Radar
Pricing API on our #Radar
Google Cloud Tech
56 How Recommendations AI for Media can boost customer retention
How Recommendations AI for Media can boost customer retention
Google Cloud Tech
57 Troubleshooting: Node Not Ready Status
Troubleshooting: Node Not Ready Status
Google Cloud Tech
58 One weekend until Cloud Next 2023!
One weekend until Cloud Next 2023!
Google Cloud Tech
59 #GoogleCloudNext starts tomorrow!
#GoogleCloudNext starts tomorrow!
Google Cloud Tech
60 #GoogleCloudNext will be demand!
#GoogleCloudNext will be demand!
Google Cloud Tech

The video shows how to easily switch between MongoDB and Firestore by changing a connection string, leveraging Firestore's MongoDB compatible interface and serverless architecture, and demonstrates how to migrate data and scale applications using Cloud Run and Data Stream.

Key Takeaways
  1. Change the connection string to point to Firestore
  2. Deploy a new version of the application using the new connection string
  3. Use Data Stream to migrate existing data to Firestore
  4. Configure Cloud Run for autoscaling
  5. Monitor application performance and latency
💡 Firestore's MongoDB compatible interface allows for easy migration of MongoDB applications with zero code changes, and its serverless architecture enables scalable and cost-effective database management.

Related AI Lessons

Chapters (9)

Intro
1:01 What is Firestore?
1:40 Is it realistic to switch databases?
2:10 Demo
3:18 Why use Firestore?
4:14 Scalability
6:26 Database migration
7:15 Takeaways
7:49 Wrap up
Up next
Machine Learning Project for Final Year Students | ML Project Idea @FameWorldEducationalHub
FAME WORLD EDUCATIONAL HUB
Watch →