Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

(micro)services avec Symfony et Tolerance

722 vues

Publié le

Microservice architectures are a way of supporting fast growing applications. The incredible amount of advantages of these architectures also come with a set of challenges such as the deployment pipeline, the monitoring/debugging of the services, or even the fault tolerance of the services.

Symfony applications are obviously able to power such architecture design and we'll see how to tackle some of these challenges with libraries such as Tolerance or tools such as Kubernetes, an orchestration layer for Docker containers.

Publié dans : Logiciels
  • Soyez le premier à commenter

(micro)services avec Symfony et Tolerance

  1. 1. (micro)services avec Symfony et Tolerance
  2. 2. Samuel Roze Inviqa / SensioLabs UK @samuelroze github.com/sroze
  3. 3. (micro)services
  4. 4. The monolith
  5. 5. Maintenance très chère
  6. 6. SOA
  7. 7. Microservices
  8. 8. Fléxibilité
  9. 9. Points clés » Organisation » Déploiement » Monitoring » Résiliance » Debugging
  10. 10. Points clés Organisation » Responsabilité humaine (équipe) » Responsabilité technique (boudaries) » Communication humaine (objectifs communs) » Communication technique (documentation, BC, ...)
  11. 11. Points clés Déploiement » Continuous Deployment » Continuous Delivery » Simple (Platform.sh, ContinuousPipe.io, ...) » Scalable (AWS, Google Cloud, ...)
  12. 12. Points clés Monitoring » User-end monitoring (NewRelic, Google Analytics, ...) » Infrastructure monitoring (NewRelic, Sysdig, Datadog, ...) » Application monitoring (StatsD, ELK, Keen.io, ...) » Pro-active monitoring
  13. 13. Points clés » Organisation » Déploiement » Monitoring » Résiliance » Debugging
  14. 14. Tolerance  github.com/Tolerance/Tolerance tolerance.io
  15. 15.  Résiliance
  16. 16. Une opération $comments = $client->getLastComments();
  17. 17. Une opération use ToleranceOperationCallback; $operation = new Callback(function() use ($client) { return $client->getLastComments(); });
  18. 18. Runner $comments = $runner->run($operation);
  19. 19.  Résiliance aux erreurs
  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. Résiliance aux attaques
  23. 23. Rate limiting $rateLimit = new LeakyBucket( new InMemoryStorage(), new TimeRate(10, TimeRate::PER_SECOND) ); $runner = new RateLimitedOperationRunner( $decoratedRunner, $rateLimit, new SleepWaiter() );
  24. 24. D'autres types de runners...
  25. 25. Buffered $buffer = new InMemoryOperationBuffer(); $bufferedRunner = new BufferedOperationRunner($runner, $buffer); // Run operations $bufferedRunner->run($firstOperation); $bufferedRunner->run($secondOperation); // ... // ... $results = $bufferedRunner->runBufferedOperations();
  26. 26. Symfony!
  27. 27. AppKernel.php ToleranceBridgeSymfonyBundleToleranceBundle();
  28. 28. Runners with YAML tolerance: operation_runners: default: retry: runner: callback: ~ waiter: count_limited: count: 10 waiter: exponential_back_off: exponent: 1 waiter: sleep: ~
  29. 29.  Buffered terminaison » Automatically with factory » Manual runners needs to be tagged <service id="app.my_buffered_operation_runner" class="ToleranceOperationRunnerBufferedOperationRunner"> <!-- Arguments... --> <tag name="tolerance.operation_runner" /> </service>
  30. 30.  AOP
  31. 31.  AOP tolerance: aop: ~
  32. 32. AOP <services> <service id="app.comments_client" class="AppCommentsHttpClient"> <tag name="tolerance.operation_wrapper" methods="getLastComments" runner="tolerance.operation_runner.default" /> </service> </services>
  33. 33. AOP $comments = $this->client->getLastComments();
  34. 34. Debugging » Sentry » Tideways » NewRelic » Logs "manuels" » ...
  35. 35. Tolerance  MessageProfile
  36. 36. MessageProfile tolerance: message_profile: enabled: true storage: neo4j: neo4j_client_service_id current_peer: service: "My service" environment: %kernel.environment% version: 12345
  37. 37. MessageProfile Integrations » Guzzle » Monolog » RabbitMqBundle » Symfony » HttpFoundation » PSR-7
  38. 38. Merci! @samuelroze https://github.com/Tolerance/Tolerance https://joind.in/event/nouveau-sfpot--lille-le-3103-

×