13
Four Key Technologies That Enable Microservices

Four Key Technologies That Enable Microservices · Microservices-powered applications, after all, don’t necessarily share the same data persistence layer; each microservice can

  • Upload
    others

  • View
    19

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Four Key Technologies That Enable Microservices · Microservices-powered applications, after all, don’t necessarily share the same data persistence layer; each microservice can

Four Key Technologies That Enable Microservices

Page 2: Four Key Technologies That Enable Microservices · Microservices-powered applications, after all, don’t necessarily share the same data persistence layer; each microservice can

E B O O K | F O U R K E Y T E C H N O L O G I E S T H AT E N A B L E M I C R O S E R V I C E S

2

Microservices The New “Now”?

Enterprises that build powerful, modern applications are increasingly using microservices to design their products.

In the past, companies would build monolithic software solutions, meaning every feature within an application was combined into a single program. In the event a small component of a software system needed to be changed, developers would essentially have to rebuild the entire application.

In the age of fast networks, connected devices, and cloud computing, no company has that much time to spare. One buggy feature could potentially frustrate countless users and slow productivity to a halt for an extended period of time.

To solve this problem, a new kind of software architecture has emerged in recent years: microservices.

Very basically, microservices enable developers to create powerful applications by building several small, distinct services and linking them all together into one cohesive whole. This way, if a single microservice fails, the rest of the application operates as designed. Engineering teams would only have to focus on fixing the failing microservice to bring it back online—instead of having to troubleshoot or rebuild an entire application.

Because of these benefits, it comes as no surprise that microservices adoption has grown considerably over the last few years. One study, for example, found that 91% of senior development stakeholders currently have plans to use microservices while 92% said they added more microservices to their software suites over the last 12 months.

Page 3: Four Key Technologies That Enable Microservices · Microservices-powered applications, after all, don’t necessarily share the same data persistence layer; each microservice can

E B O O K | F O U R K E Y T E C H N O L O G I E S T H AT E N A B L E M I C R O S E R V I C E S

3

Microservices The New “Now”?(Cont.)

If you’re wondering how microservices work, you’ve come to the right place. In this ebook, we will explore four key technologies that support microservices architecture and, as a result, enable organizations to build transformative applications that power the modern world:

1. Saga2. Command Query Responsibility Segregation (CQRS)3. Hybrid cloud4. Containerization

Page 4: Four Key Technologies That Enable Microservices · Microservices-powered applications, after all, don’t necessarily share the same data persistence layer; each microservice can

E B O O K | F O U R K E Y T E C H N O L O G I E S T H AT E N A B L E M I C R O S E R V I C E S

4

SagaApplications are driven by transactions. You update information in your CRM, you post a status update to Twitter, and you add an item into your shopping cart on Amazon.

Historically, most transactions consisted of two-phase commits. Action A is performed automatically when Action B is completed.

In the age of microservices, however, things are no longer as simple. While traditional relational databases still perform several functions very well, these systems were not designed for a world increasingly driven by microservices. In relational databases, two-phase commits are handled at the database tier; and if you want to enforce atomicity or isolation constraints across microservices, you can't do it at the database tier because two parts of your transaction might have different databases. That’s why more and more businesses are opting to power their applications with NoSQL databases as transactional complexity increases across several small services.

But in an age of increasingly complex transactions where ACID properties are no longer feasible for many use cases, how exactly can you ensure that users all have access to the most current data? Microservices-powered applications, after all, don’t necessarily share the same data persistence layer; each microservice can have its own.

One solution to this problem is called saga, a specific sequence of transactions that can be used to ensure data consistency across distributed microservices-powered applications that can’t rely on traditional ACID transactions.

Page 5: Four Key Technologies That Enable Microservices · Microservices-powered applications, after all, don’t necessarily share the same data persistence layer; each microservice can

E B O O K | F O U R K E Y T E C H N O L O G I E S T H AT E N A B L E M I C R O S E R V I C E S

5

Saga(Cont.)

Though saga is a database concept that was introduced in the 1980s, it’s becoming increasingly relevant in the age of microservices. Thanks to saga, each microservice is responsible for completing a local transaction and then notifying other services whether a task has been completed successfully. Saga transactions are either facilitated by choreography, where each service listens to other services, or by orchestration, where a service coordinates each saga sequencing process.

Service 1 Service 2 Service 3

Local Transaction

Service 1

Local Transaction

Service 2

Local Transaction

Service 3

Distributed Transaction

Saga

Essentially, saga, with a rollback mechanism, ensures that transactions either successfully go through in sequential order or, in the event the transaction fails, the application returns to its previous state before the transaction was executed.

This supports eventual data consistency across microservices-powered applications, ensuring users have access to contextual, up-to-date information from all over the world.

Page 6: Four Key Technologies That Enable Microservices · Microservices-powered applications, after all, don’t necessarily share the same data persistence layer; each microservice can

E B O O K | F O U R K E Y T E C H N O L O G I E S T H AT E N A B L E M I C R O S E R V I C E S

6

Command Query Responsibility Segregation (CQRS)

Historically, read and write requests were performed by the same application service through a CRUD (create, read, update, and delete) model. While that might have worked well enough in the past, today’s most demanding applications process significantly more concurrent requests. In scalable, high-performance environments, having a single application service handling commands and queries is no longer an effective approach.

Microservices architecture further compounds this issue, as joining data from multiple services can be quite complex. To facilitate data retrieval and transmission across several microservices, the concept of command query responsibility segregation (CQRS) has emerged.

The theory behind CQRS is simple. Instead of relying on a single service to perform read and write requests, you rely on a standalone command service to modify the data and a standalone query service to retrieve the data. Commands change system states without returning data, and queries return data without changing system states. By using two separate services to process these requests, developers can simplify their design and reduce the overall complexity of their applications, increasing performance.

CQRS enables you to scale individual services as needed (e.g., if you’re performing an exponential amount of write requests and not many read requests, you could scale the command service accordingly). It also allows you to leverage several different databases. For example, you might use Apache Cassandra™ to handle write requests and ensure data consistency, and you might use Elasticsearch to run queries.

Page 7: Four Key Technologies That Enable Microservices · Microservices-powered applications, after all, don’t necessarily share the same data persistence layer; each microservice can

E B O O K | F O U R K E Y T E C H N O L O G I E S T H AT E N A B L E M I C R O S E R V I C E S

7

Command Query Responsibility Segregation (CQRS) (Cont.)

CQRS supports the concept of eventual consistency, which suggests that data might not always be consistent, but it will eventually be replicated across a distributed application. The command service is in charge of persistence, and the query service follows along.

Commands

Read Side subscribes to theWrite Side’s Event streamsEvents

UpdatedState

User Interface

Write Side

ApplicationState

CommandHandler

EventHandler

Read Side

Read-SideProcessor

Query Result/Data

Event Sourcing and CQRS

Eventspersisted

Readdatastoreupdated

WriteStore

ReadStore

Source

Page 8: Four Key Technologies That Enable Microservices · Microservices-powered applications, after all, don’t necessarily share the same data persistence layer; each microservice can

E B O O K | F O U R K E Y T E C H N O L O G I E S T H AT E N A B L E M I C R O S E R V I C E S

8

Hybrid CloudTraditionally, businesses built monolithic applications and shipped them every now and again (e.g., maybe once a year). When the market changed, companies would have to reinvent the wheel and essentially rebuild and redesign these applications in what was a time-consuming and expensive endeavor.

Today’s businesses require far more agility, and that’s why they’re increasingly turning to microservices, which are best suited to live in hybrid and multi-cloud environments.

Shipping updates quickly is much easier when workloads take place in the cloud. The cloud also offers elasticity (you may need three servers to handle your load most of the time but 30 servers to handle your peak load once a month) and on-demand scalability (spin up all your servers in a matter of minutes instead of spending six months ordering hardware, finding room on the data center floor, getting power, going through procurement, etc. …).

Thanks to the cloud, companies can deploy software frequently and in little time, enabling them to iterate much faster and, ultimately, build better products. In the cloud, it’s also easier to build architecture that enables data to flow from one service to another, without interruption, further improving performance.

Together, the speed of release and ease of use delivered by cloud environments accelerates innovation and helps deliver more engaging and productive software experiences.

Page 9: Four Key Technologies That Enable Microservices · Microservices-powered applications, after all, don’t necessarily share the same data persistence layer; each microservice can

E B O O K | F O U R K E Y T E C H N O L O G I E S T H AT E N A B L E M I C R O S E R V I C E S

9

Hybrid Cloud(Cont.)

Further, when microservices are hosted in the cloud, developers can take a plug-and-play approach to see whether individual services are working or whether they should be updated. Whenever problems emerge, developers can zero in on a single microservice and resolve the issue. They can also add a new microservice to the mix to test it out and remove it if it’s not what they had hoped for. All of these changes are rapid thanks to the cloud.

Add it all up, and it comes as no surprise that industry watchers expect 83% of workloads will take place in the cloud by 2020. Of those workloads, 22% will take place in hybrid cloud environments, which deliver the benefits of the public cloud (cost savings, availability, and scalability) while still enabling organizations to secure their most sensitive data in their own data centers. This is what today’s leading companies require; altogether, 81% of enterprises have a multi-cloud strategy.

Page 10: Four Key Technologies That Enable Microservices · Microservices-powered applications, after all, don’t necessarily share the same data persistence layer; each microservice can

E B O O K | F O U R K E Y T E C H N O L O G I E S T H AT E N A B L E M I C R O S E R V I C E S

10

ContainerizationAt some point or another, you’ve probably seen shipping containers stacked on top of shipping containers stacked on top of shipping containers. Since shipping containers are standardized, they can seamlessly move from ships to trains to trucks regardless of what’s inside of them.

Imagine how inefficient the shipping industry would be if the major players never agreed on a standardized container size.

In the digital world, containers take server virtualization (i.e., virtual machines, hypervisors, VMware, etc.) a step further to enable companies to build powerful enterprise applications with fewer resources. Like shipping containers, software containers represent standardized software packages that contain all the elements needed to run an application in isolation.

In other words, containers make microservices easy.

Whereas microservices refer to the software architecture, containers are the mechanism that delivers the app itself through operating system virtualization. Leading developers encourage their peers to run microservices on containerization platforms like Docker because containers enable them to easily move their software from their desktop to a staging environment to production on both physical or virtual machines.

Source

Page 11: Four Key Technologies That Enable Microservices · Microservices-powered applications, after all, don’t necessarily share the same data persistence layer; each microservice can

E B O O K | F O U R K E Y T E C H N O L O G I E S T H AT E N A B L E M I C R O S E R V I C E S

11

Containerization(Cont.)

Engineers who develop with containers can abstract applications into image format, which allows them to easily deploy microservices across any cloud environment. This portability is a critical feature for agile DevOps teams that require flexibility and need to ship updates quickly and frequently. As such, containerization is the perfect packaging mechanism for the hybrid cloud, since developers can seamlessly move their containers from one environment to the next as they wish.

Software development companies are increasingly using containers to build their applications, since containers make it easy to start, stop, extend, share, and reuse software images in any environment. In fact, a recent IBM study revealed that container usage in production workloads will increase from 25% to 44% over the next three years, as companies continue to migrate to hybrid cloud environments. Similarly, Gartner predicts that 50% of organizations will use containers by 2020.

A separate IBM report highlights exactly why this is. Organizations that adopt container development enjoy a number of benefits:

N 59% of organizations using containers report an improvement in the quality of their software thanks to fewer defects

N 57% experience less downtime and a reduction in associated costs N 54% of organizations report an uptick in employee productivity thanks to containerization N 53% of companies say containers enable them to respond faster to market changes N 51% experience greater levels of innovation with container development N 50% of organizations enjoy lower operational costs thanks to containers

Bottom line? Organizations that wish to build transformative microservices-powered applications in a cost-effective and resourceful way need to use containers. It’s that simple.

Page 12: Four Key Technologies That Enable Microservices · Microservices-powered applications, after all, don’t necessarily share the same data persistence layer; each microservice can

E B O O K | F O U R K E Y T E C H N O L O G I E S T H AT E N A B L E M I C R O S E R V I C E S

12

DataStaxThe DistributedDatabase forMicroservices

If your organization builds high-performance, scalable applications that are distributed, you are probably already working with microservices. And by the off chance that you’re not, it’s only a matter of time before you move to the modern approach to software development.

Unlocking the full power of microservices starts with having an agile and powerful database that embraces the eventual consistency model needed for sagas; serves as the data store for CQRS-based services; is the only data store that can effectively work across multiple cloud providers to enable hybrid cloud deployments; and can handle the scale and concurrency requirements of containerized applications.

We may be a bit biased, but we believe DataStax Enterprise (DSE) is the perfect tool for the job. Our platform enables organizations to scale and deploy applications across all cloud environments without having to rebuild their applications or even change them.

With DSE, your applications are available everywhere, always, on any device, and from any location. It’s the easiest way to use microservices to build applications that help your team reach peak productivity and ensure your customers enjoy superior experiences every time.

Get started with DataStax here.

Page 13: Four Key Technologies That Enable Microservices · Microservices-powered applications, after all, don’t necessarily share the same data persistence layer; each microservice can

E B O O K | F O U R K E Y T E C H N O L O G I E S T H AT E N A B L E M I C R O S E R V I C E S

13

About DataStax

DataStax delivers the always-on, active everywhere distributed hybrid cloud database built on Apache Cassandra™. The foundation for personalized, real-time applications at scale, DataStax Enterprise makes it easy for enterprises to exploit hybrid and multi-cloud environments via a seamless data layer that eliminates the issues that typically come with deploying applications across multiple on-premises data centers and/or multiple public clouds.

Our product also gives businesses full data visibility, portability, and control, allowing them to retain strategic ownership of their most valuable asset in a hybrid/multi cloud world. We help many of the world’s leading brands across industries transform their businesses through an enterprise data layer that eliminates data silos and cloud vendor lock-in while powering modern, mission-critical applications. For more information, visit www.DataStax.com and follow us on Twitter @DataStax.

© 2019 DataStax, All Rights Reserved. DataStax, Titan, and TitanDB are registered trademarks of DataStax, Inc. and its subsidiaries in the United States and/or other countries.

Apache, Apache Cassandra, Cassandra, Apache Tomcat, Tomcat, Apache Lucene, Lucene, Apache Solr, Apache Hadoop, Hadoop, Apache Spark, Spark, Apache TinkerPop, TinkerPop, Apache Kafka, and Kafka are either registered trademarks or trademarks of the Apache Software Foundation or its subsidiaries in Canada, the United States, and/or other countries.

Last Rev - June 2019