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

A Look At Micro Service Architecture

geevcookie
October 03, 2014

A Look At Micro Service Architecture

Micro-Service architecture has been around for a while now, but there is still no clear way to implement it in PHP. During this talk we will be taking a look at a couple of ways to implement it.

geevcookie

October 03, 2014
Tweet

More Decks by geevcookie

Other Decks in Programming

Transcript

  1. Oh Hai There • My name is Zander Janse van

    Rensburg • I'm the lead PHP developer at BlackLight • Organizer of JoburgPHP1 1 JoburgPHP is so awesome that some of the CPT guys have considered flying up to join our meetups.
  2. Places You Can Find Me • Github: geevcookie • Twitter:

    geevcookie or joburgphp • Web: http://geevcookie.com/ • SpeakerDeck: geevcookie
  3. Monolithic/Layered • Built as a single unit (All business logic,

    view, and data persistence in same application) • Default architecture when using popular modern frameworks
  4. Pros • Easy to understand (If properly structured) • Most

    of us are used to this form of architecture • Easy to document
  5. Cons • Entire app needs to be built on deployment

    • Entire app needs to be up and running for development • Can be frustrating and cause technical debt if not managed properly
  6. Micro Services • Small independent pieces of code • Less

    than 100 lines of code • Smart Endpoints / Dumb Bus
  7. Pros • Can be deployed separately • Can be developed

    separately • Easy for new developers to start development • Code is disposable • Can be coded in any language (Well almost... When done properly)
  8. HTTP As Bus • Responds to JSON RPC • Self

    contained "mini apps" • Needs to live under web server document root
  9. RabbitMQ As Bus • Long running service connected to RabbitMQ

    queue • Uses RabbitMQ's built in RPC functionality
  10. Pros • More scalable • RabbitMQ clusters • Multiple services

    can listen to same queue • Still fairly easy to understand (With some help)
  11. The Hero • Bindings for multiple languages • No extra

    services required • Highly customizable
  12. ZeroMQ • Carries messages across inproc, IPC, TCP, TPIC, multicast.

    • Smart patterns like pub-sub, push-pull, and router-dealer. • High-speed asynchronous I/O engines, in a tiny library. • Build any architecture: centralized, distributed, small, or large. • Free software with full commercial support.
  13. Some Supported Languages Ada, Bash, Basic, C, Common Lisp, C#,

    C++, delphi, Erlang, F#, Flex, Go, Haskell, Haxe, Java, Lua, Node, Objective-C, Perl, PHP, Python, Ruby, Scala, Tcl, Smalltalk
  14. Pros • Smart end points are easy to create •

    Services can be on different servers
  15. Pros • Round robin load balancing between end points •

    Services can still be located on different servers • More reliability
  16. Cons • Still not enough reliability. • More end points

    available, but are they really still there • Broker is still a single point of failure
  17. Request/Response Broker (Heartbeat) • Added heartbeat functionality • Broker constantly

    checks if end points are still connected • End points constantly check if broker is still accessible • Client has proper timeouts and retries
  18. Pros • More reliable • Constant logs of communication between

    broker and end points • Better client connection
  19. Request/Response Broker (Balanced) • App still connects to broker and

    broker distributes to end points • Brokers communicate to offload extra jobs
  20. Monitoring (Supervisor) • Checks if services are running and restarts

    if required • Provides stop/start/restart functionality to services via control script • Adds API to check status of services etc.
  21. Management (Yogurt) • Talks to Supervisor, etcd, and custom client.

    • Can install client to servers automatically. • Provides easy scaling of services.
  22. Big Dreams • Self healing and scaling solution • Connects

    to provider such as Digital Ocean to scale servers as well • Logstash and Machine Learning provides accurate(ish) scaling based on history