Book Image

Persistence Best Practices for Java Applications

By : Otavio Santana, Karina Varela
Book Image

Persistence Best Practices for Java Applications

By: Otavio Santana, Karina Varela

Overview of this book

Having a solid software architecture breathes life into tech solutions. In the early stages of an application’s development, critical decisions need to be made, such as whether to go for microservices, a monolithic architecture, the event-driven approach, or containerization. In Java contexts, frameworks and runtimes also need to be defi ned. But one aspect is often overlooked – the persistence layer – which plays a vital role similar to that of data stores in modern cloud-native solutions. To optimize applications and data stores, a holistic understanding of best practices, technologies, and existing approaches is crucial. This book presents well-established patterns and standards that can be used in Java solutions, with valuable insights into the pros and cons of trending technologies and frameworks used in cloud-native microservices, alongside good Java coding practices. As you progress, you’ll confront the challenges of cloud adoption head-on, particularly those tied to the growing need for cost reduction through stack modernization. Within these pages, you’ll discover application modernization strategies and learn how enterprise data integration patterns and event-driven architectures enable smooth modernization processes with low-to-zero impact on the existing legacy stack.
Table of Contents (18 chapters)
1
Part 1: Persistence in Cloud Computing – Storing and Managing Data in Modern Software Architecture
6
Part 2: Jakarta EE, MicroProfile, Modern Persistence Technologies, and Their Trade-Offs
9
Chapter 7: The Missing Guide for jOOQ Adoption
11
Part 3: Architectural Perspective over Persistence

The cloud’s effect on stateful solutions

When it comes to databases, professionals need to have an operational perspective in addition to an infrastructure and software architecture perspective. There are several factors to consider regarding a solution’s architecture and the required compliance, such as networking, security, cloud backup, and upgrades.

Fortunately, we can use the help of cloud services. The cloud, as a technology-related concept, has been defined by the National Institute of Standards and Technology (NIST) as a model that enables the consumption, on-demand and via a network, of a shared set of computing resources that are rapidly made available.

You might have heard a joke in tech communities that says that “the cloud is just somebody else’s computer.” However, we believe there’s more to the cloud than that; we prefer to look at the cloud as follows:

The cloud is somebody else’s problem.

The main goal of adopting cloud services is to outsource non-core business functions to somebody else. This way, we can focus on our core competencies.

Tip

As you read through the book, you’ll notice several acronyms are used. In this chapter, we mostly refer to the following cloud service offering types: Infrastructure as a Service (IaaS), Platform as a Service (PaaS), and Software as a Service (SaaS).

Even though you might feel like cloud services could finally be the solution to numerous technical problems you’ve gone through, remember that delegated responsibilities and tasks also have chances of going very differently from what you expected – for example, services crashing or costs skyrocketing. Since we’re discussing the action of “delegating a problem to somebody else,” here are three types of cloud services (three ways to “delegate”) and their respective target audiences:

  • IaaS: Infrastructure is not your problem. The target audience is people who work on the operation side, such as SREs.
  • PaaS: The infrastructure and operation are not your problems. The main target audience is software engineers.
  • SaaS: The infrastructure, operation, and software are not your problem. In this case, the target audience is the end user, who doesn’t necessarily know how to code.

As we previously pointed out in this chapter, every solution’s trade-offs must be considered. Picking the PaaS cloud offering as an example: this model offers a higher level of abstraction in exchange for a bit of a higher price tag.

What about cloud offerings for data storage, then? As pointed out by Dan More in the book 97 Things Every Cloud Engineer Should Know (https://www.amazon.com/dp/1492076732), databases can also be used as managed cloud services. Looking at a managed database service, you could consider that someone else (a vendor) will provide a service to abstract most of (and in some cases, all of) the database infrastructure and management tasks.

Database as a Service (DBaaS) is a popular type of cloud service that allows users to choose from a variety of database flavors, running in multiple regions and managed by different cloud providers.

Cloud services can be helpful when we need to explore various architectural persistence solutions and delegate complexity. They have been widely adopted and proven to be effective in serving this purpose.

With cloud offerings and microservices architecture adoption, distributed solutions are becoming more prevalent. Architects then have to handle new challenges related to data integrity and unexpected occurrences of inconsistency in data in applications that must meet such requirements.