bob lee
play

Bob Lee @crazybob 2 ,000,000 Dim Sum Accepting a payment - PowerPoint PPT Presentation

Bob Lee @crazybob 2 ,000,000 Dim Sum Accepting a payment Authorization 1 Capture 2 Persistent Queues ACID Atomicity Durability Filesystem Promises Renaming is atomic Fsync is durable* Segment/block writes Traditional


  1. Bob Lee @crazybob

  2. 2 ,000,000

  3. Dim Sum

  4. Accepting a payment Authorization 1 Capture 2

  5. Persistent Queues

  6. ACID • Atomicity • Durability

  7. Filesystem Promises • Renaming is atomic • Fsync is durable* • Segment/block writes

  8. Traditional Strategies • Write, fsync, rename, fsync • Rollback log • Journal

  9. Tape github.com/square/tape

  10. Header Elements

  11. Header (16 bytes) • File length • Element count • First offset • Last offset

  12. Element • Length • Data

  13. Enqueueing Write data 1 Fsync 2 Write header 3 Fsync 4

  14. Dequeueing Read data 1 Write header 2 Fsync 3

  15. Expansion Set file length 1 Fsync 2 Copy data 3 Write header 4 Fsync 5

  16. What’s next? • Tape on the server • Elide the filesystem

  17. Server Stack

  18. Ruby

  19. Java

  20. One Repository

  21. One-Jar

  22. Self Executing Jars #!/usr/bin/java -Xmx2G -jar [jar file]

  23. Java Stack • Jetty • JAX-RS (Jersey) • JPA (Hibernate) • Guice • Dropwizard

  24. Rethinking Pub/Sub

  25. Capture Settlement Payment Processing Business Intelligence Risk etc.

  26. Producer Messaging Server Consumer

  27. Messaging Server Producer Messaging Server Consumer Messaging Server

  28. Synchronization Feeds Producer Consumer Retrieve all records Return all records and latest version V Retrieve all records since version V Return all records since V and latest version ...

  29. Constraints • Immutable sequence of events • Total order • Centralized server

  30. Bene fi ts • Email vs. RSS • Stateless • Fewer moving parts • Free bootstrapping!

  31. Further Ideas • Partitioning feeds • Caching and replicating feeds • Pubsubhubbub

  32. Dependency Injection

  33. Guice • Launched in ’06 • Used by Google, Facebook, Twitter, etc. • On version 3

  34. Dagger github.com/square/dagger • Supports JSR-330 • Provider methods only • Uses code generation • Compile time validation • No custom scopes • No circular dependencies

  35. corner.squareup.com

  36. github.com/square

  37. @crazybob

  38. Questions ?

Recommend


More recommend