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

Event Sourcing In Node.js

30160d8c84f0561e1252334f08014122?s=47 Tamar Twena-Stern
March 11, 2019
420

Event Sourcing In Node.js

Event sourcing has become a very significant pattern in order to scale your server . Node.js has become one of the most popular technologies to develope server side applications . Node.js servers need to scale more and more traffic, and combining event sourcing patterns becomes a tool which is good to master.
In this talk I am explaining how to build a twitter like application with event sourcing in Node.js.

30160d8c84f0561e1252334f08014122?s=128

Tamar Twena-Stern

March 11, 2019
Tweet

Transcript

  1. Event Sourcing In Node.js Tamar Twena-Stern

  2. Tamar Twena-Stern • Software Engineer - manager and architect •

    Architect @PaloAltoNetworks • Was a CTO of my own startup • Passionate about Node.js ! • Twitter: @SternTwena
  3. Tamar Tena-Stern • On Maternity Leave • Have 3 kids

    • Loves to play my violin
  4. Let’s Write Twitter !

  5. Building Newsfeed

  6. And We Get

  7. How Will That Work ?

  8. Why Does This Happen?

  9. Can I Add One More Index? username firstName lastName @johnsmith

    John Smith @tamarstern Tamar Stern @urishaked Uri Shaked Eventually, it breaks …
  10. Lets Introduce You To Our Frustrated System Administrator

  11. Event Sourcing

  12. Event Sourcing

  13. Demo - Node.js Event Sourcing Server

  14. Advantages • Each View has its own storage which is

    the most optimised for its specific queries • Can scale up to 10^8 of concurrent users • Schema migration is much simpler, Schema is much more flexible • System recovery is easier
  15. Event Log

  16. Where To Store Events ? • Event Store Database •

    Hadoop Cluster • node-webhdfs • Couchbase eventing service • npm couchbase • Implement in serverless architecture
  17. NPM Libraries • eventstore - Node.js event log pattern implementation

    • nest-cqrs
  18. Batch Consumer

  19. Evolution Of Architecture (So Far) The State Of The Entities

    In DB Actions in immutable log Consumers prepare results in batch
  20. What Is Happening In The Real World ?

  21. Stream Processing

  22. Stream Processing • Apache Kafka • Kafka-node • Amazon Kinesis

  23. Implementing Transactions With Event Sourcing • Databases have event log

    to implement transactions • I built a transaction engine for banking system in node.js using event sourcing • Each transaction was saved in an event log • Validation was done versus the event log to make sure the banking activity can be performed.
  24. • Twitter: @SternTwena