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

Database scaling patterns

Database scaling patterns

Mariusz Gil

April 12, 2013
Tweet

More Decks by Mariusz Gil

Other Decks in Programming

Transcript

  1.          

    !"  #   $    %% & ' !(     !"  #    !"  # shared server
  2.          

    !"  #   $    %% & ' !(     !"  #    !"  # shared server
  3.          

    !"  #   $    %% & ' !(     !"  #    !"  # DB server
  4. DB server        

      !"  #   $    %% & ' !(     !"  #    !"  #           !"  #   $    %% & ' !(     !"  #    !"  # DB server
  5. DB server        

      !"  #   $    %% & ' !(     !"  #    !"  # DB server           !"  #   $    %% & ' !(     !"  #   )     !"  #     ) 
  6. DB server DB server      

        !"  #   $    %% & ' !(     !"  #   )     !"  #     )     #   $    %% & ' !(     !"  #    !"  # ID SENDER_ID RECEIVER_ID ... 1 10 1 2 20 2 3 10 1 4 20 3 5 10 1 6 20 4 7 10 1 USER_ID MESSAGE_ID 1 1 1 3 1 5 1 7 2 2 3 4 4 6 USER_ID MESSAGE_ID 10 1 10 3 10 5 10 7 20 2 20 4 20 6
  7. DB master        

      !"  #   $    %% & ' !(     !"  #   )     !"  #     )  DB slave           !"  #   $    %% & ' !(     !"  #   )     !"  #     )  DB slave           !"  #   $    %% & ' !(     !"  #   )     !"  #     )  ... INSERT... UPDATE... DELETE... SELECT... SELECT...
  8. DB master        

      !"  #   $    %% & ' !(     !"  #   )     !"  #     )  DB master           !"  #   $    %% & ' !(     !"  #   )     !"  #     )  INSERT... UPDATE... DELETE... SELECT...
  9. DB shard   $    %% &

    ' !(     !"  #   )     !"  #     )  DB shard           !"  #   $    %% & ' !(     !"  #   )     !"  #     )  DB shard           !"  #   $    %% & ' !(     !"  #   )     !"  #     )  INSERT... UPDATE... DELETE... SELECT... INSERT... UPDATE... DELETE... SELECT... INSERT... UPDATE... DELETE... SELECT...