This is the 10th day of my participation in the August More text Challenge. For details, see: August More Text Challenge

As the title of this article asks, what is a transactional database? The short answer is that it is a storage system that supports all or no data operations, commonly referred to as transactions. This means that if any subset of some potentially long list of data operations to perform (for example, create, update, or delete information) fails for any reason, all operations will be abandoned, and the database will be restored to the state before any operation. The action began.

This feature provides reliable information storage and processing because it ensures that the database is always in the correct state by preventing incorrect data manipulation. A transactional database provides assurance of data integrity, even in the event of a system failure, which can be mission-critical for many use cases.

Consider a quick and common example of a bank customer using an application on a mobile device to move funds from one account to another. Complete and correct transactions require the source account to be debited and the destination account to be credited.

However, if a power outage occurs, the database server after the origin account has not yet deducted the previous target account credit? A true transactional database ensures that in this case the first part of the entire transaction is cancelled (or “rolled back”) because the second part did not pass, and the database remains in a correct and consistent state despite the failure.

In this article, we will research database transaction and its importance, and a more detailed explanation of “ACID compliance” four key elements and its importance, and discuss when the data distribution and transaction in modern system to maintain the elements involved in the common difficulties, and to provide some transactional database system about the choice to meet your demand of specific recommendations.

What is a database transaction?

In short, a database transaction is a unit of work performed by a database management system (DBMS) against a given database, performing data operations and updating underlying files on various storage media. A transactional database will ensure that such a unit of work is all-or-nothing, because any failure in any operation will cause all operations to pause and roll back, leaving the database in the state before the transaction began.

There are two main reasons to use a transactional database. The first is that it makes the unit of work reliable in all cases. Recalling our banking example, customers can rest assured that when their money is deducted from the original account, it will be credited to the destination account. If anything goes wrong along the way (for example, network failure, server failure, etc.), the customer expects their account to remain unchanged rather than simply losing money due to an accidental event.

The second reason is that the transactional database we describe is always in a correct and consistent state, regardless of the possible failures of all the technologies involved. No one wants to store information in a system where the data can become incoherent by allowing for invalid operations, or where the information can be lost if the server goes down. Of course, not every use case is mission-critical, but many are, and in those cases, transactional databases can provide significant business value.

Of course, not every database system is transactional in nature. Some systems focus only on recording missing information or information that is not required to support transactional functionality. When considering your use cases, it’s important to pay close attention to the extent to which you need these capabilities and match your expectations with the extent to which the underlying database system adheres to transactional database principles.

The importance of ACID compliance

ACID stands for “Atomicity, Consistency, Isolation, and healing”, a set of principles for ensuring that database transactions are reliable and handled correctly. The following table explains what these four different elements involve.

The element meaning
atomic All data operations in a transaction are completed or rolled back in an all-or-nothing manner.
consistency The information in the database must be semantically meaningful in all cases (e.g., no child data inserted when there is no valid parent, no null values for required fields, etc.)
isolation Each transaction must run independently of any other simultaneous transactions; That is, information cannot be allowed to “leak” from one transaction to another.
durability Any successfully completed transaction is recorded in an indelible way, meaning its data will not be lost in the event of a software or even hardware failure.

Let’s consider a more complex example to illustrate why ACID guarantees are important. Imagine another common situation in which two people, A and B, are booking seats in the same row for the same show at the cinema. A reserved only one seat, while B tried to book an entire row for A family outing.

If A had booked A seat first, then B’s transaction would have failed because one seat in the online shopping cart had already been booked and could not be double booked. This illustrates atomicity, because one of B’s data operations fails, and they both do, and consistency, because the system will not allow meaningless data, such as two people keeping the same seat.

B’s transaction will be cancelled only if A’s reservation is successfully completed and written to the database. Before this happens, however, the nature of the segregation is to allow two people to try to trade for the same seat at the same time, ensuring that both parties regard the contested seat as available until it is actually reserved.

Finally, even if the entire reservation system crashes after A has successfully reserved A seat, persistence ensures that the correct data is still there upon restart. This allows A to print tickets as needed and enjoy the show, no matter what system failures occur after the transaction has been properly completed.

How do distributed transactions work?

The increasingly decentralized nature of modern applications, often available on a global scale, makes the problem of transactional databases more difficult. The reason is that ACID guarantees are just as important for distributed systems as single database software running on a single server, but involving multiple servers or nodes can significantly complicate the issue.

Think about it. This is simple when a single database software can “decide” to cancel all other data operations in a transaction immediately after the first transaction fails. It’s quite another when database software is running on dozens (or even hundreds) of nodes scattered around the world. Any failure of any element of any data operation on any of these servers requires that the entire transaction must be cancelled and safely rolled back anywhere. Similarly, even if the transaction succeeds, the entire system must ensure that all operations are correct and persistent, regardless of which server or servers perform them.

In practice, distributed transaction databases are difficult to implement correctly, but fortunately some vendors do. For example, thanks to its architecture and data storage algorithms, Fauna is able to provide strictly serializable, externally consistent transactions.

Unlike other systems, Fauna does not require strict physical clock synchronization between all servers to provide consistency, which avoids the usual distance constraints between replica servers and is therefore practical for deploying around the world with typical global Internet latency. Methods that do require synchronization can cause failures when the system clock or network traffic is off by a few milliseconds, but Fauna’s more relaxed requirements wouldn’t.

This is possible because Fauna provides a Calvin-inspired transaction engine, which is a way to implement fast distributed transactions across partioned database systems. The Fauna transaction engine can achieve “consistency without clock” through its distributed transaction protocol. In fact, before any database is written, the Fauna predetermines in what order transactions should be executed. The Fauna execution engine then processes them in such a way that the end result is the same as processing them one at a time in that order.

In effect, you can get all the speed and functionality of a distributed transaction executed in parallel across multiple servers, while enjoying all the data benefits of a transactional database as if they were executed sequentially on a single server.

Call to action

Fauna combines all the flexibility and performance of a non-transactional database with the relational queries and capabilities and ACID guarantees of a transactional database in a fully distributed manner. In fact, because of the way Fauna handles its distributed transactions, users can avoid the kind of data exceptions that might occur in other systems. You can prevent immortal writes, stale reads, cause-and-effect reversals, and other such problems with strictly serializable multi-region transactions that do not limit the number of keys, documents, or partitions.

It’s also worth noting that Fauna is not the database as a Service (DBaaS) that is typically hosted, or even some clustered cloud product, both of which need to be managed. Instead, Fauna is a true “data API,” meaning that developers can simply call it as needed without spending time worrying about configuration or extensions, with all the benefits of a transactional database and ACID compliance.

Because it’s a true data API, Fauna doesn’t have all the usual configuration and configuration issues and is available immediately as a serverless utility. Developers only need an account to get started, paying no fees and offering generous start-up perks. None of the usual headaches: no configuration instances, no extensive configuration, etc.

In this article, we examine transaction databases, explain the ACID guarantees they provide, illustrate their value in mission-critical use cases, discuss how the modern need for distributed transactions complicates the situation, and provide some specific recommendations to easily reap the data benefits of ACID compliance.

Finally, Fauna provides all value by easily distributing database transactions, automating configuration, and easily scaling. It’s free to sign up for, easy to use, and offers clear and simple pricing — just pay for what you actually use. If you think Fauna can manage your data needs, why not give it a try right now?


That’s all for this article

I have been writing a tech blog for a long time and this is one of my tech articles/tutorials. Hope you like it! Here is a summary of my gold digger blog homepage: Hai Yong

If you do learn something new from this post, like it, bookmark it and share it with your friends. 🤗 Finally, don’t forget ❤ or 📑 for support.