Welcome!

Microservices Expo Authors: Elizabeth White, Pat Romanski, Liz McMillan, Yeshim Deniz, Zakia Bouachraoui

Related Topics: Microservices Expo

Microservices Expo: Article

SOA Patterns: Basic Structural Patterns - Part 1

Solving some of the more common issues related to services

How can an Active Service Pattern help us solve the problems mentioned earlier? As Pat Morita playing Mr. Miyagi said in "Karate Kid" - "Best defense: no be there." If you want to avoid waiting for another service, your best defense is not to get to that situation in the first place; you can actively, periodically, go and fetch data from other services to refresh your caches. You can also save other services the trouble and proactively publish your own state changes. Caching data locally can seem to induce a data duplication problem but it doesn't (see callout for details).

Caching and the Data Duplication Problem
I am sure that several of you, especially those of you with a database background, who read the suggestion to actively go and fetch and cache data from remote services, jumped out of your seats and questioned my sanity for promoting data duplication. However, the way I see it, this is not really the same data. The data that is cached in a service is that service view of the data. It can be aggregated, processed, or otherwise altered to fit the service needs. Naturally, one caveat you must keep in mind is that the service that caches the data is not the master of the data.

A thread with a timer can take care of most of the other temporal events (you can have a timer per event if you have few events or wake up every known interval, see what events needs to be handled, and process them if you have a lot of possible events).

A thread in the Edge Component(s) is a good way to deal with contract-related temporal issues (e.g., make sure we publish state on time, timeouts, etc.), while a thread on the service takes care of purely business-related concerns such as sending monthly bills or handling incoming message queues.

Let's look at how the situation shown in Figure 3 can be redesigned using the Active Service Pattern. To recap, Figure 3 shows a flow for a proposals service that needs to get external data from an internal customer service and an external publisher service to produce a pro-forma for a customer (see Figure 5). Now the Proposals service actively goes to fetch discounts on a regular basis and caches the results, thus when a request to produce a pro-forma arrives, the proposal service can immediately calculate the discount and return a reply more quickly, plus it doesn't depend on the external services to be there when the request for producing the pro-forma arrives. Using Active Service, the coupling between the proposals service and the other services are decoupled in time.

The Active Service Pattern is mostly a mindset pattern and doesn't have a lot of technological implications.

Technology Mapping
The technology mapping section usually talks about how the pattern is implemented using SOA-related technology; however, since there aren't real technological challenges in implementing the Active Service Pattern this section will be brief.

The technological idea behind the Active Service Pattern is simply to have an active thread on the service and/or the Edge Component that will provide some specific functionality that you will have to code. Basically, the Active Service Pattern relies on threading technologies that are available in any language you may want to use. The real trick is to decide what you want to do with this thread. The previous section showed some ideas for that such as caching data from other services and handling recurring reports.

The next question is when do you want to use the Active Service Pattern? Let's look at few scenarios that may make us consider this pattern.

Quality Attribute Scenarios
The quality attribute scenarios section talks about the architectural benefits of utilizing patterns from the requirements perspective. Most of the architectural requirements are described from the perspective of quality attributes (scalability, flexibility, performance, etc.) through the use of the scenarios where these attributes are manifested. The scenarios can also be used as a reference for situations where the pattern is applicable.

Active Service is the prerequisite for few other patterns such as decoupled invocation and blogjecting watchdog mentioned earlier, and those patterns help handle many quality attributes such as reliability and availability. Nevertheless, even applied alone the Active Service Pattern helps satisfy several quality attributes.

Active Service helps satisfy latency aspects by allowing data to already be available for the service to consume. It helps with deadlines by making sure that the service will perform its tasks when needed in order to meet deadlines (such as producing monthly bills on time). Another quality attribute that benefits from the Active Service Pattern is availability, since polling other services and caching their data means the service's availability is less dependent on other services availability.

Table 3 lists a few sample scenarios where the Active Service Pattern can help.

Quality Attribute (level1)

Quality Attribute (level2)

Sample Scenario

Performance

Latency

Under normal conditions evaluating the profitability of an offer will take no more than 2 seconds

Performance

Deadline

Under load and normal conditions the system can update stock prices at least twice a second

Availability

Uptime

While disconnected  from the WAN, the users can still produce quotations

The architectural scenarios that can make us consider using the Active Service pattern.

This excerpt dealt with few of the basic structuring patterns for building services: ServiceHost, which makes a common wrapper to host service instances and reuse across services, and ActiveService, which has at least one independent thread in the service so it can initiate

Resources

  • Liskov, B. Data Abstraction and Hierarch [Conference] // Proc. of OOPSLA conference.1988.
  • Anderson, R.W., and Ciruli, D. Scaling SOA with Distributed Computing [Journal] // Dr. Dobb's Journal. - 2006.

•   •   •

This article is based on the book SOA Patterns (http://www.manning.com/rotem) scheduled to print February 2009. This article is courtesy of Manning Publications (http://www.manning.com). The ebook is available and sold exclusively through Manning Publications.

More Stories By Arnon Rotem-Gal-Oz

For the past 10 years Arnon Rotem-Gal-Oz has been an architecture and system designer of large distributed systems including C4ISR systems, IP customer care and billing systems, and BI engines. He has experience with a variety of technologies (.Net, J2EE, CORBA, COM+, X-Windows) on diverse platforms (Unix, Windows, Dos, AS/400). He currently works for Rafael as the Biometric line development manager.

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.


Microservices Articles
Using new techniques of information modeling, indexing, and processing, new cloud-based systems can support cloud-based workloads previously not possible for high-throughput insurance, banking, and case-based applications. In his session at 18th Cloud Expo, John Newton, CTO, Founder and Chairman of Alfresco, described how to scale cloud-based content management repositories to store, manage, and retrieve billions of documents and related information with fast and linear scalability. He addresse...
Containers and Kubernetes allow for code portability across on-premise VMs, bare metal, or multiple cloud provider environments. Yet, despite this portability promise, developers may include configuration and application definitions that constrain or even eliminate application portability. In this session we'll describe best practices for "configuration as code" in a Kubernetes environment. We will demonstrate how a properly constructed containerized app can be deployed to both Amazon and Azure ...
SYS-CON Events announced today that DatacenterDynamics has been named “Media Sponsor” of SYS-CON's 18th International Cloud Expo, which will take place on June 7–9, 2016, at the Javits Center in New York City, NY. DatacenterDynamics is a brand of DCD Group, a global B2B media and publishing company that develops products to help senior professionals in the world's most ICT dependent organizations make risk-based infrastructure and capacity decisions.
Most DevOps journeys involve several phases of maturity. Research shows that the inflection point where organizations begin to see maximum value is when they implement tight integration deploying their code to their infrastructure. Success at this level is the last barrier to at-will deployment. Storage, for instance, is more capable than where we read and write data. In his session at @DevOpsSummit at 20th Cloud Expo, Josh Atwell, a Developer Advocate for NetApp, will discuss the role and value...
DevOpsSummit New York 2018, colocated with CloudEXPO | DXWorldEXPO New York 2018 will be held November 11-13, 2018, in New York City. Digital Transformation (DX) is a major focus with the introduction of DXWorldEXPO within the program. Successful transformation requires a laser focus on being data-driven and on using all the tools available that enable transformation if they plan to survive over the long term.
CloudEXPO New York 2018, colocated with DXWorldEXPO New York 2018 will be held November 11-13, 2018, in New York City and will bring together Cloud Computing, FinTech and Blockchain, Digital Transformation, Big Data, Internet of Things, DevOps, AI, Machine Learning and WebRTC to one location.
Enterprise architects are increasingly adopting multi-cloud strategies as they seek to utilize existing data center assets, leverage the advantages of cloud computing and avoid cloud vendor lock-in. This requires a globally aware traffic management strategy that can monitor infrastructure health across data centers and end-user experience globally, while responding to control changes and system specification at the speed of today’s DevOps teams. In his session at 20th Cloud Expo, Josh Gray, Chie...
Adding public cloud resources to an existing application can be a daunting process. The tools that you currently use to manage the software and hardware outside the cloud aren’t always the best tools to efficiently grow into the cloud. All of the major configuration management tools have cloud orchestration plugins that can be leveraged, but there are also cloud-native tools that can dramatically improve the efficiency of managing your application lifecycle. In his session at 18th Cloud Expo, ...
Discussions of cloud computing have evolved in recent years from a focus on specific types of cloud, to a world of hybrid cloud, and to a world dominated by the APIs that make today's multi-cloud environments and hybrid clouds possible. In this Power Panel at 17th Cloud Expo, moderated by Conference Chair Roger Strukhoff, panelists addressed the importance of customers being able to use the specific technologies they need, through environments and ecosystems that expose their APIs to make true ...
In his session at 20th Cloud Expo, Mike Johnston, an infrastructure engineer at Supergiant.io, discussed how to use Kubernetes to set up a SaaS infrastructure for your business. Mike Johnston is an infrastructure engineer at Supergiant.io with over 12 years of experience designing, deploying, and maintaining server and workstation infrastructure at all scales. He has experience with brick and mortar data centers as well as cloud providers like Digital Ocean, Amazon Web Services, and Rackspace. H...