Micro service pitfalls voxxed days istanbul 2015

47
Mite Mitreski Voxxed Days Istanbul - 9 May 2015 @mitemitreski Reactive and microservice pitfalls

Transcript of Micro service pitfalls voxxed days istanbul 2015

Mite Mitreski

Voxxed Days Istanbul - 9 May 2015

@mitemitreski

Reactive and microservice pitfalls

What is reactive programming?

Reactive programming is _______

a) Hypeb) Awesomec) Differentd) Just the observer patterne) Microsoft Excelf) Manifestog) All of above

http://www.reactivemanifesto.org/

Responsive

Message Driven

ResilientElastic

Microservices

The monolith Microservices

Monolithic Architecture

The monolith

● Componentization is via Services● Often organized around Tech abilities

○ UI Expert teams○ Backend or middleware developers○ DBA’s

… organizations which design systems

... are constrained to produce designs

which are copies of the communication

structures of these organizations...—Melvin Conway

The microservices

● Organized around Business Capabilities● Products not Projects

○ development team takes full responsibility for the software in production

○ "you build, you run it" - aka the Amazon way● SOA done right?

Decentralized Governance

Java EE

Clojure

Ruby

C# app

Spring based

Spring with tab indentation

Decentralized Governance

Java EE

Clojure

Ruby

NodeJS

Spring based

Spring with tab indentation

V2 replaced C# with NodeJS

Other microservice benefits

● Decentralized Data Management● Evolutionary Design

Microservices are the unix way

This is the Unix philosophy: Write programs that do one thing and do it well. Write programs to work together. Write programs to handle text streams, because that is a universal interface.

Doug McIlroy, head of the Bell Labs CSRC (Computing Sciences Research Center), and inventor of the Unix pipe

Mike Gancarz: The UNIX Philosophy

1. Small is beautiful.

2. Make each program do one thing well.

3. Build a prototype as soon as possible.

4. Choose portability over efficiency.

5. Store data in flat text files.

6. Use software leverage to your advantage.

7. Use shell scripts to increase leverage and portability.

8. Avoid captive user interfaces.

9. Make every program a filter.

With all the frameworks out there what do I pick?

Reactive Microservices?

How NOT to FAIL @ Microservices?

#1 How big is too big?

As big as a piece of Baklava?

#2 Each service on it’s own repo

● Each service should be on a separate VCS root○ Physical code separation

● Various dependencies temptations not possible

#3 What to standardize

Java EE

Clojure

Ruby

NodeJS

Spring based

Spring with tab indentation

Standardize interface

Free for all

#4 How do test all of this?

NodeJSS2App

S1

NodeJSMock

App

Mock

End 2 end

#5 Coupling avoidance

● Function coupling● Data structure coupling● Temporal coupling● URI coupling

#5 Coupling avoidance

● RPC (RMI)● CORBA● Shared Serialization● SOAP● Resources (REST)

#6 Avoid distributed transactions

Space B

Space B

JINI/Gigaspaces example

Space A

SOME APP

#7 Monitoring is essential

Java EE

Clojure

Ruby

NodeJS

Spring based

Spring with tab indentation

#7 Monitoring is essential

Spring Boot - Actuator

JMX

Custom HTTP monitoring

Gigaspaces UI

#8 Use tracking ID

Clojure

Spring App

NodeJS

ID : 223-305

#8 Use tracking ID

Clojure

Spring App

NodeJS

ID : 223-305

ID : 223-305

#8 Use tracking ID

Clojure

Spring App

NodeJS

ID : 223-305

ID : 223-305

ID : 223-305

#12 Design for failure

#14 Move to production individually

PROD

S2 1.0.0

S1 1.0.0

App 1.0.0

TEST

S1 1.0.0

App 1.0.0

S2 1.0.0

#14 Move to production individually

PROD

S2 1.0.0

S1 1.0.0

App 1.0.0

TEST

S1 1.0.1

App 1.0.0

S2 1.0.0

#14 Move to production individually

PROD

S2 1.0.0

S1 1.0.1

App 1.0.0

TEST

S1 1.0.1

App 1.0.0

S2 1.0.0

#15 Stability ?

● Timeouts● Circuit breakers● Bulkheads● Handshakes

#16 Make batch calls if possible

ServiceClient

#16 Make batch calls if possible

ServiceClient

Are Microservices the Future?

Who uses microservices ?

Trends

Amazon’s SOA way

Standing in the shoulders of giants

Summary

Microservices are awesome but be aware of the challenges and make sure you use best practices.

Operation and resilience are the biggest overheads.

SummaryEnsure your team is up to the task and you really need it !

Ensure you have DevOps experties.

Start small and make adjustments as needed.

Summary

Questions