Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Let's take care of our
micro-services
Samuel Roze
Inviqa
twitter.com/samuelroze
github.com/sroze
(micro)services
Monolith costs a lot...
(only) on the long run !
Microservices are
flexible
but introduces complexity!
Key points
» Organisation
» Deployment pipeline
» Monitoring & debugging
» Fault tolerance
Key points
Organisation
» In the teams
Spotify's squads: the team knows about their services
» Between the teams
Responsib...
Key points
Deployment pipeline
» New services
Create new services within hours
» Continuous Delivery
Small and fast deploy...
Key points
Monitoring and debugging
» Pro-active monitoring
health-checks
» Active error logging and alterting
know what i...
Key points
Fault tolerance
» Perfection, hopes or embracing faults
Because that will happen
» Architecture
A server dies
»...
Key points, again
» Organisation
» Deployment pipeline
» Monitoring & debugging
» Fault tolerance
Environments
Fault tolerance
Tolerance
 github.com/Tolerance/Tolerance
tolerance.io
Tolerance
Operations
Take something that can fail...
$comments = $client->getLastComments();
Wrap into an Operation
use ToleranceOperationCallback;
$operation = new Callback(function() use ($client) {
return $client...
Run the operation
$comments = $runner->run($operation);
 Be fault tolerant
by decorating the operation
runners
Retry
$waitStrategy = new CountLimited(
new ExponentialBackOff(
new SleepWaiter(),
1
),
10
);
$runner = new RetryOperation...
Fallback
$staticResultFactory = new StaticResultFactory([]);
$runner = new FallbackOperationRunner(
$decoratedRunner,
$sta...
Other operation
runners...
Rate limiting
$rateLimit = new LeakyBucket(
new InMemoryStorage(),
new TimeRate(10, TimeRate::PER_SECOND)
);
$runner = new...
Buffered (ie postponed runs)
$buffer = new InMemoryOperationBuffer();
$bufferedRunner = new BufferedOperationRunner($runne...
AppKernel.php
new ToleranceBridgeSymfonyBundle
ToleranceBundle();
Get runners from YAML
tolerance:
operation_runners:
default:
retry:
# ...
callback:
# ...
buffered:
# ...
fallback:
# ...
 Buffered runner
A lot of operations don't have to be executed just now.
$runner->run(new Callback(function() {
$this->pus...
 AOP
Aspect Oriented Programming
 AOP
tolerance:
aop: ~
Wrap your services into operations
just by using a tolerance.operation_wrapper tag
<services>
<service id="app.comments_cl...
Use your service as usual
$comments = $this->client->getLastComments();
Tolerance
 MessageProfile
MessageProfile
tolerance:
message_profile:
enabled: true
storage:
neo4j: neo4j_client_service_id
current_peer:
service: "My...
MessageProfile
Integrations
» Guzzle
» Monolog
» RabbitMqBundle
» HttpFoundation
» PSR-7
Thank you!
@samuelroze
https://github.com/Tolerance/Tolerance
https://joind.in/talk/2f75b
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Take care of our micro services
Upcoming SlideShare
Loading in …5
×

Take care of our micro services

218 views

Published on

Take care of our micro services

Published in: Software
  • Be the first to comment

  • Be the first to like this

Take care of our micro services

  1. 1. Let's take care of our micro-services
  2. 2. Samuel Roze Inviqa twitter.com/samuelroze github.com/sroze
  3. 3. (micro)services
  4. 4. Monolith costs a lot... (only) on the long run !
  5. 5. Microservices are flexible but introduces complexity!
  6. 6. Key points » Organisation » Deployment pipeline » Monitoring & debugging » Fault tolerance
  7. 7. Key points Organisation » In the teams Spotify's squads: the team knows about their services » Between the teams Responsibility boundaries, communication, shared goals
  8. 8. Key points Deployment pipeline » New services Create new services within hours » Continuous Delivery Small and fast deployments » Delivery as a Service The teams can change the technology stack themselves
  9. 9. Key points Monitoring and debugging » Pro-active monitoring health-checks » Active error logging and alterting know what is going on » Debugging after incident tracing between services
  10. 10. Key points Fault tolerance » Perfection, hopes or embracing faults Because that will happen » Architecture A server dies » Application A service is down or throwing exceptions
  11. 11. Key points, again » Organisation » Deployment pipeline » Monitoring & debugging » Fault tolerance
  12. 12. Environments
  13. 13. Fault tolerance
  14. 14. Tolerance  github.com/Tolerance/Tolerance tolerance.io
  15. 15. Tolerance Operations
  16. 16. Take something that can fail... $comments = $client->getLastComments();
  17. 17. Wrap into an Operation use ToleranceOperationCallback; $operation = new Callback(function() use ($client) { return $client->getLastComments(); });
  18. 18. Run the operation $comments = $runner->run($operation);
  19. 19.  Be fault tolerant by decorating the operation runners
  20. 20. Retry $waitStrategy = new CountLimited( new ExponentialBackOff( new SleepWaiter(), 1 ), 10 ); $runner = new RetryOperationRunner( $decoratedRunner, $waitStrategy );
  21. 21. Fallback $staticResultFactory = new StaticResultFactory([]); $runner = new FallbackOperationRunner( $decoratedRunner, $staticResultFactory ); // ... $messages = $runner->run($operation);
  22. 22. Other operation runners...
  23. 23. Rate limiting $rateLimit = new LeakyBucket( new InMemoryStorage(), new TimeRate(10, TimeRate::PER_SECOND) ); $runner = new RateLimitedOperationRunner( $decoratedRunner, $rateLimit, new SleepWaiter() );
  24. 24. Buffered (ie postponed runs) $buffer = new InMemoryOperationBuffer(); $bufferedRunner = new BufferedOperationRunner($runner, $buffer); // Run operations $bufferedRunner->run($firstOperation); $bufferedRunner->run($secondOperation); // ... // ... $results = $bufferedRunner->runBufferedOperations();
  25. 25. AppKernel.php new ToleranceBridgeSymfonyBundle ToleranceBundle();
  26. 26. Get runners from YAML tolerance: operation_runners: default: retry: # ... callback: # ... buffered: # ... fallback: # ...
  27. 27.  Buffered runner A lot of operations don't have to be executed just now. $runner->run(new Callback(function() { $this->pushMyBusinessMetricToElasticSearch(); })); » Run operations on kernel.terminate event
  28. 28.  AOP Aspect Oriented Programming
  29. 29.  AOP tolerance: aop: ~
  30. 30. Wrap your services into operations just by using a tolerance.operation_wrapper tag <services> <service id="app.comments_client" class="AppCommentsHttpClient"> <tag name="tolerance.operation_wrapper" methods="getLastComments" runner="tolerance.operation_runner.default" /> </service> </services>
  31. 31. Use your service as usual $comments = $this->client->getLastComments();
  32. 32. Tolerance  MessageProfile
  33. 33. MessageProfile tolerance: message_profile: enabled: true storage: neo4j: neo4j_client_service_id current_peer: service: "My service" environment: %kernel.environment% version: 12345
  34. 34. MessageProfile Integrations » Guzzle » Monolog » RabbitMqBundle » HttpFoundation » PSR-7
  35. 35. Thank you! @samuelroze https://github.com/Tolerance/Tolerance https://joind.in/talk/2f75b

×