AUTHOR
Adservio team
DATE
October 1, 2021
CATEGORY
Digital Analytics
Reactive Programming Architecture Across Platforms

Digital Analytics

5 min

Reactive Programming Architecture Across Platforms

Reactive Relational Database Connectivity (R2DBC) is a type of specification designed to guide the integration of SQL databases using reactive drivers.

The goal of R2DBC is to produce a minimal SPI surface. By nature, R2DBC is fully reactive and aware of back pressure all the way down to the base layer (the database).

If you're looking to explore reactivity and understand how you can start using it, start by exploring how these popular platforms aid its implementation.

Benefits of Reactive Relational Databases

Reactive Relational Database Connectivity's intended use is as a driver for SPI to be consumed as part of client libraries, rather than to be used in application code directly.

The biggest benefits of reactive programming architecture lie in its ability to listen to the responses that asynchronous events, or data streams, put out.

That means a reactive pattern or reactive system allows developers to improve availability and performance.

Here's a look at the other benefits reactive relational databases bring to the table:

  • Less CPU and memory are required to process singular requests.
  • Response times can be significantly faster at high concurrency.
  • Throughput substantially improves at high concurrency.
  • You don't need a completely non-blocking stack to begin using R2DBC.

Ultimately, using a reactive relational database is a good idea—especially if you deal with high concurrency in your stack.

Otherwise, if you happen to be working with low concurrency, it may not bring you any substantial improvements.

This doesn't mean implementing it is a bad idea, especially if you have plans to scale in the near future, but it does mean that the changes may be less noticeable.

With these benefits and considerations in mind, let's dive into some popular platforms and how they're making reactive relational database implementation easy for companies of all sizes.

Hasura GraphQL

When developers come to understand the long list of well-documented benefits of reactive programming, the first question most ask is simple: Why aren't more people using the asynchronous model? In fact, why aren't they using it all of the time?

The answer: Asynchronous reactive programming is extremely difficult to achieve from an architectural standpoint. This is something Hasura's GraphQL platform has routinely acknowledged.

"Specifically, asynchronous requires an atomic and reliable eventing system which itself requires some kind of queue management. The events need to have reliable and flexible triggers and equally be able to listen to changes. The services consumed need to be idempotent and capable of handling events out-of-order," Hasura states.

Given Hasura's in-depth understanding of the event system and real-time API necessary to achieve reactive architecture, Hasura is the prime platform to explore it.

Out-of-the-box, Hasura gives teams access to all the tools they need to achieve asynchronous programming, complete with GraphQL as a real-time API solution.

PostGraphile Realtime

Another popular platform, PostGraphile provides its own answer to the reactive (or "real-time") programming conundrum.

Like Hasura, PostGraphile has created an out-of-the-box solution with the bare basics, allowing developers to customize and extend them as necessary.

"We provide the baseline subscriptions and live queries functionality in core, and the rest is achieved by adding and combining plugins - the official ones, ones made by the community, or ones you've developed in-house," PostGraphile explains.

With PostGraphile, your team will be able to combine the technologies that work best for the project at hand and enable you to achieve a reactive relational architecture, without worrying about creating all the nuts and bolts that form the foundation of it.

MongoDB Atlas

Yet another well-known platform, MongoDB, calls itself the most popular database for modern apps.

Fortunately, it's sticking to that moniker by continuously implementing additional features, such as reactive support.

If you're already using MongoDB, you'll be happy to learn that making the move to a reactive relational database may not be as difficult as you once thought.

MongoDB's official cloud service, known as Atlas, now provides GraphQL API automatically, enabling easy access to the real-time API technology that developers need to achieve reactive relational databases.

GraphQL is the same API that Hasura has made famous, and it's coming to a lot of platforms thanks to its features.

It's also worth exploring deeper when it comes to the MongoDB Reactive Streams Java Driver, which is the company's official solution for asynchronous stream processing in MongoDB that conforms to R2DBC standards by featuring non-blocking backpressure.

Of course, you'll need some developers standing by to help, as you will with any of these reactive solutions.

Even though these platforms offer what they call "out-of-the-box" solutions, they're far from drag-and-drop.

Developers will still need to dive into the code to create a working product and connect it all together.

Achieve Reactive Relational Programming

Asynchronous reactive relational programming offers unmatched benefits when it comes to availability and performance.

Until recently, though, achieving a truly asynchronous reactive model was more than difficult, even for some of the largest development teams.

Now, thanks to platforms like these implementing reactional support and even offering primitive foundations to build upon, achieving reactivity is becoming easier.

Are you interested in learning more about reactive programming and how it can improve your databases and applications?

Do you have questions about how reactive works or whether it's right for you?

Our team of professionals can provide the answer to those and a lot more of your questions.

Contact us to learn more about taking your databases into the future of performance.

Industry insights you won’t delete. Delivered to your inbox weekly.

Other posts

Any questions for us?