<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Microservices Architecture Archives - Artificial Intelligence</title>
	<atom:link href="https://www.aiuniverse.xyz/tag/microservices-architecture/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.aiuniverse.xyz/tag/microservices-architecture/</link>
	<description>Exploring the universe of Intelligence</description>
	<lastBuildDate>Tue, 12 Dec 2017 06:39:41 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.2</generator>
	<item>
		<title>What is a Helm Chart and how can it improve microservices?</title>
		<link>https://www.aiuniverse.xyz/what-is-a-helm-chart-and-how-can-it-improve-microservices/</link>
					<comments>https://www.aiuniverse.xyz/what-is-a-helm-chart-and-how-can-it-improve-microservices/#comments</comments>
		
		<dc:creator><![CDATA[aiuniverse]]></dc:creator>
		<pubDate>Tue, 12 Dec 2017 06:39:41 +0000</pubDate>
				<category><![CDATA[Microservices]]></category>
		<category><![CDATA[developing applications]]></category>
		<category><![CDATA[Kubernetes]]></category>
		<category><![CDATA[Microservices Architecture]]></category>
		<guid isPermaLink="false">http://www.aiuniverse.xyz/?p=1870</guid>

					<description><![CDATA[<p>Source  &#8211; techtarget.com What is Helm, and what is a Helm Chart? Helm is the package manager for Kubernetes &#8212; in other words, it is used to help <a class="read-more-link" href="https://www.aiuniverse.xyz/what-is-a-helm-chart-and-how-can-it-improve-microservices/">Read More</a></p>
<p>The post <a href="https://www.aiuniverse.xyz/what-is-a-helm-chart-and-how-can-it-improve-microservices/">What is a Helm Chart and how can it improve microservices?</a> appeared first on <a href="https://www.aiuniverse.xyz">Artificial Intelligence</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Source  &#8211; techtarget.com</p>
<p>What is Helm, and what is a Helm Chart? Helm is the package manager for Kubernetes &#8212; in other words, it is used to help you manage Kubernetes applications. Helm Charts allow you to define, install and configure your Kubernetes application. Kubernetes is an open source system, which allows you to automate, deploy, scale and otherwise manage applications. The charts are easy to create, share and publish, which makes them so popular. A chart is a collection of files that describe a set of Kubernetes resources. One chart can be used to deploy something very simple or a full web application stack with HTTP servers and databases.</p>
<p>Have I confused you yet? Have you used Yellowdog Updater, Modified (YUM) before? Helm is analogous to YUM. Have you used Red Hat Package Manager (RPM) files before? Helm Charts are packages, which are analogous to RPMs. The home for the Helm Charts are the Kubernetes manifests, which provide the configuration parameters allowing users to customize their deployment. The latest version of Helm is actually maintained by the Cloud Native Computing Foundation, in collaboration with Microsoft, Google, Bitnami and the greater community.</p>
<section class="section main-article-chapter" data-menu-title="The Helm Chart and microservices">
<h3 class="section-title"><i class="icon" data-icon="1"></i>The Helm Chart and microservices</h3>
<p>What about microservices? The microservices approach is to develop a single application as a suite of small services, each of which runs its own process &#8212; through which it can communicate with lightweight mechanisms, which are usually some kind of HTTP resource API. The services themselves are built around business capabilities and deployed by automated tools. The architecture itself is a method of developing applications from the suite of smaller services. Really, we&#8217;re talking about a paradigm for software architecture &#8212; small services in separated processes that take the place of larger applications. Using this approach, systems are easier to scale and can evolve more easily.</p>
<p>Now that we&#8217;ve defined the Helm Chart and microservices, how are they used to complement one another? The very nature of the Helm Chart lends itself to improving microservices builds. It is very modular and allows one to deploy small services. On the other side of the coin, new problems are created. Problems that need to be solved only once for large, complex applications &#8212; like monitoring, load balancing and even security now need to be handled for each service.</p>
<p>Kubernetes supports microservices architecture through its service construct. Let&#8217;s look at lstio, which is an open platform to connect, manage and secure microservices. You can use the Helm Chart from Kubernetes to deploy lstio in order to start the framework component. Through the use of Istio, developers can implement the core logic for the microservices. The current release of lstio is targeted to Kubernetes users and is packaged in such a way that you can install it in just a few lines and get everything you need &#8212; resiliency, security and control of your microservices through Kubernetes and the use of its Helm Charts &#8212; directly out of the box. If you want to deploy microservices architecture and use Kubernetes, then lstio is a natural fit for you. It does all this without requiring any changes to the microservices code; it supports the traffic flow between the services. Using the Helm package manager, through its Helm Charts, you can put in place your lstio deployment on a Kubernetes cluster with just a few easy steps.</p>
<p>It should also not surprise you that you can use Kubernetes on an IBM Bluemix container service, which will help you speed up deployment. The Helm Charts help you accomplish this, because they have the templates required to apply the Kubernetes configuration files, allowing you to build, package, distribute and deploy your microservices applications.</p>
<p>If you are newbie in the world of Kubernetes and Helm Charts, there is a tremendous amount of information out there to help you understand what you need to know. Make sure you really understand what it is you want to accomplish before you start to create your new architecture. Make certain this is the right product for you.</p>
<p>&nbsp;</p>
</section>
<p>The post <a href="https://www.aiuniverse.xyz/what-is-a-helm-chart-and-how-can-it-improve-microservices/">What is a Helm Chart and how can it improve microservices?</a> appeared first on <a href="https://www.aiuniverse.xyz">Artificial Intelligence</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.aiuniverse.xyz/what-is-a-helm-chart-and-how-can-it-improve-microservices/feed/</wfw:commentRss>
			<slash:comments>7</slash:comments>
		
		
			</item>
		<item>
		<title>The Future of Microservices Monitoring &#038; Instrumentation</title>
		<link>https://www.aiuniverse.xyz/the-future-of-microservices-monitoring-instrumentation/</link>
					<comments>https://www.aiuniverse.xyz/the-future-of-microservices-monitoring-instrumentation/#comments</comments>
		
		<dc:creator><![CDATA[aiuniverse]]></dc:creator>
		<pubDate>Thu, 12 Oct 2017 06:33:54 +0000</pubDate>
				<category><![CDATA[Microservices]]></category>
		<category><![CDATA[Microservices Architecture]]></category>
		<category><![CDATA[Microservices Instrumentation]]></category>
		<category><![CDATA[Microservices Monitoring]]></category>
		<guid isPermaLink="false">http://www.aiuniverse.xyz/?p=1459</guid>

					<description><![CDATA[<p>Source &#8211; risingstack.com Monitoring gives us observability in our system and helps us to discover, understand, and address issues to minimize their impact on the business. It’s clear <a class="read-more-link" href="https://www.aiuniverse.xyz/the-future-of-microservices-monitoring-instrumentation/">Read More</a></p>
<p>The post <a href="https://www.aiuniverse.xyz/the-future-of-microservices-monitoring-instrumentation/">The Future of Microservices Monitoring &#038; Instrumentation</a> appeared first on <a href="https://www.aiuniverse.xyz">Artificial Intelligence</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Source &#8211; <strong>risingstack.com</strong></p>
<p>Monitoring gives us observability in our system and helps us to discover, understand, and address issues to minimize their impact on the business. It’s clear then, why you should aim for the best solutions out there; especially when you build a microservices architecture that has brought up new challenges in regards to observability.</p>
<p>The future of microservices monitoring depends on what kind of solutions become standardized in the industry and what new features will we see in the future that will make your applications much better. <strong>In this article I theorize what are these new monitoring features and what can we expect in 2018.</strong></p>
<h2 id="microservicesmonitoringandinstrumentation">Microservices Monitoring and Instrumentation</h2>
<p>To collect and analyze monitoring data, first, you need to extract metrics from your system &#8211; like the Memory usage of a particular application instance. The type of monitoring that provides details about the internal state of your application is called white-box monitoring, and the metrics extraction process is called instrumentation.</p>
<p>Current APM (Application Performance Monitoring) solutions on the market like NewRelic and Dynatrace rely heavily on different levels of instrumentations, this is why you have to install vendor specific agents to collect metrics into these products.</p>
<p>Agents can instrument your application at various places. They can extract low-level language specific metrics like Garbage Collector behavior or library specific things like RPC and database latencies as well.</p>
<p>Keep in mind that instrumentations can be very specific and usually need expertise and development time. As instrumentations are part of the running code, a bad instrumentation can introduce bugs into your system or generate an unreasonable performance overhead.</p>
<p>Instrumenting your system can also produce extra lines of code and bloat your application&#8217;s codebase.</p>
<h2 id="theagentworldofapmvendors">The Agent World of APM Vendors</h2>
<p>We discussed earlier that current APM solutions provide agents to instrument our application and collect metrics. Creating and maintaining these agents need a lot of effort from the APM vendors side as they have to support multiple versions of languages and libraries that their customers use.</p>
<p>They need to continuously run tests against these different versions and benchmark their performance overhead to ensure that they won’t introduce any bug into the instrumented application.</p>
<p>If you check out collector agents from multiple APM vendors, you will realize that they are very similar from an implementation point of view. These companies put a tremendous amount of work to create the best agent for their customers while they reimplement the same thing and maintain their agent separately.</p>
<p>Having vendor specific agents can also lead to a situation when developers start to use multiple monitoring solutions and agents together as they miss some features from their current APM solution. Multiple agents usually mean multiple instrumentations on the same code piece, which can lead to an unnecessary performance overhead, false metrics or even bugs.</p>
<p>I think that the trend of using vendor-specific agents will change in the future and APM providers will join their efforts to create an open standard for instrumenting code. The future could lead to an era where agents are vendor-neutral, and all values will come from different backend and UI features.</p>
<h2 id="containersandmicroserviceschangethegame">Containers and Microservices Change the Game</h2>
<p><strong>Latest technology and architecture trends like containerization and microservices changed the way we write and run our applications.</strong></p>
<p>The new era of these highly dynamic distributed systems brought new challenges to the art of observability. To monitor and debug these architectures, we need a new set of tools that are capable of storing and querying a large amount of multidimensional metrics series from different services and are also able to discover issues in microservices.</p>
<p><strong>One of the new debugging methodologies is distributed tracing.</strong> It propagates transactions from distributed services and gains information from cross-process communication. To be able to track operations between applications, our instrumentation needs to share contextual information (like transaction ID’s) between processes in a standardized way. For example, when we create an RPC request to another service, it should share certain tracing information in meta headers to enable reverse engineering the transaction later.</p>
<p>With this kind of context sharing on the instrumentation level we can follow a request across the whole system; from the client through the underlying backend systems, network components, and databases. This kind of observability makes debugging in distributed systems, such as microservices, much easier. However, the popularity of microservices architectures is growing rapidly, distributed tracing is still in its early ages. Enterprise companies just started to evaluate the technology and discover its capabilities. We can expect an increasing amount of distributed tracing solutions in 2018 by early adopter companies.</p>
<p><img decoding="async" src="https://blog.risingstack.com/content/images/2017/10/distributed-tracing-visualized.png" alt="distributed-tracing-visualized" /></p>
<p><center><i>Distributed tracing visualized</i></center></p>
<h2 id="newinstrumentationstandardsopentracing">New Instrumentation Standards: OpenTracing</h2>
<p>In the previous sections, we discussed that an optimal instrumentation should have a vendor-neutral standardized interface with cross-process context sharing capabilities and only a minimal performance impact.</p>
<p>This is the challenge that OpenTracing wants to address with providing a standard, vendor-neutral interface for distributed tracing instrumentations. OpenTracing provides a standard API to instrument your code and connects it with different tracing backends. It also makes it possible to instrument your code once and change the Tracing backend without trouble anytime.</p>
<p>Check out the following code snippet to understand OpenTracing’s approach to standardized instrumentation:</p>
<pre><code class="hljs javascript"><span class="hljs-keyword">const</span> server = http.createServer(<span class="hljs-function">(<span class="hljs-params">req, res</span>) =&gt;</span> {
  <span class="hljs-keyword">const</span> requestSpan = tracer.startSpan(<span class="hljs-string">'http_request'</span>, {
    <span class="hljs-attr">childOf</span>: tracer.extract(FORMAT_HTTP_HEADERS, req.headers)
  })
  <span class="hljs-keyword">const</span> headers = {}

  metricsTracer.inject(requestSpan, FORMAT_HTTP_HEADERS, headers)

  requestSpan.setTag(Tags.HTTP_URL, req.url)
  requestSpan.setTag(Tags.HTTP_METHOD, req.method || <span class="hljs-string">'GET'</span>)
  requestSpan.setTag(Tags.HTTP_STATUS_CODE, <span class="hljs-number">200</span>)
  requestSpan.setTag(Tags.SPAN_KIND_RPC_CLIENT, <span class="hljs-literal">true</span>)

  <span class="hljs-keyword">const</span> childOperationSpan = tracer.startSpan(<span class="hljs-string">'my_operation'</span>, {
    <span class="hljs-attr">childOf</span>: requestSpan
  })
  childOperationSpan.finish()

  res.writeHead(<span class="hljs-number">200</span>, headers)
  res.end(<span class="hljs-string">'Ok'</span>)
  requestSpan.finish()
})
</code></pre>
<p><center><i>OpenTracing example in Node.js</i></center></p>
<h3 id="nodejsopentracinginstrumentation">Node.js OpenTracing Instrumentation</h3>
<p>In certain languages, such as Node.js, it’s also possible to do the instrumentation automatically via the OpenTracing API. In this case, you only need to specify which backends you want to use to collect metrics. The helper library will instrument your code and call the standard Tracer API for the necessary events, for example when an HTTP request or database call happens.</p>
<p>The following code demonstrates how you can use multiple OpenTracing compatible Tracer backends with automatic instrumentation:</p>
<pre><code class="hljs javascript"><span class="hljs-keyword">const</span> Instrument = <span class="hljs-built_in">require</span>(<span class="hljs-string">'@risingstack/opentracing-auto'</span>)
<span class="hljs-keyword">const</span> Tracer1 = <span class="hljs-built_in">require</span>(<span class="hljs-string">'tracer-1'</span>)
<span class="hljs-keyword">const</span> Tracer1 = <span class="hljs-built_in">require</span>(<span class="hljs-string">'tracer-2'</span>)
<span class="hljs-keyword">const</span> tracer1 = <span class="hljs-keyword">new</span> Tracer1()
<span class="hljs-keyword">const</span> tracer2 = <span class="hljs-keyword">new</span> Tracer2()

<span class="hljs-keyword">const</span> instrument = <span class="hljs-keyword">new</span> Instrument({
  <span class="hljs-attr">tracers</span>: [tracer1, tracer2]
})
</code></pre>
<p><center><i>Using multiple OpenTracing Tracers with automatic instrumentation via opentracing-auto</i></center>As you can see, OpenTracing is a great first step to standardize instrumentation, but it requires a wider adoption to turn into the go-to monitoring solution. As it’s part of the Cloud Native Computing Foundation, we can expect some changes regarding its popularity in the upcoming months.</p>
<p>The future of standardized instrumentation also means that maintainers of open-source libraries and service providers can ship their solutions with built-in instrumentation. As they know the best how their libraries work and they have ownership of their internal behavior, this would be the optimal and the most risk-free solution.</p>
<p><strong>I expect more and more standardized solutions for instrumentation in the future, and I hope one day all of the APM providers will work together to provide the best vendor-neutral agent.</strong> In this scenario, they will compete in who can provide the most insight and value on their backend and UI.</p>
<h2 id="theonemicroservicesinstrumentation">The One Microservices Instrumentation</h2>
<p>OpenTracing is born to provide a vendor-neutral standard instrumentation for distributed tracing solutions, but it doesn’t mean that we cannot extract other kinds of information, like time-series metrics or error logs from it.</p>
<p>For example, by writing an OpenTracing compatible Tracer that calculates operation durations, we can measure request latency, throughput, and dependencies that can be consumed by monitoring solutions, like Prometheus. By collecting spans <em>(events)</em> with <code>error</code> flags to Elasticsearch or a similar storage, we can have an error tracker with only one instrumentation and multiple Tracer backends. In this way, we don’t have to double instrument our code per use-cases and deal with the performance overhead.</p>
<p>As OpenTracing also provides context about cross-process communications, we can use it to measure distributed operations in our system. For example, we can detect the throughput between two services, and we can also differentiate the metrics of traffic that comes from various sources.</p>
<p>Check out the following request throughout the metrics exported by OpenTracing to Prometheus. It contains the initiator <em>parent_service</em> label which we could determinate by the cross-process context sharing. The <em>unknown</em> value means that the source is not instrumented <em>(in our case it’s the Prometheus scraper job that calls our service <code>GET /metrics</code> endpoint every 5 seconds)</em>:</p>
<pre><code class="hljs bash">Element
Value
{parent_service=<span class="hljs-string">"my-server-1"</span>,service=<span class="hljs-string">"my-server-3"</span>}
10296
{parent_service=<span class="hljs-string">"my-server-1"</span>,service=<span class="hljs-string">"my-server-2"</span>}
11166
{parent_service=<span class="hljs-string">"unknown"</span>,service=<span class="hljs-string">"my-server-1"</span>}
10937
{parent_service=<span class="hljs-string">"unknown"</span>,service=<span class="hljs-string">"my-server-2"</span>}
12
{parent_service=<span class="hljs-string">"unknown"</span>,service=<span class="hljs-string">"my-server-3"</span>}
</code></pre>
<p><center><i>Throughput between specific services in an example microservices</i></center><img decoding="async" src="https://blog.risingstack.com/content/images/2017/10/throuhput-between-microservices.png" alt="throuhput-between-microservices" /></p>
<p><center><i>Throughput between services*</i></center>Infrastructure topology visualization is a useful feature of APM solutions as we can see the system as a whole with all the dependencies. It makes easier to understand correlations during incidents and understand service boundaries.</p>
<p>With the special OpenTracing Metrics Tracer we extract the data about the initiator of a specific RPC call. Then, we can reverse engineer the whole infrastructure topology based on this information and visualize the dependencies between services. From these metrics, we can also gain information about throughput and latencies between applications and databases in our microservices architecture.</p>
<p>The post <a href="https://www.aiuniverse.xyz/the-future-of-microservices-monitoring-instrumentation/">The Future of Microservices Monitoring &#038; Instrumentation</a> appeared first on <a href="https://www.aiuniverse.xyz">Artificial Intelligence</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.aiuniverse.xyz/the-future-of-microservices-monitoring-instrumentation/feed/</wfw:commentRss>
			<slash:comments>3</slash:comments>
		
		
			</item>
		<item>
		<title>Does Kubernetes service governance work for microservices?</title>
		<link>https://www.aiuniverse.xyz/does-kubernetes-service-governance-work-for-microservices/</link>
					<comments>https://www.aiuniverse.xyz/does-kubernetes-service-governance-work-for-microservices/#comments</comments>
		
		<dc:creator><![CDATA[aiuniverse]]></dc:creator>
		<pubDate>Mon, 11 Sep 2017 09:07:43 +0000</pubDate>
				<category><![CDATA[Artificial Intelligence]]></category>
		<category><![CDATA[Microservices]]></category>
		<category><![CDATA[Kubernetes]]></category>
		<category><![CDATA[Kubernetes service]]></category>
		<category><![CDATA[microservices application]]></category>
		<category><![CDATA[Microservices Architecture]]></category>
		<guid isPermaLink="false">http://www.aiuniverse.xyz/?p=1046</guid>

					<description><![CDATA[<p>Source &#8211; techtarget.com A service registry sits between a client and server in a network and controls access between both of them. It is a critical part of the <a class="read-more-link" href="https://www.aiuniverse.xyz/does-kubernetes-service-governance-work-for-microservices/">Read More</a></p>
<p>The post <a href="https://www.aiuniverse.xyz/does-kubernetes-service-governance-work-for-microservices/">Does Kubernetes service governance work for microservices?</a> appeared first on <a href="https://www.aiuniverse.xyz">Artificial Intelligence</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Source &#8211; <strong>techtarget.com</strong></p>
<p>A service registry sits between a client and server in a network and controls access between both of them. It is a critical part of the application stack and has a big impact on the end-user experience. With the growing use of microservices, the role of a service registry has become even more important as the number of services that talk to each other has grown exponentially.</p>
<p>Service registries need to be fine-tuned and rearchitected to function seamlessly in a microservices world. More importantly, they need to be governed differently from older models. Let&#8217;s look at how we can better govern service registries and why a modern platform like Kubernetes does it the right way.</p>
<section class="section main-article-chapter" data-menu-title="Kubernetes service discovery is dynamic">
<h3 class="section-title">Kubernetes service discovery is dynamic</h3>
<p>In a microservices architecture, containers are short-lived. As containers get outdated or corrupted, they are killed, and new containers take their place automatically. This is what keeps the services running on top of these containers highly available.</p>
<p>Kubernetes automatically assigns an IP address to every group of containers, or <i>pods</i>, as Kubernetes refers to them. As containers and pods are replaced with new ones, new IP addresses are assigned automatically, and they register themselves with new IP addresses. Because the system is always aware of changing IP addresses, Kubernetes service discovery is dynamic and works well at the scale of microservices. Kubernetes uses SkyDNS to map requests to services according to IP address.</p>
</section>
<section class="section main-article-chapter" data-menu-title="Services are inspected by the kubelet">
<h3 class="section-title"><i class="icon" data-icon="1"></i>Services are inspected by the kubelet</h3>
<p>Services can affect each other by spreading vulnerabilities or draining resources from each other. It&#8217;s important to ensure only healthy services are running in your system. Unhealthy ones should be retired or replaced.</p>
<section class="section main-article-chapter" data-menu-title="Services are inspected by the kubelet">In Kubernetes, this is done by the kubelet. Kubelet is a core component of the Kubernetes system, and it inspects every pod to ensure that the containers in them are healthy.</p>
</section>
<section class="section main-article-chapter" data-menu-title="Requests are load balanced by kube-proxy">
<h3 class="section-title"><i class="icon" data-icon="1"></i>Requests are load balanced by kube-proxy</h3>
<p>When applications are bombarded with web-scale traffic, they need a way to route requests equally across services. Load balancing builds on service discovery; it ensures that traffic intended for one instance is balanced against any other instances that provide the same service. For Kubernetes, the kube-proxy handles load balancing.</p>
<p>By combining Kubernetes service discovery, inspection and load balancing, you have the ingredients of a great governance model for a modern microservices application. These three things in combination have the potential to scale to running millions of containers. And remember: These service governance principles can be applied to any application in order to improve the way services are governed &#8212; no matter what scale you operate at.</p>
</section>
</section>
<p>The post <a href="https://www.aiuniverse.xyz/does-kubernetes-service-governance-work-for-microservices/">Does Kubernetes service governance work for microservices?</a> appeared first on <a href="https://www.aiuniverse.xyz">Artificial Intelligence</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.aiuniverse.xyz/does-kubernetes-service-governance-work-for-microservices/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>Microservices demand a micro approach to integration</title>
		<link>https://www.aiuniverse.xyz/microservices-demand-a-micro-approach-to-integration/</link>
					<comments>https://www.aiuniverse.xyz/microservices-demand-a-micro-approach-to-integration/#comments</comments>
		
		<dc:creator><![CDATA[aiuniverse]]></dc:creator>
		<pubDate>Wed, 30 Aug 2017 10:49:21 +0000</pubDate>
				<category><![CDATA[Microservices]]></category>
		<category><![CDATA[development tools]]></category>
		<category><![CDATA[integration microservices]]></category>
		<category><![CDATA[Microservices Architecture]]></category>
		<category><![CDATA[new applications]]></category>
		<guid isPermaLink="false">http://www.aiuniverse.xyz/?p=844</guid>

					<description><![CDATA[<p>Source &#8211; jaxenter.com Enterprises are increasingly turning to a microservice architecture for new applications to achieve greater agility and scalability, and the software industry is supporting them with <a class="read-more-link" href="https://www.aiuniverse.xyz/microservices-demand-a-micro-approach-to-integration/">Read More</a></p>
<p>The post <a href="https://www.aiuniverse.xyz/microservices-demand-a-micro-approach-to-integration/">Microservices demand a micro approach to integration</a> appeared first on <a href="https://www.aiuniverse.xyz">Artificial Intelligence</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Source &#8211; jaxenter.com</p>
<p>Enterprises are increasingly turning to a microservice architecture for new applications to achieve greater agility and scalability, and the software industry is supporting them with development frameworks and tools for creating microservices. Yet, these don’t operate in a vacuum and often require an effective approach to integration.</p>
<p>The challenge is that building integration logic from scratch at the microservices layer is essentially reinventing the wheel while adding a traditional integration layer defeats some key objectives of a fully distributed microservice model. What’s needed instead are new solutions designed specifically to handle integration microservices.</p>
<p>Working with various enterprises, we’ve seen the common challenges they face when integrating microservices. First, let’s understand why traditional integration approaches fall short and then explore the need for a new approach centered around integration microservices.</p>
<p>A typical organization has backend systems and a centralized services bus layer, usually via an enterprise service bus (ESB), which channels all integration logic and is governed by a centralized team. Because it enables a standard way to publish any integration logic and a single place to update changes to the backend systems, the enterprise can minimize complexity and optimize performance. This works well for service-oriented architectures, but a traditional ESB has a comparatively large footprint and takes too long to start up to support the leaner, distributed nature of microservices.</p>
<p>Recognizing that ESBs are not a fit for microservices, some developers are either building integration into the microservices or relying on APIs to integrate them. Yet, these approaches fail to provide some important reusable constructs offered by ESBs, such as pre-built connectors, integration templates and patterns, mediation, and transformation logic. To be clear, APIs are central to a microservice architecture, but they are not a workaround for integration requirements.</p>
<h3><strong>Integration Microservices refines your approach to integration</strong></h3>
<p>A better alternative is an integration microservice approach where conventional microservices and integration microservices interact with each other. This enables developers to utilize integration microservices for mediation, transformations and other integration functions for services or to compose multiple services into a single service.</p>
<p>Essentially, an integration microservice helps to leverage the essentials of microservices and add these to the integration layer. These integration microservices can be considered as a mini-services layer for composite services linking or chaining multiple fine-grained backend systems, as well as transforming and/or connecting to cloud systems, as shown in Figure 1.</p>
<div id="attachment_136652" class="wp-caption aligncenter"><img fetchpriority="high" decoding="async" class="wp-image-136652" src="https://jaxenter.com/wp-content/uploads/2017/08/microservices-mifan-1-1024x453.png" sizes="(max-width: 714px) 100vw, 714px" srcset="https://jaxenter.com/wp-content/uploads/2017/08/microservices-mifan-1-1024x453.png 1024w, https://jaxenter.com/wp-content/uploads/2017/08/microservices-mifan-1-120x53.png 120w, https://jaxenter.com/wp-content/uploads/2017/08/microservices-mifan-1-300x133.png 300w, https://jaxenter.com/wp-content/uploads/2017/08/microservices-mifan-1-768x339.png 768w, https://jaxenter.com/wp-content/uploads/2017/08/microservices-mifan-1-200x88.png 200w, https://jaxenter.com/wp-content/uploads/2017/08/microservices-mifan-1-150x66.png 150w, https://jaxenter.com/wp-content/uploads/2017/08/microservices-mifan-1-350x155.png 350w" alt="microservices" width="714" height="316" /></p>
<p class="wp-caption-text">Figure 1: A reference model for integration microservices</p>
</div>
<p>Moreover, an integration microservice approach gives development teams greater flexibility and end-to-end responsibility of their code. This means the same (small) team can be tasked with the creation of core services and composite services, database handling, integration logic, cloud connectivity, protocol transformation, user experience (UX) development, etc.</p>
<p>The architecture described here is best supported by a programming language that enables developers to build lean, microservice-style integrations while still using existing integration concepts—such as connectors, service chaining, and routing—when writing a new service.</p>
<p>As a programming language versus a highly specialized configuration language, it provides the added benefit of being intuitive for developers while naturally being compatible with development tools.</p>
<p>Ideally, to cater to today’s demand for citizen and ad-hoc integrators, it should also provide a visually intuitive interface, possibly replacing traditional data flow-driven approaches with a more visual tool that ensures parity between the visual model and the programming model. A much more understandable approach, such as sequence diagrams, would be applicable here.</p>
<p>For instance, a microservice that exposes customer information might need to connect to Salesforce, meaning the developer must build a connector or call a set of APIs. In another scenario, there might be a difference between the incoming message XML format and what the backend system expects. For such integration scenarios, it may be possible to build reusable integration logic into each service. However, only through a separate integration microservice layer can developers ensure scalability—not only in terms of time, effort and cost, but also in terms of re-work and maintaining the dependencies of libraries.</p>
<p>As leaner, agile, DevOps-based, distributed, and microservice-style development becomes the preferred go-to technology model, developers have struggled to find the right approach to integration. An integration microservice approach promises to provide the missing link with its ability to tackle integration challenges in a highly scalable manner while providing the agility to meet evolving requirements.</p>
<p>The post <a href="https://www.aiuniverse.xyz/microservices-demand-a-micro-approach-to-integration/">Microservices demand a micro approach to integration</a> appeared first on <a href="https://www.aiuniverse.xyz">Artificial Intelligence</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.aiuniverse.xyz/microservices-demand-a-micro-approach-to-integration/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Designing a Microservices Architecture for Failure</title>
		<link>https://www.aiuniverse.xyz/designing-a-microservices-architecture-for-failure/</link>
					<comments>https://www.aiuniverse.xyz/designing-a-microservices-architecture-for-failure/#comments</comments>
		
		<dc:creator><![CDATA[aiuniverse]]></dc:creator>
		<pubDate>Wed, 16 Aug 2017 09:14:56 +0000</pubDate>
				<category><![CDATA[Microservices]]></category>
		<category><![CDATA[critical transactions]]></category>
		<category><![CDATA[isolate failures]]></category>
		<category><![CDATA[Microservices Architecture]]></category>
		<category><![CDATA[network failures]]></category>
		<guid isPermaLink="false">http://www.aiuniverse.xyz/?p=629</guid>

					<description><![CDATA[<p>Source &#8211; blog.risingstack.com A Microservices architecture makes it possible to isolate failuresthrough well-defined service boundaries. But like in every distributed system, there is a higher chance for network, hardware or application <a class="read-more-link" href="https://www.aiuniverse.xyz/designing-a-microservices-architecture-for-failure/">Read More</a></p>
<p>The post <a href="https://www.aiuniverse.xyz/designing-a-microservices-architecture-for-failure/">Designing a Microservices Architecture for Failure</a> appeared first on <a href="https://www.aiuniverse.xyz">Artificial Intelligence</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Source &#8211;<strong> blog.risingstack.com</strong></p>
<p>A Microservices architecture makes it possible to <strong>isolate failures</strong>through well-defined service boundaries. But like in every distributed system, there is a <strong>higher chance</strong> for network, hardware or application level issues. As a consequence of service dependencies, any component can be temporarily unavailable for their consumers. To minimize the impact of partial outages we need to build fault tolerant services that can <strong>gracefully</strong> respond to certain types of outages.</p>
<p>This article introduces the most common techniques and architecture patterns to build and operate a <strong>highly available microservices</strong> system based on RisingStack’s Node.js Consulting &amp; Development experience.</p>
<p><em>If you are not familiar with the patterns in this article, it doesn’t necessarily mean that you do something wrong. Building a reliable system always comes with an extra cost.</em></p>
<h2 id="theriskofthemicroservicesarchitecture">The Risk of the Microservices Architecture</h2>
<p>The microservices architecture moves application logic to services and uses a network layer to communicate between them. Communicating over a network instead of in-memory calls brings extra latency and complexity to the system which requires cooperation between multiple physical and logical components. The increased complexity of the distributed system leads to a higher chance of particular <strong>network failures</strong>.</p>
<p>One of the biggest advantage of a microservices architecture over a monolithic one is that teams can independently design, develop and deploy their services. They have full ownership over their service&#8217;s lifecycle. It also means that teams have no control over their service dependencies as it&#8217;s more likely managed by a different team. With a microservices architecture, we need to keep in mind that provider <strong>services can be temporarily unavailable</strong> by broken releases, configurations, and other changes as they are controlled by someone else and components move independently from each other.</p>
<h2 id="gracefulservicedegradation">Graceful Service Degradation</h2>
<p>One of the best advantages of a microservices architecture is that you can isolate failures and achieve graceful service degradation as components fail separately. For example, during an outage customers in a photo sharing application maybe cannot upload a new picture, but they can still browse, edit and share their existing photos.</p>
<p><img decoding="async" src="https://blog-assets.risingstack.com/2017/08/microservices-fail-separately-in-theory.png" alt="Microservices fail separately in theory" /></p>
<p><em>Microservices fail separately (in theory)</em></p>
<p>In most of the cases, it&#8217;s hard to implement this kind of graceful service degradation as applications in a distributed system depend on each other, and you need to apply several failover logics <em>(some of them will be covered by this article later)</em> to prepare for temporary glitches and outages.</p>
<p><img decoding="async" src="https://blog-assets.risingstack.com/2017/08/Microservices-depend-on-each-other.png" alt="Microservices Depend on Each Other" /></p>
<p><em>Services depend on each other and fail together without failover logics.</em></p>
<h2 id="changemanagement">Change management</h2>
<p>Google’s site reliability team has found that roughly <strong>70% of the outages are caused by changes</strong> in a live system. When you change something in your service &#8211; you deploy a new version of your code or change some configuration &#8211; there is always a chance for failure or the introduction of a new bug.</p>
<p>In a microservices architecture, services depend on each other. This is why you should minimize failures and limit their negative effect. To deal with issues from changes, you can implement change management strategies and <strong>automatic rollouts</strong>.</p>
<p>For example, when you deploy new code, or you change some configuration, you should apply these changes to a subset of your instances gradually, monitor them and even automatically revert the deployment if you see that it has a negative effect on your key metrics.</p>
<p><img decoding="async" src="https://blog-assets.risingstack.com/2017/08/microservices-change-management.png" alt="Microservices Change Management" /></p>
<p><em>Change Management &#8211; Rolling Deployment</em></p>
<p>Another solution could be that you run two production environments. You always deploy to only one of them, and you only point your load balancer to the new one after you verified that the new version works as it is expected. This is called blue-green, or red-black deployment.</p>
<p><strong>Reverting code is not a bad thing.</strong> You shouldn’t leave broken code in production and then think about what went wrong. Always revert your changes when it’s necessary. The sooner the better.</p>
<h3 id="healthcheckandloadbalancing">Health-check and Load Balancing</h3>
<p>Instances continuously start, restart and stop because of failures, deployments or autoscaling. It makes them temporarily or permanently unavailable. To avoid issues, your load balancer should <strong>skip unhealthy instances</strong> from the routing as they cannot serve your customers&#8217; or sub-systems&#8217; need.</p>
<p>Application instance health can be determined via external observation. You can do it with repeatedly calling a <code>GET /health</code>endpoint or via self-reporting. Modern <strong>service discovery</strong> solutions continuously collect health information from instances and configure the load-balancer to route traffic only to healthy components.</p>
<h3 id="selfhealing">Self-healing</h3>
<p>Self-healing can help to recover an application. We can talk about self-healing when an application can <strong>do the necessary steps</strong> to recover from a broken state. In most of the cases, it is implemented by an external system that watches the instances health and restarts them when they are in a broken state for a longer period. Self-healing can be very useful in most of the cases, however, in certain situations it <strong>can cause trouble</strong> by continuously restarting the application. This might happen when your application cannot give positive health status because it is overloaded or its database connection timeouts.</p>
<p>Implementing an advanced self-healing solution which is prepared for a delicate situation &#8211; like a lost database connection &#8211; can be tricky. In this case, you need to add extra logic to your application to handle edge cases and let the external system know that the instance is not needed to restart immediately.</p>
<h2 id="failovercaching">Failover Caching</h2>
<p>Services usually fail because of network issues and changes in our system. However, most of these outages are temporary thanks to self-healing and advanced load-balancing we should find a solution to make our service work during these glitches. This is where <strong>failover caching</strong> can help and provide the necessary data to our application.</p>
<p>Failover caches usually use <strong>two different expiration dates</strong>; a shorter that tells how long you can use the cache in a normal situation, and a longer one that says how long can you use the cached data during failure.</p>
<p><img decoding="async" src="https://blog-assets.risingstack.com/2017/08/microservices-failover-caching.png" alt="Microservices Failover Caching" /></p>
<p><em>Failover Caching</em></p>
<p>It’s important to mention that you can only use failover caching when it serves <strong>the outdated data better than nothing</strong>.</p>
<p>To set cache and failover cache, you can use standard response headers in HTTP.</p>
<p>For example, with the <code>max-age</code> header you can specify the maximum amount of time a resource will be considered fresh. With the <code>stale-if-error</code> header, you can determine how long should the resource be served from a cache in the case of a failure.</p>
<p>Modern CDNs and load balancers provide various caching and failover behaviors, but you can also create a shared library for your company that contains standard reliability solutions.</p>
<h2 id="retrylogic">Retry Logic</h2>
<p>There are certain situations when we cannot cache our data or we want to make changes to it, but our operations eventually fail. In these cases, we can <strong>retry our action</strong> as we can expect that the resource will recover after some time or our load-balancer sends our request to a healthy instance.</p>
<p>You should be careful with adding retry logic to your applications and clients, as a larger amount of <strong>retries can make things even worse</strong> or even prevent the application from recovering.</p>
<p>In distributed system, a microservices system retry can trigger multiple other requests or retries and start a <strong>cascading effect</strong>. To minimize the impact of retries, you should limit the number of them and use an exponential backoff algorithm to continually increase the delay between retries until you reach the maximum limit.</p>
<p>As a retry is initiated by the client <em>(browser, other microservices, etc.)</em>and the client doesn&#8217;t know that the operation failed before or after handling the request, you should prepare your application to handle <strong>idempotency</strong>. For example, when you retry a purchase operation, you shouldn&#8217;t double charge the customer. Using a unique <strong>idempotency-key</strong> for each of your transactions can help to handle retries.</p>
<h2 id="ratelimitersandloadshedders">Rate Limiters and Load Shedders</h2>
<p>Rate limiting is the technique of defining how many requests can be received or processed by a particular customer or application during a timeframe. With rate limiting, for example, you can filter out customers and microservices who are responsible for <strong>traffic peaks</strong>, or you can ensure that your application doesn’t overload until autoscaling can’t come to rescue.</p>
<p>You can also hold back lower-priority traffic to give enough resources to critical transactions.</p>
<p><img decoding="async" src="https://blog-assets.risingstack.com/2017/08/microservices-rate-limiter.png" alt="Microservices Rate Limiter" /></p>
<p><em>A rate limiter can hold back traffic peaks</em></p>
<p>A different type of rate limiter is called the <em>concurrent request limiter</em>. It can be useful when you have expensive endpoints that shouldn’t be called more than a specified times, while you still want to serve traffic.</p>
<p>A <em>fleet usage load shedder</em> can ensure that there are always enough resources available to <strong>serve critical transactions</strong>. It keeps some resources for high priority requests and doesn’t allow for low priority transactions to use all of them. A load shedder makes its decisions based on the whole state of the system, rather than based on a single user’s request bucket size. Load shedders <strong>help your system to recover</strong>, since they keep the core functionalities working while you have an ongoing incident.</p>
<p>To read more about rate limiters and load shredders, I recommend checking out Stripe’s article.</p>
<h2 id="failfastandindependently">Fail Fast and Independently</h2>
<p>In a microservices architecture we want to prepare our services <strong>to fail fast and separately</strong>. To isolate issues on service level, we can use the <em>bulkhead pattern</em>. You can read more about bulkheads later in this blog post.</p>
<p>We also want our components to <strong>fail fast</strong> as we don&#8217;t want to wait for broken instances until they timeout. Nothing is more disappointing than a hanging request and an unresponsive UI. It&#8217;s not just wasting resources but also screwing up the user experience. Our services are calling each other in a chain, so we should pay an extra attention to prevent hanging operations before these delays sum up.</p>
<p>The first idea that would come to your mind would be applying fine grade timeouts for each service calls. The problem with this approach is that you cannot really know what&#8217;s a good timeout value as there are certain situations when network glitches and other issues happen that only affect one-two operations. In this case, you probably don’t want to reject those requests if there’s only a few of them timeouts.</p>
<p>We can say that achieving the fail fast paradigm in microservices by <strong>using timeouts is an anti-pattern</strong> and you should avoid it. Instead of timeouts, you can apply the <em>circuit-breaker</em> pattern that depends on the success / fail statistics of operations.</p>
<h3 id="bulkheads">Bulkheads</h3>
<p>Bulkhead is used in the industry to <strong>partition</strong> a ship <strong>into sections</strong>, so that sections can be sealed off if there is a hull breach.</p>
<p>The concept of bulkheads can be applied in software development to <strong>segregate resources</strong>.</p>
<p>By applying the bulkheads pattern, we can <strong>protect limited resources</strong> from being exhausted. For example, we can use two connection pools instead of a shared on if we have two kinds of operations that communicate with the same database instance where we have limited number of connections. As a result of this client &#8211; resource separation, the operation that timeouts or overuses the pool won&#8217;t bring all of the other operations down.</p>
<p>One of the main reasons why Titanic sunk was that its bulkheads had a design failure, and the water could pour over the top of the bulkheads via the deck above and flood the entire hull.</p>
<p><img decoding="async" src="https://blog-assets.risingstack.com/2017/08/titanic-bulkhead-microservices.png" alt="Titanic Microservices Bulkheads" /></p>
<p><em>Bulkheads in Titanic (they didn&#8217;t work)</em></p>
<h3 id="circuitbreakers">Circuit Breakers</h3>
<p>To limit the duration of operations, we can use timeouts. Timeouts can prevent hanging operations and keep the system responsive. However, using static, fine tuned timeouts in microservices communication is an <strong>anti-pattern</strong> as we’re in a highly dynamic environment where it&#8217;s almost impossible to come up with the right timing limitations that work well in every case.</p>
<p>Instead of using small and transaction-specific static timeouts, we can use circuit breakers to deal with errors. Circuit breakers are named after the real world electronic component because their behavior is identical. You can <strong>protect resources</strong> and <strong>help them to recover</strong> with circuit breakers. They can be very useful in a distributed system where a repetitive failure can lead to a snowball effect and bring the whole system down.</p>
<p>A circuit breaker opens when a particular type of <strong>error occurs multiple times</strong> in a short period. An open circuit breaker prevents further requests to be made &#8211; like the real one prevents electrons from flowing. Circuit breakers usually close after a certain amount of time, giving enough space for underlying services to recover.</p>
<p>Keep in mind that not all errors should trigger a circuit breaker. For example, you probably want to skip client side issues like requests with <code>4xx</code> response codes, but include <code>5xx</code> server-side failures. Some circuit breakers can have a half-open state as well. In this state, the service sends the first request to check system availability, while letting the other requests to fail. If this first request succeeds, it restores the circuit breaker to a closed state and lets the traffic flow. Otherwise, it keeps it open.</p>
<p><img decoding="async" src="https://blog-assets.risingstack.com/2017/08/microservices-circuit-breakers.png" alt="Microservices Circuit Breakers" /></p>
<p><em>Circuit Breaker</em></p>
<h2 id="testingforfailures">Testing for Failures</h2>
<p>You should continually <strong>test your system against common issues</strong> to make sure that your services can <strong>survive various failures</strong>. You should test for failures frequently to keep your team prepared for incidents.</p>
<p>For testing, you can use an external service that identifies groups of instances and randomly terminates one of the instances in this group. With this, you can prepare for a single instance failure, but you can even shut down entire regions to simulate a cloud provider outage.</p>
<p>One of the most popular testing solutions is the ChaosMonkeyresiliency tool by Netflix.</p>
<p>The post <a href="https://www.aiuniverse.xyz/designing-a-microservices-architecture-for-failure/">Designing a Microservices Architecture for Failure</a> appeared first on <a href="https://www.aiuniverse.xyz">Artificial Intelligence</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.aiuniverse.xyz/designing-a-microservices-architecture-for-failure/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>An introduction to hands-on microservices with Java</title>
		<link>https://www.aiuniverse.xyz/an-introduction-to-hands-on-microservices-with-java/</link>
					<comments>https://www.aiuniverse.xyz/an-introduction-to-hands-on-microservices-with-java/#comments</comments>
		
		<dc:creator><![CDATA[aiuniverse]]></dc:creator>
		<pubDate>Sat, 29 Jul 2017 10:14:05 +0000</pubDate>
				<category><![CDATA[Microservices]]></category>
		<category><![CDATA[develop microservices]]></category>
		<category><![CDATA[Java]]></category>
		<category><![CDATA[Microservices Architecture]]></category>
		<category><![CDATA[software developer]]></category>
		<guid isPermaLink="false">http://www.aiuniverse.xyz/?p=358</guid>

					<description><![CDATA[<p>Source &#8211; jaxenter.com “Microservices Architecture” is now a popular concept in programming. In order to keep up-to-date as a software developer, I’ve been trying to get a good <a class="read-more-link" href="https://www.aiuniverse.xyz/an-introduction-to-hands-on-microservices-with-java/">Read More</a></p>
<p>The post <a href="https://www.aiuniverse.xyz/an-introduction-to-hands-on-microservices-with-java/">An introduction to hands-on microservices with Java</a> appeared first on <a href="https://www.aiuniverse.xyz">Artificial Intelligence</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Source &#8211;<strong> jaxenter.com</strong></p>
<p>“Microservices Architecture” is now a popular concept in programming. In order to keep up-to-date as a software developer, I’ve been trying to get a good understanding of this architecture. Specifically, I’ve been looking at a better way to implement microservices architecture in Java using Spring.</p>
<p>Some background: my company, although great, had a woefully out of date tech stack. Basically, we weren’t using Java 8 or microservices yet. So I had to look outside of the company if I wanted to know more about either of those things. The easiest way to learn is by just doing it, so I decided to create a To Do system anddocument my experience for future reference.</p>
<h3><b>Overview</b></h3>
<p>My goal for this article is to have a source code walkthrough for different microservices. I’m not planning to go deep in the concepts and tools; there are a lot of posts about those out there. My intention here is to present an application example containing the patterns, tools, technologies used to develop microservices.</p>
<p>Since this is a reference application, I have intentionally made it as simple as possible so the source code is easy to understand. You should follow along at home and be able to run this application on your own computer as a reference.</p>
<p>In this article, we are going to work with a “To Do” application which will be composed of 8 applications:</p>
<ul>
<li>Reminder</li>
<li>User</li>
<li>Service discovery server</li>
<li>Mailer</li>
<li>OAuth Server</li>
<li>System integration test</li>
<li>API Gateway</li>
<li>Web application client</li>
</ul>
<p>This article will provide an overview of the whole project. Later, I will explain more deeply about what and how we are using the components in each microservice.</p>
<h3><b>How our system will work with Microservices</b></h3>
<p><img decoding="async" class="aligncenter wp-image-136072" src="https://jaxenter.com/wp-content/uploads/2017/07/microservices-alexsandro.jpg" sizes="(max-width: 714px) 100vw, 714px" srcset="https://jaxenter.com/wp-content/uploads/2017/07/microservices-alexsandro.jpg 953w, https://jaxenter.com/wp-content/uploads/2017/07/microservices-alexsandro-120x77.jpg 120w, https://jaxenter.com/wp-content/uploads/2017/07/microservices-alexsandro-300x193.jpg 300w, https://jaxenter.com/wp-content/uploads/2017/07/microservices-alexsandro-768x495.jpg 768w, https://jaxenter.com/wp-content/uploads/2017/07/microservices-alexsandro-200x129.jpg 200w, https://jaxenter.com/wp-content/uploads/2017/07/microservices-alexsandro-150x97.jpg 150w, https://jaxenter.com/wp-content/uploads/2017/07/microservices-alexsandro-350x225.jpg 350w" alt="microservices" width="714" height="460" /></p>
<p>In the image above, you can see how our system interacts along with all microservices. The user will access a Web Application written using Angular 2. It will then connect to an OAuth Authorization Server, which will be a central point of where users and authorities can be assigned. This server will return a JSON Web Token containing info about the client with its authorities and the grated scope. After the user is authenticated and has a token, the Web Application will be able to talk to the API gateway. It will take the JWT, verify if it’s coming from the Authorization Server, and then make calls to the microservices and build the response.</p>
<p>The OAuth server uses the User service to get the user’s authentication details. Also, the API gateway uses the OAuth server to get the user’s information.</p>
<p>The <i>Remainder Service</i> is where are placed the ToDo functionalities, The ToDo service has a scheduled job to check for reminders and notify the user by email, the emails are sent by the <i>Mailer Service</i> which is triggered from <i>Reminder service</i> by event using Kafka.</p>
<p>The System Integration Test is a Java application responsible for reaching the Reminder service’s endpoints.</p>
<h3><b>Connecting Microservices</b></h3>
<p>In Microservice architecture, we have to deal with many microservices running in different IPs and ports. Therefore, we need to find a way of managing each address without hard coding.</p>
<p>This is where Netflix Eureka comes to the rescue. It is a client-side service discovery that allows services to find and communicate with each other automatically. We are using Spring Cloud Eureka in our system; you should take a look at how it works so you can understand how our REST services are communicating between different microservices. Once Eureka cares about where the services are running, we can add instances and apply load balancing to distribute the incoming application traffic between our microservice.</p>
<p>In our system, we are using Netflix Ribbon as a client-side load balancer. That enables us to achieve fault tolerance and increase the reliability and availability through redundancy. We are using Netflix Foreign for writing declarative REST client, and integrating Ribbon and Eureka to provide a load balance HTTP client.</p>
<p>Our system does have some dependencies. We are trying to isolate our application from dependency failure using Netflix Hystrix Circuit Breaker. It helps stop cascading failures and allows us to fail fast and rapid recovery, or add fallbacks. Hystrix maintains a thread-pool for each dependency; it rejects requests instead of queuing them if the thread-pool becomes exhausted. It also provides circuit-breaker functionality that can stop all requests to a dependency. You can also implement fallback logic when a request is failed, rejected, or timed-out.</p>
<h3><b>Authentication</b></h3>
<p>Security is something very important when developing any kind of system. Microservices architecture is no different. “How can I maintain security in my microservices?” comes up immediately, and the first answer is OAuth2. OAuth2 is definitely a good solution: it is a well-known authorization technology that is widely used for Google, Facebook, and Github.</p>
<p>Anyways, it’s impossible to talk about security without mentioning Spring Security. I use it alongside OAuth2 in this project. Spring Security and OAuth2 are obvious choices when talking about secure distributed system.</p>
<p>However, we are adding one more element to our security concern: JSON Web Token (JWT). If we were only using OAuth, we would need to have an OAuth Authorization Server to authenticate the user, generate the token as well as act as an endpoint for the <i>Resource servers</i> to ask if the token is valid and which permission does it grant. This requires twice more requests to the <i>Authorization Server</i> than we really need. JWT provides a simple way of transmitting the permissions and user data in the access token. Once all data is already in the token string, the resource servers don’t need to ask for token checks. All the information is serialized into JSON first, encoded with base64 and finally signed with a private RSA key. It is assumed that all resource servers will have a public key to check if the token was signed for the proper private key and deserialize the token to have the information.</p>
<p>You can have a look at the OAuth2 Authorization Server(OAuth-server) and the <i>Resource Server(API Gateway)</i> implementations to see the code looks like. The implementation was done following mainly this blog post.</p>
<h3><b>REST</b></h3>
<p>In our system, we have two interaction styles: synchronous and asynchronous. For the async style, we are using distributed events with Kafka, following the model publish/subscribe. For synch, we have REST style supporting JSON and XML.</p>
<p>There are four levels of maturity of RESTful, starting at <b>level 0,</b> as described for Martin Fowler here. Our microservices is in the <b>level 2, </b>because I decided not implement the Hypermedia Controls using the HATEOAS design pattern for the simplicity.</p>
<p>Because we are using Spring Cloud, we have to out-of-box some scalability patterns, which are placed in our HTTP connections that deserve a mention: Circuit breaker, Bulkheads, Load Balancing, Connection pooling, timeouts, and retry.</p>
<h3><b>Distributed Event</b></h3>
<p>As mentioned above, our communication between the <i>Reminder service</i> and <i>Mailer service</i> is done asynchronously using Kafka to distribute our events across the others Microservices. In the <i>Reminder service</i>, we have a scheduled task to check for reminders time and publish the event <i>RemainderFound. </i>There will be a subscribed event in the <i>Mailer service</i> which will start the process of sending an email to the user. I invite you to have a look at how we are doing this integration and how I wrote the serialization/ deserialization of the data sent to Kafka in the <i>Kafka event Module.</i></p>
<h3><b>Event sourcing and CQRS</b></h3>
<p>Monolithic applications typically have a single relational database. We can use ACID transactions. As a result, our application can simply begin a transaction, change multiple rows, and commit the transaction if everything go right or rollback if something goes wrong. Unfortunately, to deal with data access in the microservice architecture is much more complex. This is due to the fact that the data is distributed in different databases. Implementing business transactions across multiple services is a big challenge.</p>
<h4>SEE MORE: From the Monolith to Microservices</h4>
<p>In our “ToDo” project, we are using events to deal with business transaction that spans multiple services. You can look at the implementation of Event Sourcing with CQRS applied in the <i>Mailer service</i>. You can see how to separate Reads and Writes that enable us to scale each part easily. We are using a relational database as an event store and then distributing the events using Kafka. We will need to make these two actions Atomic and avoid storing the event, that way it won’t publish an eventual JVM crash. I’m not using Kafka as the event store because is simpler to construct the aggregates from a relational database. We are trying to make things easy here!</p>
<h3><b>Next step</b></h3>
<p>As you can notice, we already have a lot of things in this project and there are still many challenges that are not addressed here yet. However, this is a project in development and we are planning adding more things into it, such as Spring cloud config, Containers with Docker, continuous integration with Jenkins, Distributed trace with Spring Sleuth, Logging management with ELK and more. So keep tuned on our Github repository to see more fun things.</p>
<p>The post <a href="https://www.aiuniverse.xyz/an-introduction-to-hands-on-microservices-with-java/">An introduction to hands-on microservices with Java</a> appeared first on <a href="https://www.aiuniverse.xyz">Artificial Intelligence</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.aiuniverse.xyz/an-introduction-to-hands-on-microservices-with-java/feed/</wfw:commentRss>
			<slash:comments>5</slash:comments>
		
		
			</item>
	</channel>
</rss>
