Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Go micro with microservices

Go micro with microservices

Mariusz Gil

August 20, 2016
Tweet

More Decks by Mariusz Gil

Other Decks in Programming

Transcript

  1. <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>
  2. <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>
  3. 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
  4. $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. }