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

Microservices késako

Boris Feld
October 17, 2015

Microservices késako

What is a microservices? A tale of computer company. A presentation of micro-services and how to create them with ZeroServices, a python micro-services framework.

Boris Feld

October 17, 2015
Tweet

More Decks by Boris Feld

Other Decks in Programming

Transcript

  1. - Disclaimer « Any resemblance to actual events, to persons

    living or dead, is not the result of chance. It is DELIBERATE »
  2. If I have to play the whole test suite once

    again, I’m good for another therapy
  3. If I have to deploy this project and maintain it,

    I will be able to buy a new car with the on-cull duty
  4. WHY? • Monolith • Hard to change • Inertia for

    refactoring / improvement • « Container carrier » size
  5. MICROSERVICES • Small isolated cooperative units • Aim to reduce:

    • FEAR OF CHANGE • Complexity • Inertia
  6. ZEROSERVICES • A framework for all theses bricks • And

    a reference implementation for all of them • Python 3.4 • Asynchronous / Asyncio • Changes are broadcasted as events
  7. RESOURCE-ORIENTED • REST without HTTP • One and unique way

    to do CRUD operation • Valuable when combined with broadcasted changes
  8. REST API • Bind your endpoints to your code •

    What about websocket API? • Or IRC?
  9. WHAT IT LOOKS LIKE? RESOURCE SERVICE loop = asyncio.get_event_loop() medium

    = ZeroMQMedium(loop, UdpDiscoveryMedium) service = ResourceService('power_service', medium) service.register_resource(MongoDBCollection("power", "db")) loop.run_until_complete(todo.start()) loop.run_forever()
  10. REAL-TIME REST API loop = asyncio.get_event_loop() medium = ZeroMQMedium(loop, UdpDiscoveryMedium)

    service = ResourceService('rest_api', medium) application = get_http_interface(service, loop, port=5001, allowed_origins="*") application = loop.run_until_complete(application) loop.run_until_complete(service.start()) loop.run_forever()
  11. PROBLEMS WITH MICRO- SERVICES • Micro-service needs to know where

    are the others. • Made testing difficult. • Framework should abstract that. • Start without DevOps burdens.
  12. COMBINED loop = asyncio.get_event_loop() medium = ZeroMQMedium(loop, UdpDiscoveryMedium) service =

    ResourceService('power_service', medium) service.register_resource(MongoDBCollection("power", "db")) application = get_http_interface(service, loop, port=5001, allowed_origins="*") application = loop.run_until_complete(application) loop.run_until_complete(todo.start()) loop.run_forever()
  13. EXPOSED VIA WEBSOCKET • Changes exposed via real-time endpoint (websocket,

    etc…) • Easy to consume as REST-oriented • Works great with React / Flux