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

Why write components running on it's own process

Why write components running on it's own process

Avatar for Felix Sun

Felix Sun

August 20, 2015

Other Decks in Programming

Transcript

  1. this is a process, it uses resources like: 1. cpu

    2. memory 3. network bandwidth 4. network/disk io
  2. requests grows, the process uses more resources, at certain time

    the process exhaust all this server resources
  3. requests grows more, you find out that the process is

    still the bottleneck, which means resources it is using grows faster rpc calls
  4. then put the same process on more servers, so each

    of them use fewer resources rpc calls
  5. continue find out which part of the process eating resources

    faster, adding more servers, splitting out more components
  6. finally you find out: 1. any scalable system is composed

    with different type of components 2. which running as process on different servers 3. which connect each other through network with rpc calls
  7. although it adds overhead and complicity when doing rpc, but

    in order to scale to more computers, it has to be done
  8. already known between process communications: 1. nginx <=> your app

    2. your app <=> mysql database 3. your app <=> redis So it is natural to put nginx in one server, and mysql into another server
  9. So. instead of writing one bloated process, which can not

    scale, Let’s build smaller component that do one kind of thing well, standalone as process, and can talk to outside with it’s open interfaces. this could bring: 1. smaller isolated codebase 2. easier to grasp, understand 3. easier to maintain 4. easier to test 5. more importantly it brings scalability, and high availability
  10. we could unify the interfaces rpc call definition with protocol

    buffers and gRPC for example. (OK.. this is an AD for gRPC)