by shigemk2

当面は技術的なことしか書かない

memo buiding distributed system with akka #ScalaMatsuri

buiding distributed system with akka #ScalaMatsuri

  • anildigital
  • anil wadghule

intro

  • from india to japan
  • anime
  • sushi ramen

current scene in internet

  • akka
  • size of internet

    • growing
  • concurrent connection

    • IoT
  • big data

  • cheap hardware

  • cluster
  • multiple
  • fast network
  • bigdata streams of data

  • HA S fault

    • Google
  • High Scalable
    • Google
  • Fault Tlerant
    • FB
  • Reactive Principle
    • Responsive
    • Elaastic
    • Resilient
    • Message Driven

Distibuted System

  • computer
  • syncronized
  • no global clock
  • Leslie Lamport A guide to builindg
  • Tanenbaum and Steen Distibuted

  • Distributed Architecture

  • Fallacies of Distributed System
  • 0 Latency
  • Bnadwidth
  • network
  • No Change Topology

Example

  • Amazon
  • Cassandra
    • (no local splite db)

How do we scale

  • Cofeeshop
  • Regular small app
  • replication/sahrding/consistent hasing
    • replica head barista/assistant barista
  • issue
    • complexity
    • consistency
  • sharding
    • ad more writers
    • split orders with some key
    • A-C J-L by key
    • good tecnique for scaling
  • issue
    • limit data
    • more complexity
    • lmited data access patterns
    • only good for certain kind of applications
      • SAAS
  • Consistent hassing
    • consistent hasing and random trees
    • e.g. akira to 9F72
    • hash number
    • any other
    • node clash→replication factor hash number in some nodes
    • consistency formula
    • R + W > N
      • total number of replica
      • number of replicas acknowledge my update
      • number of replicas
    • scale transaction data
    • CAP Theorem
    • partition tolerance
  • CAP partitiong not negotiated
  • availability or consistency

distributed transactions

  • ACID
    • principles for database
  • receive order process payment
  • paralellization/uneven workloads

  • scatter gatther

fault tolerance

  • embraces the notion of failure
    • components
    • accounting for evey possible fault
  • catch-all mecanism
  • terminate as soon as uncaught failure

Javaconcurrent logs processor

  • difficult to recover
  • what we need is faulty component replaced in a threadable
  • fault isolation
  • structure
  • redundancy
  • replacement
  • reboot
  • suspend

resilience

  • capacity to recover
  • financial losses

actor model

  • akka
  • jvm actor model
    • normal flow
    • fault recovery flow
  • filewatcher logprocessor dbwriter
    • diskerror
    • corrupt fileexception
    • multiple
  • fualt isolation

    • reboot
    • structure
    • redundancy
    • replacement
    • reboot
    • component lifecycle
    • suspend
  • akka

    • akka cluster
    • akka remote
    • akka io
    • akka core
  • local actor
  • remote actor
  • scheduling
  • routing
  • cluster
  • sharding
  • persistence
  • local actor →corrdinator actior

akka remoting

  • actor on jvm 1 → actor on jvm 2
  • port

akka cluster

  • akka cluster
    • fault tolerant membership service for akka
    • no sngle point of failure or bottleneck
    • akka cluster
  • allows dynamically grow
  • leader node node seed node
  • akka cluster
    • nodes

akka cluster features

  • cluster membership

akka gossip protocol

  • decentraised probabilistic
  • convergence

  • failure detector

  • seed node
  • up leaving unreachable exiting down
  • removed
  • cluster singleton

  • cluster sharding distribute actors across several nodes

  • interact with them with local

  • shard corrdinator/shard region/shard

  • akka dirstrbuted data
  • akka cluster
    • based on CRDTs
  • less difficult