When Worlds Collide: Frontend vs Database

Rate this content
Bookmark

Classic frontend vs backend API design conflicts are becoming a headache of the past with serverless and Jamstack architectures and tools; frontend developers are building the full stack. But this poses a new problem: “What database? Who cares about the database?” This talk will help you with the questions you should ask of the database for your next side project...and a place to begin your journey in database internals.

This talk has been presented at JSNation Live 2020, check out the latest edition of this JavaScript Conference.

FAQ

Consistency ensures that data is in a valid state both before and after a transaction. It guarantees that the transaction will bring the database from one valid state to another.

Isolation ensures that the intermediate state of a transaction is invisible to other transactions. This means that transactions occur independently without interference.

ACID stands for Atomicity, Consistency, Isolation, and Durability. These are properties that ensure reliable processing of database transactions.

Atomicity means that all changes to the data are performed as a single operation. Either all changes happen, or none do, ensuring an 'all or nothing' approach.

Durability means that once a transaction is complete, the changes are permanent and will survive any system failures or outages.

The CALVIN protocol is used for fast distributed transactions in partitioned database systems. It ensures data replication and consistency across global sites.

Developers can ensure their database meets their requirements by understanding how their chosen database handles distributed transactions and by verifying that it aligns with their application's needs.

To learn more about distributed database fundamentals, you can refer to resources like the CMU Database Group YouTube channel and jepson.io, which offers talks and materials on the topic.

The main topic of Tyler Hannon's talk is the importance of choosing the right database for your application, focusing on distributed transactions and the ACID properties.

Fauna's approach to distributed transactions is based on a protocol called CALVIN, which ensures fast distributed transactions and data replication across different global sites.

Tyler Hannan
Tyler Hannan
8 min
18 Jun, 2021

Comments

Sign in or register to post your comment.
Video Summary and Transcription
In this talk, the importance of choosing the right database for your application is discussed, especially in the context of Fullstack development. The ACID properties—Atomicity, Consistency, Isolation, and Durability—are explained in detail, emphasizing their role in data integrity and reliability. Distributed transactions are highlighted, with a focus on the CALVIN protocol used by FAUNA. This protocol ensures global replication and data integrity across multiple cloud vendors. The talk also covers various database options like MongoDB, DynamoDB, Firebase, and Cassandra, with specific advantages and challenges of each. For those interested in deeper insights, resources like the CMU Database Group YouTube and jepson.io are recommended. The ultimate goal is to have a fast, reliable, and serverless database that meets specific requirements. FAUNA offers a free tier and support for those willing to try it.

1. Choosing the Right Database and Understanding ACID

Short description:

In this talk, Tyler Hannon discusses the importance of choosing the right database for your application. He introduces the ACID acronym, which stands for Atomicity, Consistency, Isolation, and Durability. Tyler explains each component of ACID and its significance in maintaining data integrity and reliability. He also highlights the challenges and benefits of distributed transactions in modern Fullstack applications.

Excellent, so thanks so much for joining me today. My name is Tyler Hannon, and I look after community, and support, and customer success at Fauna. My background is actually in distributed systems and databases, so an event like JS Nation is not where I am most comfortable, but similarly, my expertise is perhaps where you're not most comfortable. And that's why I titled this talk When Worlds Collide.

We are in a sociological shift in the Fullstack world, where a web server was adjacent to the database, to this new world with global clients and global APIs, where latency and consistency at the edge is critical. But unfortunately, we're all being marketed at. So when you think about your application, the reality is we just want to dump data somewhere, and we want to read data from somewhere. And I guarantee that either in a diagram you have on your own or somewhere inside of the company you work for, there is this 1980s looking bit of clip art that represents a database with the notes, insert the logo here. And that's what I want to talk about today. What is important to consider when you choose what logo to insert into that database diagram?

We know that the database is often a bottleneck, and just like so many database vendors are talking now, we also know that distributed transactions are the solutions, but distributed, what even now? And what is this thing, ACID, that database vendors keep talking about? It is not related to the thing you can find here in the city that I'm from of Amsterdam. It's something entirely different. In fact, it's an acronym and acronyms are weird. So I thought I would take a little bit of time to walk through this ACID acronym with you. So the first is A, atomic or atomicity. Basically what it's saying is that all changes to the data are performed as if they were a single operation. That is like everything happens or nothing happens. The canonical example for this kind of workflow is financial services. If I am debiting an account that debit must be made successfully and the credit must be made successfully but that's a lot of words. So I like to think of the atomic property as all or nothing. There's C for consistent. Data is in a consistent state when the transaction starts and when the transaction ends. Again, to use our canonical example, this would be in an application that's transferring funds from one place to another. This property ensures that the total value combined is in the same state both before and after the transaction. It is valid before, it is valid after. I is for isolation in that the intermediate state of a transaction is invisible to others. Basically, things happen one at a time or in parallel, but regardless, the result is the same, and D is durable, or durability. When the transaction is complete, the changes are persisted and are not undone. This is probably what you are most familiar with. Once it's complete, it survives in outage. Now, there are a wide variety of database vendors that talk about distributed transactions.

2. Choosing the Right Database Approach

Short description:

There are various approaches to solving database challenges, including Mongo, Dynamo, Firebase, Cassandra, and FAUNA. FAUNA's approach is based on the CALVIN distributed transaction and data replication protocol. CALVIN ensures data integrity and provides global replication, allowing for temporal capabilities and integration with multiple cloud vendors. For those interested in learning more, resources like CMU Database Group YouTube and jepson.io offer valuable insights. Ultimately, the goal is to have a fast, reliable, and serverless database that meets your specific requirements. Try FAUNA for free and reach out for any questions or support.

There's many approaches to how to solve this. There's Mongo's approach and Dynamo's approach, and what Firebase talks about, and what Cassandra talk about. What we at FAUNA talk about as well. Our approach, for what it's worth, is based in a distributed transaction and data replication protocol called CALVIN. This is the title of the paper. CALVIN Fast Distributed Transactions for Partitioned Database Systems. If you have any interest, I encourage you to read about it. Because ultimately, understanding how your requirements are met are important in ensuring that they are met completely.

In simple though, it's a multi-document transaction, and it looks a little bit like this. I have built a compelling, awesome app in some flavor of JavaScript using the frameworks and tools that I trust, be that React, or Next, or whatever. My app has a piece of data, and my friendly little helper in my app goes to the database and says, hey, here's data. And that data falls into the transaction log. That transaction log is then replicated to another site globally. The replication is acknowledged. There's a whole bunch of checks, and maths, and confusing things that go into place. And then the data is written. As that data is replicated globally, because it's in the transaction log, it is returned to the application as complete. This also allows for some really cool capabilities around temporality, knowing what happened at what point in time. And it allows us to reach out to a variety of cloud vendors in a variety of regions around the world, some of which are available today and some of which will be available in the future.

But your journey is just beginning. I encourage you to look at the CMU Database Group YouTube if you're interested in how these sorts of things work. To look at jepson.io and the amazing talks that Kyle Kingsbury has done and the work that he has done in breaking distributed databases and making us as an industry better for it. But at its simplest, you just wanna dump your data somewhere. You just wanna read what you wrote. You just want it to be fast everywhere. You have described a geographically redundant distributed system. And because you don't want to be an operator, you've described a database that's built for serverless. You just want it to work. We want that for you to try it. It's free, there's a free tier. It's great. Also feel free to hit me up. I'm at Tyler Hannon. You can also find us at at fauna. I am marketing to you. You are being marketed to all the time. Know that your journey of understanding about distributed database fundamentals begins with knowing what you care about. Thank you so much, and I'll be in chat if people have questions.

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Vue: Feature Updates
Vue.js London 2023Vue.js London 2023
44 min
Vue: Feature Updates
Top Content
Watch video: Vue: Feature Updates
The Talk discusses the recent feature updates in Vue 3.3, focusing on script setup and TypeScript support. It covers improvements in defining props using imported types and complex types support. The introduction of generic components and reworked signatures for defined components provides more flexibility and better type support. Other features include automatic inference of runtime props, improved define emits and defined slots, and experimental features like reactive props destructure and define model. The Talk also mentions future plans for Vue, including stabilizing suspense and enhancing computer invalidations.
Future of Frontend Frameworks Fireside Chat
React Summit 2024React Summit 2024
28 min
Future of Frontend Frameworks Fireside Chat
Fred K. Schott
Minko Gechev
Ryan Carniato
Daniel Afonso
Aakansha Doshi
Tim Neutkens
6 authors
Signals are being adopted by popular frameworks, enabling code reuse and improved tooling. While merging between frameworks is unlikely, they are learning from each other and adopting shared practices. It is important to embrace the diversity of frameworks and libraries. Instead of merging, focus on standardizing the principles behind frameworks. Consider tradeoffs and benefits when choosing a framework, and explore different technologies to learn new ideas.
TypeScript and the Database: Who Owns the Types?
TypeScript Congress 2022TypeScript Congress 2022
27 min
TypeScript and the Database: Who Owns the Types?
Top Content
The Talk discusses the use of TypeScript and SQL together in software development. It explores different approaches, such as using an ORM like TypeORM or a schema generator like pg2ts. Query builders like connects JS and tools like PGTyped are also discussed. The benefits and trade-offs of using TypeScript and SQL are highlighted, emphasizing the importance of finding a middle ground approach.
I Would Never Use an ORM
JSNation 2023JSNation 2023
29 min
I Would Never Use an ORM
Top Content
Welcome to a talk on Object-Relational Mapping (ORM) and its potential pitfalls. The speaker discusses issues with modals and the MVC pattern, as well as the benefits of structuring code around system features instead. They introduce PlatformaticDB as a solution for easy backend development, showcasing its deployment and testing capabilities. The talk also covers integrating with Next.js, writing custom SQL queries, and the speaker's plans for future support and database compatibility.
Database Access on the Edge with Cloudflare Workers & Prisma
Node Congress 2022Node Congress 2022
31 min
Database Access on the Edge with Cloudflare Workers & Prisma
This Talk discusses database access on the edge with CloudFlare workers and the challenges of serverless platforms. It explores solutions for database access, including CloudFlare-specific solutions and using Prisma data proxy. The Prisma toolkit and demo are showcased, demonstrating how to convert an application to use a database. The process of setting up Prisma Data Platform and deploying the application to CloudFlare workers is explained. The Talk concludes with insights on database usage and the differences between serverless, CDN, and the Edge.
Bring AI-Based Search to Your Web App
JSNation 2023JSNation 2023
31 min
Bring AI-Based Search to Your Web App
The Talk discusses the use of machine learning in search engines, specifically focusing on semantic search and vector embeddings. It explores the integration of JavaScript and machine learning models, using Weaviate as an open-source vector database. The Talk demonstrates how to connect to Weaviate, query data, and perform machine learning queries. It also highlights the benefits of Weaviate, such as its superior developer experience and performance. Additionally, the Talk addresses customization options, data privacy concerns, and the varying effectiveness of different machine learning models.

Workshops on related topic

How to Solve Real-World Problems with Remix
Remix Conf Europe 2022Remix Conf Europe 2022
195 min
How to Solve Real-World Problems with Remix
Featured Workshop
Michael Carter
Michael Carter
- Errors? How to render and log your server and client errorsa - When to return errors vs throwb - Setup logging service like Sentry, LogRocket, and Bugsnag- Forms? How to validate and handle multi-page formsa - Use zod to validate form data in your actionb - Step through multi-page forms without losing data- Stuck? How to patch bugs or missing features in Remix so you can move ona - Use patch-package to quickly fix your Remix installb - Show tool for managing multiple patches and cherry-pick open PRs- Users? How to handle multi-tenant apps with Prismaa - Determine tenant by host or by userb - Multiple database or single database/multiple schemasc - Ensures tenant data always separate from others
Relational Database Modeling for GraphQL
GraphQL Galaxy 2020GraphQL Galaxy 2020
106 min
Relational Database Modeling for GraphQL
Top Content
WorkshopFree
Adron Hall
Adron Hall
In this workshop we'll dig deeper into data modeling. We'll start with a discussion about various database types and how they map to GraphQL. Once that groundwork is laid out, the focus will shift to specific types of databases and how to build data models that work best for GraphQL within various scenarios.
Table of contentsPart 1 - Hour 1      a. Relational Database Data Modeling      b. Comparing Relational and NoSQL Databases      c. GraphQL with the Database in mindPart 2 - Hour 2      a. Designing Relational Data Models      b. Relationship, Building MultijoinsTables      c. GraphQL & Relational Data Modeling Query Complexities
Prerequisites      a. Data modeling tool. The trainer will be using dbdiagram      b. Postgres, albeit no need to install this locally, as I'll be using a Postgres Dicker image, from Docker Hub for all examples      c. Hasura
Scaling up Your Database With ReadySet
Node Congress 2023Node Congress 2023
33 min
Scaling up Your Database With ReadySet
WorkshopFree
Aspen Smith
Nick Marino
2 authors
The database can be one of the hardest parts of a web app to scale. Many projects end up using ad-hoc caching systems that are complex, error-prone, and expensive to build. What if you could drop in a ready-built caching system to enable better throughput and latency with no code changes to your application?
Join developers Aspen Smith and Nick Marino to see how you can change one line of config in your app and use ReadySet to scale up your query performance by orders of magnitude today.
Build a Full Stack React Native App with Oracle 23ai
React Summit 2024React Summit 2024
37 min
Build a Full Stack React Native App with Oracle 23ai
WorkshopFree
Doug Drechsel
Doug Drechsel
In this workshop, you will set up a local full-stack environment and create a React Native Mobile app that runs against that stack. 
Agenda:- Install Oracle 23ai Docker container- Build and run Parse Server with the new Oracle Storage Adapter - Build and run a Walking History React Native mobile app against the stack
Walking History is a React Native application that allows you to walk around New York City (or simulate that in a device emulator) and it tells you about the closest attraction or point of interest.


Building a Realtime App with Remix and Supabase
Remix Conf Europe 2022Remix Conf Europe 2022
156 min
Building a Realtime App with Remix and Supabase
Workshop
Jon Meyers
Jon Meyers
Supabase and Remix make building fullstack apps easy. In this workshop, we are going to learn how to use Supabase to implement authentication and authorization into a realtime Remix application. Join Jon Meyers as he steps through building this app from scratch and demonstrating how you can harness the power of relational databases!