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

Distributed Domain Destruction - Adventures in building distributed systems

Distributed Domain Destruction - Adventures in building distributedย systems

For the last three years I have been building, maintaining and fighting a few projects that make use of distributed computing, parallel processing, message brokers, queues and workers. This is one of those "from the trenches" talks, where I will regale you with tales about the series of unfortunate events that may happen as your application grows in complexity. Tales like disk space fluctuations, importance of logging, NoSql problems, restructuring your order of execution in code for performance gains, short sighted albeit logical architectural decisions that will cost you in the long run.

Come hear about the agony you will experience when it starts falling apart, and the thrill you will feel when everything is running juuust right.

Vranac Srdjan

May 13, 2017
Tweet

More Decks by Vranac Srdjan

Other Decks in Programming

Transcript

  1. DDD
    ADVENTURES IN BUILDING
    DISTRIBUTED SYSTEMS
    1 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  2. business owner, developer, consultant, mercenary,
    writing terrible code that performs exceptionally,
    wrangling elePHPants and Pythons, obsessed with
    process automation, interested in continuous integration
    and delivery, clean code, testing, best practices and
    distributed systems
    2 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  3. WARNING
    3 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  4. DDD
    4 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  5. DISTRIBUTED
    5 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  6. DOMAIN
    6 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  7. DESTRUCTION
    7 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  8. WHAT IS
    A DISTRIBUTED SYSTEM?
    8 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  9. THE SIMPLE DEFINITON
    It is a system where you can distribute processing of
    costly tasks to other workers.
    By costly taks I mean anything ranging to heavy
    computation and cpu utilization to long running
    processes.
    If we are talking in the context of web applications,
    basically anything that can't be done within a request is
    a candidate for distribution/background processing.
    9 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  10. A MORE REALISTIC DEFINITION
    A distributed system is one in which the failure
    of a computer you didn't even know existed can
    render your own computer unusable.
    โ€” Leslie B. Lamport, 1987
    10 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  11. 11 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  12. 12 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  13. 13 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  14. 14 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  15. CONGRATULATIONS
    15 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  16. FINITE EXPANSE OF
    THE UNOPENING WALLET
    16 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  17. 17 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  18. 18 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  19. DAEMONS...
    DAEMONS EVERYWHERE
    19 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  20. SUPERVISOR
    UPSTART
    20 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  21. 21 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  22. LOG AND COUNT
    EVERYTHING
    22 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  23. AGGREGATE AND SEE
    23 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  24. 24 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  25. STATSD
    25 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  26. ...BECAUSE
    LOGS AND COUNTERS
    ARE LYING TO YOU
    26 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  27. WHAT HAPPENED TO
    40 MILLION RECORDS,
    WHERE HAVE THEY GONE?
    27 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  28. WHAT IS DYNAMODB?
    28 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  29. TEMPORAL TABLES
    YOU SAY?
    29 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  30. ARE WE WRITING DATA TO
    THE DYNAMODB?
    30 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  31. THE LOGS ARE CLEAN,
    THE METRICS ARE GREEN
    31 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  32. NO EXCEPTIONS?
    32 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  33. 33 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  34. WHAT THE HELL
    DID I JUST READ?
    34 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  35. I CAN HAZ ERROR
    HANDLING NAO?
    LOL NO
    35 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  36. 36 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  37. THIS WORKER IS FAST,
    THAT WORKER IS SLOW,
    WHICH ONE WILL CRASH
    THE DATABASE,
    NOBODY KNOWS
    37 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  38. TIMING IS EVERYTHING!111
    38 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  39. 39 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  40. 40 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  41. BATCH PROCESSING
    41 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  42. 42 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  43. ABRAKAPOCUS,
    YOUR DISK SPACE IS GONE
    43 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  44. 0 BYTES FREE
    44 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  45. MAKE THIS APP GREAT AGAIN
    AND
    GET THE CLIENT TO PAY FOR IT
    45 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  46. 46 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  47. WARNING:
    INDEX OUT OF BOUNDS
    47 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  48. BUT WHY ISN'T THERE A
    SEPARATE LOG PARTITION?
    48 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  49. 10X
    49 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  50. LIVE,
    AND LEARN,
    AND DOCUMENT...
    50 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  51. WHAT DO YOU MEAN WE
    CAN'T SCALE?
    51 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  52. LOCAL...
    YOU KEEP USING THAT
    WORD...
    52 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  53. MEMORY
    REMEMBER TO USE IT
    53 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  54. THERE IS AN S IN
    SUCCESS
    54 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  55. 55 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  56. BROWSER BUG
    REPRODUCTION
    56 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  57. CURL REQUEST
    57 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  58. OUTPUT THE LAST
    REQUEST/RESPONSE
    58 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  59. WTF?????
    59 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  60. 60 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  61. 61 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  62. 18 HOURS TO LOCATE,
    20 SECONDS TO FIX
    62 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  63. CRATES, BROWSERS AND
    DATABASES
    63 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  64. 16 CPUS 122 GB OF RAM
    64 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  65. 65 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  66. BARCODE SCANNERS AND KEYBOARDS DO NOT MIX
    66 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  67. 67 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide

  68. THANK YOU!
    SRDJAN VRANAC // [email protected] // @VRANAC
    68 โ€” Srdjan Vranac, Code4Hire, CODEstantine 2.0

    View Slide