Top Banner
SERVICE DISCOVERY AND CONFIGURATION MANAGEMENT AT TRANSFERWISE
87

Service discovery and configuration management at TransferWise

Feb 07, 2017

Download

Software

Dataloop.IO
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Service discovery and configuration management at TransferWise

SERVICE DISCOVERY AND CONFIGURATION MANAGEMENT AT

TRANSFERWISE

Page 2: Service discovery and configuration management at TransferWise

FIRST INTRODUCTIONS

Page 3: Service discovery and configuration management at TransferWise

INTROS

Page 4: Service discovery and configuration management at TransferWise
Page 5: Service discovery and configuration management at TransferWise
Page 6: Service discovery and configuration management at TransferWise

FAMOUS FOR

Page 7: Service discovery and configuration management at TransferWise

ESTONIAN FOUNDERS

Page 8: Service discovery and configuration management at TransferWise

EVANGELICAL CUSTOMERS

Page 9: Service discovery and configuration management at TransferWise

$1 BILLION IN TRANSFERS PER MONTH

Page 10: Service discovery and configuration management at TransferWise

SAVING OUR CUSTOMERS $50MPER MONTH

Page 11: Service discovery and configuration management at TransferWise

ENGINEERING CULTURE

Page 12: Service discovery and configuration management at TransferWise

WEAK CODE OWNERSHIP

Page 13: Service discovery and configuration management at TransferWise

EVERY PART OF THE CODE IS OWNED

Page 14: Service discovery and configuration management at TransferWise

ANY TEAM CAN CHANGE ANY PART OF THE CODE

Page 15: Service discovery and configuration management at TransferWise

ENGINEERING FOR CUSTOMER IMPACT

Page 16: Service discovery and configuration management at TransferWise

ENGINEERS GET CLOSE TO CUSTOMERS AND MAKE DECISIONS

BASED ON DATA

Page 17: Service discovery and configuration management at TransferWise

SOME OF OUR TEAMS SERVICES NEED TO BE HIGHLY RESPONSIVE,

SYNCHRONOUS AND SCALE REALLY WELL

Page 18: Service discovery and configuration management at TransferWise

OUR PLATFORM TEAM IS 8 PEOPLE STRONG

WITH A HUGE BACKLOG

Page 19: Service discovery and configuration management at TransferWise

HOW DID WE HANDLE IT BEFORE?

Page 20: Service discovery and configuration management at TransferWise

AN ENGINEER ASKS FOR A PRODUCTION SERVICE

Page 21: Service discovery and configuration management at TransferWise

AND WAITS…

Page 22: Service discovery and configuration management at TransferWise

WAITS SOME MORE…

Page 23: Service discovery and configuration management at TransferWise

ASKS AGAIN…

Page 24: Service discovery and configuration management at TransferWise

WAITS SOME MORE…

Page 25: Service discovery and configuration management at TransferWise

GETS A SERVICE

Page 26: Service discovery and configuration management at TransferWise

NEEDS TO CHANGE PRODUCTION CONFIG

Page 27: Service discovery and configuration management at TransferWise

WAITS…

Page 28: Service discovery and configuration management at TransferWise

THIS NEEDS TO STOP

Page 29: Service discovery and configuration management at TransferWise

TOO MUCH CHATTERTOO LONG WAITS

STRESS FOR EVERYONE

Page 30: Service discovery and configuration management at TransferWise

CUSTOMERS SUFFER

Page 31: Service discovery and configuration management at TransferWise

WE NEED:AUTOMATIC ALLOCATION

PROVISIONINGLOGGING AND MONITORING

WITHOUT ENGINEERS

Page 32: Service discovery and configuration management at TransferWise

SERVICE DISCOVERY CAN HELP

Page 33: Service discovery and configuration management at TransferWise

RESEARCH AND TEX

Page 34: Service discovery and configuration management at TransferWise
Page 35: Service discovery and configuration management at TransferWise
Page 36: Service discovery and configuration management at TransferWise

WHICH DISCOVERY APPROACH TO CHOOSE?

Page 37: Service discovery and configuration management at TransferWise

CLIENT SIDE DISCOVERY

Page 38: Service discovery and configuration management at TransferWise

SELF REGISTRATION

Page 39: Service discovery and configuration management at TransferWise
Page 40: Service discovery and configuration management at TransferWise

NETFLIX OSS IS OUR WAY TO GO

Page 41: Service discovery and configuration management at TransferWise

PROOF OF CONCEPT

Page 42: Service discovery and configuration management at TransferWise
Page 43: Service discovery and configuration management at TransferWise

MAKE OUR MONOLITH CONSUME 1 SERVICE IN PRODUCTION

Page 44: Service discovery and configuration management at TransferWise
Page 45: Service discovery and configuration management at TransferWise

UNDERSTANDING THE SCOPE

Page 46: Service discovery and configuration management at TransferWise

Problem: making friends between spring cloud and anything else except spring boot can be tricky. There is no good

adoption mechanism

Page 47: Service discovery and configuration management at TransferWise

Solution: grails and spring are close. Let’s read the source, find out what hides beyond spring boot’s netflix-specific

annotations, mimic the approach it was designed for

Page 48: Service discovery and configuration management at TransferWise

Lets create a shared bean in the discovery space (used by our monolith parts that consumes the config and starts

communication with Eureka)

Page 49: Service discovery and configuration management at TransferWise

Step 2: Let’s start a Ribbon LoadBalancer in that bean, connect it with Eureka client and let him start listening for

apps

Page 50: Service discovery and configuration management at TransferWise

Step 3: Most of our communication is through restTemplate. How can we make restTemplate awesome

and @LoadBalanced? Interceptors! Let’s build one

Page 51: Service discovery and configuration management at TransferWise

Step 4: Let’s add the interceptor to the needed RestTemplate

Step 5: What if discovery completely fails? Fallbacks!

Page 52: Service discovery and configuration management at TransferWise

IS THIS A PERFECT SOLUTION? OF COURSE NOT!

Page 53: Service discovery and configuration management at TransferWise

NEED TO MAINTAINTIED TO RESTTEMPLATES

NEEDS ENGINEERS TO THINK ABOUT IT

Page 54: Service discovery and configuration management at TransferWise

NOT GOOD ENOUGH

Page 55: Service discovery and configuration management at TransferWise

BUILD CLIENTS AND MAKE EVERY CASE WORK AS A BLACK BOX

Page 56: Service discovery and configuration management at TransferWise

IF YOUR SERVICE WANTS TO BE DISCOVERED - MAKE YOUR CLIENT

PROVIDE THE TOOLSET

Page 57: Service discovery and configuration management at TransferWise

PROBLEMS

Page 58: Service discovery and configuration management at TransferWise

SOME SERVICES HAVE A EUREKA CLIENT OF THEIR OWN

EUREKA IS NOT USED TO IT (CONFIGURATIONS ARE STORED IN A CONTEXT BEAN)

RESULTING IN OVERRIDES UNLESS CONTROLLED

Page 59: Service discovery and configuration management at TransferWise

TESTING IS PROBLEMATICAS REQUIRES A FULL COPY OF PRODUCTION

TESTING THE PIECES IS COMPLETELY ON THE ADOPTING ENGINEER

Page 60: Service discovery and configuration management at TransferWise

CHALLENGES

Page 61: Service discovery and configuration management at TransferWise

VARIATION IN HTTP COMMS AND IMPLEMENTATIONS

Page 62: Service discovery and configuration management at TransferWise

FEIGN AS A CLIENT BUILDERDIRECT FALLBACKS

HYSTRIX CIRCUIT BREAKINGSPLITTING BALANCING AND DISCOVERY

BETWEEN SERVICES

Page 63: Service discovery and configuration management at TransferWise

SOLUTION COMPATIBILITYSPRING BOOT

EUREKARIBBON

SUPPORTING TOOLSET

AROUND 75% ADOPTION PROBLEMS

Page 64: Service discovery and configuration management at TransferWise

3 MONTHS30 SERVICES IN PRODUCTION

20 MORE IN THE MAKING

Page 65: Service discovery and configuration management at TransferWise

E

Page 66: Service discovery and configuration management at TransferWise

GREATNOW WE HAVE LOTS OF SERVICE

CONFIG TO TRACK

Page 67: Service discovery and configuration management at TransferWise

LET’S MAKE THINGS AS BORING AS POSSIBLE

Page 68: Service discovery and configuration management at TransferWise

LET’S PUT EVERYTHING IN (PUPPET | CHEF | SALT | ANSIBLE)

Page 69: Service discovery and configuration management at TransferWise

JOB DONE

Page 70: Service discovery and configuration management at TransferWise

EXCEPT…

Page 71: Service discovery and configuration management at TransferWise

SECRET MANAGEMENT IS TRICKY

Page 72: Service discovery and configuration management at TransferWise

WE CAN MAKE IT WORK. BUT IS THERE A LESS TEDIOUS WAY?

Page 73: Service discovery and configuration management at TransferWise

SPRING CLOUD CONFIG SERVER

NETFLIX ARCHAIUS

HASHICORP VAULT

Page 74: Service discovery and configuration management at TransferWise

NICE DOCUMENTATION: HTTPS://CLOUD.SPRING.IO/SPRING-CLOUD-

CONFIG/SPRING-CLOUD-CONFIG.HTML

Page 75: Service discovery and configuration management at TransferWise

NAME/VALUE PAIRS

/ENCRYPT & /DECRYPT ENDPOINTS

EASY TO EMBED IN SPRING BOOT APPLICATIONS

Page 76: Service discovery and configuration management at TransferWise

SIMPLE REST API, SO PLAYS WELL WITH NON-SPRING TOO!

Page 77: Service discovery and configuration management at TransferWise

SUPPORTS TEMPLATE FILES… BUT WE’VE NOT USED THEM

Page 78: Service discovery and configuration management at TransferWise
Page 79: Service discovery and configuration management at TransferWise

SECRETS DON’T NEED TO BE STORED IN PLAIN TEXT:

/ENCRYPT/DECRYPT

Page 80: Service discovery and configuration management at TransferWise

VAULT BACKEND: REQUIRES A TOKEN FROM CLIENT

FAILFAST VS RETRY

Page 81: Service discovery and configuration management at TransferWise

GETTING IT INTO PRODUCTION:

“VOLUNTEERED” A FEW SERVICE OWNERS

Page 82: Service discovery and configuration management at TransferWise

EVERYTHING WORKED SMOOTHLY. VERY SUSPICIOUS.

Page 83: Service discovery and configuration management at TransferWise

BUGS FOUND!

Page 84: Service discovery and configuration management at TransferWise

GITHUB DOWN: CONFIG SERVER GOES MENTAL

CONFIG SERVER CACHES LOCALLY, BUT ALSO WILL ALWAYS CHECK FOR

NEW CONFIG IN THE REPO

Page 85: Service discovery and configuration management at TransferWise

VERY INFREQUENTLY… IT JUST DIES

AND WE DON’T KNOW WHY (YET)

(NEVER HAD >1 NODE DIE AT ONCE, SO NOT AWFUL IMPACT, BUT CONCERNING)

Page 86: Service discovery and configuration management at TransferWise

RESULT: SERVICES ARE GETTING INTO PRODUCTION FASTER

Page 87: Service discovery and configuration management at TransferWise

Let us change money transfer forever. Together.

https://transferwise.com/jobs/