using service discovery and service proxy

17
Using Service Discovery and Service Proxy A Simple Microservices Example

Upload: ibm

Post on 13-Jan-2017

1.396 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Using Service Discovery and Service Proxy

Using Service Discovery and Service ProxyA Simple Microservices Example

Page 2: Using Service Discovery and Service Proxy

2

Monolithic application Microservices

Scaling Scaling

Moving from Monolithic Applications to Microservices

Microservices: are an architecture style, in which large complex software applications are composed of one or more services

can be deployed independently of one another and are loosely coupled

should be small and focused on completing a single task

typically communicate through language-neutral APIs like an Hypertext Transfer Protocol (HTTP)-based resource API using REST

Page 3: Using Service Discovery and Service Proxy

Benefits of Microservices for Developers

• Enables you to avoid working on large code bases• Easier to maintain or add to features• Use existing skills, or the most optimal language• Improves deployment and load times in your development tools• Makes debugging easier• Enables teams to work more independently of each other• Simplifies tracking code dependencies• Enables complete ownership by a self-contained single team, from

definition through development, deployment, operations, and sunseting• Makes it easier to address performance bottlenecks

3

Page 4: Using Service Discovery and Service Proxy

Service Discovery, Service Proxy and Microservices

4

• Service Discovery enables developers to easily register and find instances of their microservices

ServiceProxy

ServiceProxyRules

ServiceDiscovery

Client code

ServiceA

ServiceB

Service C

Service RegistrationHeartbeats

Requests

Locateservice

Rulesto apply

Call requested services usingrules

• Service Proxy automatically balances workloads across instances to improve performance

Together, these two services provide essential capabilities for creating and using microservices

Page 5: Using Service Discovery and Service Proxy

A Simple Microservices example

5

MaureenDevOps Pro

Maureen has an online store application with a front end that generates a web UI, and a backend that checks the inventory to see if items are out of stock.

Her original design was a single monolithic application but she has decided to redesign it with a microservices based architecture to improve scalability, reliability, and business agility. She’s going tosplit her app into three services – WebUI, Inventory and Database.

Monolithic WebUI + Inventory +

Database

WebUI

Inventory

Before: Monolithic app After: Using microservices

Database

Page 6: Using Service Discovery and Service Proxy

Service Discovery – Automates Service Registration

6

Let’s assume Maureen’s new architecture is container based so each instance of a service will be run in a container.

A key task in transitioning to a microservices architecture is to register each instance of a service.

Service Discovery automatically-Registers each instance of a service -Makes it easy to find instances of services once registered -Periodically checks the health of each service

Inventory

Helper Script: Register (“Inventory Instance 1”)

Helper Script: Register (“Inventory Instance 2”)

Helper Script: Register (“Inventory Instance 3”)

Service Discovery

Page 7: Using Service Discovery and Service Proxy

Service Discovery – Finding Instances Easily

7

Once instances of services are registered, Service Discovery makes it easy to find them.

Service Discovery provides a simple REST based API to find instances by logical name.

Without Service Proxy, its up to the client code to determine which instance from the list to call.

For example you could call the first instance returned.

Web UI Service

DiscoveryQuery(“Inventory”)

Response: “Inventory Instance 1”, “Inventory Instance 2”, “Inventory Instance 3”

Web UI Call “Inventory Instance 1”()

Inventory

1

2

1

2Return response of “Inventory Instance 1”()

Page 8: Using Service Discovery and Service Proxy

Service Proxy – Microservices Load Balancing

8

Service Proxy automatically balances workload across active instances

Service Proxy calls Service Discovery under the covers and then performing basic load balancing of instances through a round robin process without the client writing code.

Service Proxy also logs the performance of the microservices it proxies, allowing you to track the performance of your microservices without the client writing code.

Web UI Service Proxy

CallProxy(“Inventory”) Service Discovery

Query(“Inventory”)

Response: “Inventory Instance 1”, “Inventory Instance 2”, “Inventory Instance 3”Inventory Call “Inventory Instance 2”()

based on round robin. And log its processing time

Return response of “Inventory Instance 2”()

1

2

1

2

Page 9: Using Service Discovery and Service Proxy

Service Proxy – Making your solution more reliable

Service Proxy also lets Maureen improve the quality of her app by making it easy to inject delays and failures during testing without writing code

Injecting delays will help Maureen simulate performance bottlenecks

Injecting failures will help her test how well the application recovers from various error situations

Web UI

If WW Inventory request takes more than 120 ms, switch to Regional Inventory instead

WW Inventory

Regional Inventory

Service Proxy

Configure Proxy to Inject delays to WW Inventory to simulate WAN delays

Web UI

If Inventory is not available, use Local Cache

InventoryService Proxy

Configure Proxy to fail some calls to Inventory to simulate network failure

LocalCache

1

2

1

2

Page 10: Using Service Discovery and Service Proxy

Service Proxy – Future Enhancement (Gremlin)The initial public beta of Service Proxy will support two simple flavors of injection testing: •Delays that are always injected through Proxy•Failures that are randomly injected based through Proxy on a percentage (25% of the time, 50% of the time, etc…)

IBM Research has created a testing framework (Gremlin) that supports scripted orderly testing via a recipe, and beyond beta we wish to extend Service Proxy to support integration with this.

This will provide the capability to script specific failures for orderly resiliency testing that helps clients to: •Create repeatable sophisticated test cases via Gremlin recipes for delays, failures, and scrambled communication across multiple microservices•Separate synthetic testing load for testing instances from real user traffic running on production instances

Page 11: Using Service Discovery and Service Proxy

• Maureen:– I just deployed a new version of the “WebUI” service. I want to make sure my

service can tolerate failures of other services and the environment.

• Release manager:– I want to make sure each service is resilient to failures before a new version

release

11

Gremlin - simple use case

Page 12: Using Service Discovery and Service Proxy

Inventory Database

Service proxy

WebUI

Gremlin Vision

12

fault injection rules

Not affected

Bluemix Logging Service

Logs

Synthetic Load

Real user traffic

Bluemix Tenant

Gremlin ServiceMaureenRelease

ManagerScenario

Run scenario Result What went wrong?

Service Overload ❌

Inventory did not trigger circuit breaker when DB service was overloaded

Network Instability …

Service Status

WebUI ✅

Inventory ❌

Database ✅

Launch

Launch

Failu

re

Orch

estra

tion

Beha

vior

Va

lidat

ion

Subjected to failures

Fallback cache

Page 13: Using Service Discovery and Service Proxy

Creating Your Own Gremlin Recipe

run_recipe.py topology.json gremlins.json checklist.json

BoundedRetries: Check if WebUI retried its API calls to RegionalInventory, no more than 5 times, with 30ms gap

Fake “Overload”: Gremlin will intercept all API calls to RegionalInventoryand return HTTP 503/429

Failure injected only if request has HTTP header “X-Gremlin-ID: delayTest-<val>”

Page 14: Using Service Discovery and Service Proxy

Invitation to Join Our Beta Program

Interested in learning more? Join our beta program

Both Service Discovery for Bluemix and Service Proxy for Bluemix are in Beta in 1Q2016 and available on the public Bluemix catalog: www.bluemix.net

For more information, contact Doug Rothert, IBM Cloud Offering Manager [email protected]@DougRothert).

Page 15: Using Service Discovery and Service Proxy

Notices and Disclaimers

15

Copyright © 2016 by International Business Machines Corporation (IBM). No part of this document may be reproduced or transmitted in any form without written permission from IBM.

U.S. Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM.

Information in these presentations (including information relating to products that have not yet been announced by IBM) has been reviewed for accuracy as of the date of initial publication and could include unintentional technical or typographical errors. IBM shall have no responsibility to update this information. THIS DOCUMENT IS DISTRIBUTED "AS IS" WITHOUT ANY WARRANTY, EITHER EXPRESS OR IMPLIED. IN NO EVENT SHALL IBM BE LIABLE FOR ANY DAMAGE ARISING FROM THE USE OF THIS INFORMATION, INCLUDING BUT NOT LIMITED TO, LOSS OF DATA, BUSINESS INTERRUPTION, LOSS OF PROFIT OR LOSS OF OPPORTUNITY. IBM products and services are warranted according to the terms and conditions of the agreements under which they are provided.

Any statements regarding IBM's future direction, intent or product plans are subject to change or withdrawal without notice.

Performance data contained herein was generally obtained in a controlled, isolated environments. Customer examples are presented as illustrations of how those customers have used IBM products and the results they may have achieved. Actual performance, cost, savings or other results in other operating environments may vary.

References in this document to IBM products, programs, or services does not imply that IBM intends to make such products, programs or services available in all countries in which IBM operates or does business.

Workshops, sessions and associated materials may have been prepared by independent session speakers, and do not necessarily reflect the views of IBM. All materials and discussions are provided for informational purposes only, and are neither intended to, nor shall constitute legal or other guidance or advice to any individual participant or their specific situation.

It is the customer’s responsibility to insure its own compliance with legal requirements and to obtain advice of competent legal counsel as to the identification and interpretation of any relevant laws and regulatory requirements that may affect the customer’s business and any actions the customer may need to take to comply with such laws. IBM does not provide legal advice or represent or warrant that its services or products will ensure that the customer is in compliance with any law

Page 16: Using Service Discovery and Service Proxy

Notices and Disclaimers Con’t.

16

Information concerning non-IBM products was obtained from the suppliers of those products, their published announcements or other publicly available sources. IBM has not tested those products in connection with this publication and cannot confirm the accuracy of performance, compatibility or any other claims related to non-IBM products. Questions on the capabilities of non-IBM products should be addressed to the suppliers of those products. IBM does not warrant the quality of any third-party products, or the ability of any such third-party products to interoperate with IBM’s products. IBM EXPRESSLY DISCLAIMS ALL WARRANTIES, EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.

The provision of the information contained h erein is not intended to, and does not, grant any right or license under any IBM patents, copyrights, trademarks or other intellectual property right.

IBM, the IBM logo, ibm.com, Aspera®, Bluemix, Blueworks Live, CICS, Clearcase, Cognos®, DOORS®, Emptoris®, Enterprise Document Management System™, FASP®, FileNet®, Global Business Services ®, Global Technology Services ®, IBM ExperienceOne™, IBM SmartCloud®, IBM Social Business®, Information on Demand, ILOG, Maximo®, MQIntegrator®, MQSeries®, Netcool®, OMEGAMON, OpenPower, PureAnalytics™, PureApplication®, pureCluster™, PureCoverage®, PureData®, PureExperience®, PureFlex®, pureQuery®, pureScale®, PureSystems®, QRadar®, Rational®, Rhapsody®, Smarter Commerce®, SoDA, SPSS, Sterling Commerce®, StoredIQ, Tealeaf®, Tivoli®, Trusteer®, Unica®, urban{code}®, Watson, WebSphere®, Worklight®, X-Force® and System z® Z/OS, are trademarks of International Business Machines Corporation, registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at: www.ibm.com/legal/copytrade.shtml.

Page 17: Using Service Discovery and Service Proxy

Thank YouYour Feedback is Important!

Access the InterConnect 2016 Conference Attendee Portal to complete your session surveys from your

smartphone, laptop or conference kiosk.