Go micro with microservices

Go micro with microservices

34be88398f623c109b61d23e8215bd23?s=128

Mariusz Gil

August 20, 2016
Tweet

Transcript

  1. MICROSERVICES Go micro with Mariusz Gil mariuszgil

  2. None
  3. None
  4. THE STORY YOU KNOW

  5. None
  6. None
  7. None
  8. None
  9. MONOLITHꊾ Product Management UX Developers QA DB Admins Sys Admins

    Net Admins SAN Admins
  10. None
  11. None
  12. REASONS…

  13. T D D

  14. T D DHINK ESIGN EVELOP

  15. MICROSERVICES

  16. None
  17. LOOSELY COUPLED SERVICE ORIENTED ARCHITECTURE WITH BOUNDED CONTEXTS Adrian Cockcroft

  18. Product Management UX Developers QA DB Admins Sys Admins Net

    Admins SAN Admins
  19. Microservice Microservice Datastore Datastore Microservice Datastore Microservice

  20. Microservice Microservice Datastore Datastore Microservice Datastore Microservice

  21. INTEGRATION

  22. None
  23. UI COMPOSITION ESI / SSI / AJAX / IFRAME

  24. COMPOXURE MIDDLEWARE FOR EXPRESS

  25. None
  26. <div> <p>Widget 1</p> </div> <div> <p>Widget Two</p> <div cx-url='{{server:local}}/application/component1'></div> </div>

    <body> <div cx-url='{{server:local}}/application/component2'></div> </body> <body> <div cx-url='{{server:local}}/application/component2'> <div> <p>Widget Two</p> <div cx-url='{{server:local}}/application/component1'> <div> <p>Widget 1</p> </div> </div> </div> </div> </body>
  27. <div cx-url='{{server:local}}/application/widget' cx-cache-ttl='10s' cx-no-cache="\{{cookie:userId}}==={{authorId}}" cx-cache-key='widget:user:{{cookie:userId}}' cx-timeout='1s' cx-statsd-key=„widget_user"> This content won't

    be cached if the user is the author of the widget </div> <div cx-url='{{server:local}}/application/widget' cx-cache-ttl='10s' cx-cache-key='widget:user:{{cookie:userId}}' cx-timeout='1s' cx-statsd-key="widget_user"> This content will be replaced on the way through </div>
  28. API GATEWAY

  29. API Gateway Microservice Datastore Microservice Datastore Microservice Datastore

  30. BACKEND FOR FRONTEND

  31. STRUCTURING

  32. None
  33. TOOLING CONFIGURATION DISCOVERY ROUTING OBSERVABILITY DATASTORES OPERATIONS DEVELOPMENT POLICY

  34. TOOLING Docker Spinnaker CONFIGURATION Archaius Habitat DISCOVERY Zookeeper Consul ROUTING

    Compose
 Linkerd OBSERVABILITY Zipkin Histrix DATASTORES SQL
 NoSQL OPERATIONS Mesos
 Kubernetes DEVELOPMENT Docker Hub
 Artifactory POLICY Security and arch compliance
  35. YOU NEED A SKELETON

  36. THERE AIN’T NO SUCH THING AS A FREE LUNCH MILTON

    FRIEDMAN
  37. DISTRIBUTED COMPLEXITY

  38. None
  39. DISTRIBUTED LOGGING

  40. EVENTUAL CONSISTENCY

  41. ONE SERVICE MAY RUIN EVERYTHING

  42. Microservice Microservice Datastore Datastore Microservice Datastore Microservice Timeout Budget Failed

    request Failed request OK request
  43. $factory = new Ejsmont\CircuitBreaker\Factory(); $circuitBreaker = $factory->getSingleApcInstance(30, 300); $userProfile =

    null; 
 if( $circuitBreaker->isAvailable("UserProfileService") ){ try{ $userProfile = $userProfileService->loadProfileOrWhatever(); $circuitBreaker->reportSuccess("UserProfileService"); }catch( UserProfileServiceConnectionException $e ){ // network failed - report it as failure $circuitBreaker->reportFailure("UserProfileService"); }catch( Exception $e ){ // something went wrong but it is not service's fault, // dont report as failure } } if( $userProfile === null ){ // for example, show 'System maintenance, you cant login now.' message // but still let people buy as logged out customers. }
  44. ARE MICROSERVICES FOR ME…?

  45. None
  46. None
  47. MICROSERVICES Go micro with THANKS! mariuszgil