Urgent.News

What's breaking now, across hundreds of outlets.

Tech

Choosing the Right Database on GCP: Ask What the App Does With the Data

Orders in Cloud SQL, the cart in Redis or Firestore, reports in BigQuery, and why one database is rarely enough Picture a shopping app. A customer adds shoes to the cart on her phone and expects to see them on the laptop a second later. She pays, and stock must drop by exactly one. That evening, a manager asks for sales by category for the whole month. These are three different questions, and I…

When building a shopping app on Google Cloud Platform (GCP), it is crucial to choose the right database for each specific use case. Orders, payments, and stock should live in Cloud SQL (or Spanner if global). These are the core data that need to be consistent and reliable. The cart can be managed with Firestore or Redis, depending on whether real-time updates or fast caching are more important.

Redis is ideal for a short-lived cart cache, while Firestore offers real-time listeners for instant updates. The product catalog can be stored in MongoDB Atlas or Firestore, allowing different attributes for each product. Clicks and views can be recorded in Bigtable, while sales reports are generated from BigQuery scans over historical data.

By separating the app's database from other tools, you ensure that the orders database remains the source of truth for order data. The cart and product catalog are treated as copies, with Pub/Sub messages delivering updates to BigQuery for reporting purposes. This approach helps avoid performance issues, data inconsistencies, and unnecessary complexity in the system.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

Billions in data centre deals grind to halt after AI chip curbs

Deals that were near the finish line are suddenly in doubt and lenders are struggling to find interested buyers.

  • US imposes new curbs on AI chip access, halting billions in loans
  • Lenders wary of stricter US export controls on data centres and neoclouds
  • Deals nearing completion now in doubt, lenders reassessing loans

Test Email Address Deliverability in Node.js: MX Records, Null MX and the Retry Trap

Picture it: Black Friday weekend, your signup form is on fire, and somewhere in the flood is jane@gmial.com . Your app cheerfully fires off a welcome email, a receipt and a password reset to a domain…

  • Test email deliverability by examining DNS records for MX records
  • No MX records in domain implicitly grants MX to domain itself
  • Node.js code checks syntax, local/domain length, and MX records

More from Thursday 26 November →