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

Introduction to event-driven architectures with Apache Kafka on Heroku

Introduction to event-driven architectures with Apache Kafka on Heroku

We live in a world of networked devices, real-time clients, and microservice architectures, which is shifting from transactional to evented interactions. This session will help you understand the shift towards this new generation of evented architectures. It will provide a gentle intro to stateful distributed systems such as Apache Kafka and how they can help you manage high throughput event streams.

This talk was given at Dreamforce on November 7th, 2017, there is a recording: https://www.salesforce.com/video/1773568/

F085bf2092cb300bac787cc5bc65d301?s=128

Ryan Townsend

November 07, 2017
Tweet

Transcript

  1. Introduction to Event-Driven Architectures with Apache Kafka on Heroku Tuesday,

    November 7th, 2017
  2. Forward-Looking Statements Statement under the Private Securities Litigation Reform Act

    of 1995 This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments and customer contracts or use of our services. The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth, interruptions or delays in our Web hosting, breach of our security measures, the outcome of any litigation, risks associated with completed and any possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain, and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the financial results of salesforce.com, inc. is included in our annual report on Form 10-K for the most recent fiscal year and in our quarterly report on Form 10-Q for the most recent fiscal quarter. These documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of our Web site. Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.
  3. I know what event-driven architecture means. I’ve built event-driven architecture.

    I’ve used Apache Kafka.
  4. Chief Technology Officer Heroku Developer Advocate Chris Castle @ryantownsend ryan.townsend@shiftcommerce.com

    @crc chris.castle@salesforce.com Ryan Townsend
  5. “Data is the new oil” “Data is the new oil.”

    Clive Humby, Architect of Tesco’s Clubcard, 2006 “Personal data is the new oil of the internet” Meglena Kuneva, European Consumer Commissioner, 2009 “Data is the new oil” Ann Winblad, Senior Partner at Hummer-Winblad, 2012 “The difference between oil and data is that the product of oil does not generate more oil (unfortunately), whereas the product of data will generate more data”
 Piero Scaruffi, cognitive scientist and author of “History of Silicon Valley”, 2016 “Data is the new oil. The companies that will win are using math.”
 Kevin Plank, founder and CEO of Under Armour, 2016 “Data is the new oil.”
 Richard Titus, CEO AND, 2010 “We’re able to view just everything that they do. [...] Data is the new oil.”
 Bill Diggins, CEO Diggit, 2012 “I want you to think about data as the next natural resource.”
 Virginia Rometty, IBM CEO, 2013 “Information is the oil of the 21st century”
 Peter Sondergaard, SVP Gartner, 2011 “Data is going to be the natural resource for this industrial revolution.” Abhishek Mehta, CEO Tresata, 2013 Source: https://www.quora.com/Who-should-get-credit-for-the-quote-data-is-the-new-oil
  6. Have your cake and eat it

  7. What we’re going to talk about • What is event-driven

    architecture? • What are the benefits? • What are the downsides? • What is Apache Kafka? • Why use Heroku Kafka? • Use cases & live demos!
  8. What is event-driven architecture?

  9. What is event-driven architecture?

  10. What is event-driven architecture? Event happens ‑
 State changes

  11. What is event-driven architecture? I buy something from you ‑

    My bank account goes down, yours goes up
  12. What is event-driven architecture? Product views Completed sales Page visits

    Site logins Shipping notifications Inventory received IoT data Weather data Traffic data Tweets Election polling data Tweet!
  13. What is event-driven architecture? If this is the way the

    world works, why don’t we model data like this?
  14. What is event-driven architecture? Instead we take “snapshots” of state

    at arbitrary intervals and store that as rows in a database.
  15. What is event-driven architecture? And we normally dump the event

    data.
  16. What is event-driven architecture? What if we kept the event

    data?
  17. What is event-driven architecture? What if we used that event

    data as a store of state?
  18. What is event-driven architecture? What if we used an immutable,

    time- ordered sequence of events as our primary store of state?
  19. Benefits of event-driven architecture

  20. Benefits of event-driven architecture Build a better product

  21. Benefits of event-driven architecture Item Quantity Pixel 2 1 Cart

    Items
  22. Benefits of event-driven architecture Type Parameters Added Item To Cart

    Item: iPhone X, Quantity: 1 Changed Item Quantity Item: iPhone X, Quantity: 2 Removed Item From Cart Item: iPhone X Added Item To Cart Item: Pixel 2, Quantity: 2 Changed Item Quantity Item: Pixel 2, Quantity: 1 Events
  23. Benefits of event-driven architecture Natural audit logging

  24. Benefits of event-driven architecture Fix state, not just bugs

  25. Benefits of event-driven architecture Item Quantity iPhone X 2 Pixel

    2 1 Cart Items
  26. Benefits of event-driven architecture Item Quantity iPhone X 2 Pixel

    2 1 Carts Type Parameters Added Item To Cart Item: iPhone X, Quantity: 1 Changed Item Quantity Item: iPhone X, Quantity: 2 Removed Item From Cart Item: iPhone X Added Item To Cart Item: Pixel 2, Quantity: 2 Changed Item Quantity Item: Pixel 2, Quantity: 1 Events Cart Items
  27. Benefits of event-driven architecture Item Quantity Pixel 2 1 Carts

    Type Parameters Added Item To Cart Item: iPhone X, Quantity: 1 Changed Item Quantity Item: iPhone X, Quantity: 2 Removed Item From Cart Item: iPhone X Added Item To Cart Item: Pixel 2, Quantity: 2 Changed Item Quantity Item: Pixel 2, Quantity: 1 Events Cart Items
  28. Benefits of event-driven architecture Untangle integrations

  29. Benefits of event-driven architecture ⚫ ⚫ ⚫ ⚫ ⚫ ⚫

    ⚫ ⚫ ⚫ Point-to-point Integrations
  30. Benefits of event-driven architecture ⚫ ⚫ ⚫ ⚫ ⚫ ⚫

    ⚫ ⚫ ⚫ Event Stream
  31. Benefits of event-driven architecture De-risk launches

  32. Benefits of event-driven architecture ⚫ ⚫ ⚫ ⚫ ⚫ ⚫

    ⚫ ⚫ ⚫
  33. Downsides of event-driven architecture

  34. Downsides of event-driven architecture Asynchronicity and eventual consistency ⏲

  35. Downsides of event-driven architecture All corrections need events ✏

  36. Downsides of event-driven architecture Replaying must factor in external systems

  37. Downsides of event-driven architecture Doesn’t always play well with traditional

    CRUD applications
  38. Downsides of event-driven architecture Demand on storage*
 
 * this

    is misnomer
  39. What is Apache Kafka?

  40. What is Apache Kafka?

  41. What is Apache Kafka? “Distributed commit log” open-sourced by LinkedIn

    Fault-tolerant and robust Guaranteed at-least-once delivery Chronological ordering (within partitions) Asynchronous pull-based event consumption Topics for granular event access Kafka 1.0 last week ⏰ ⬇ ↔
  42. Why Apache Kafka on Heroku?

  43. Why Apache Kafka on Heroku? Instant provisioning High-availability out-of-the-box Multi-tenant

    Kafka plans from $100/mo Really easy to share between your applications Thoughtful developer experience ⚡ ↔
  44. Use Case: Stream Processing

  45. Stream Processing Filter Map Aggregate Sort

  46. Stream Processing: Waterfall of Events

  47. Stream Processing: Analytics Dashboard

  48. Use Case: CQRS and Event Sourcing

  49. Command Query Responsibility Segregation (CQRS) ❗ ❓ alters reads Command

    Query State
  50. CQRS with Event Sourcing ❗ ❓ generates reads Command Query

    State Events alter
  51. https://df17.herokuapp.com/

  52. Some sort of mind blowing conclusion! (this has been left

    intentionally as the original)
 
 Real conclusion: there are so many uses of EDA, you need to play around with it to see how it’ll fit your specific needs, so just give it a go!
  53. Ryan Townsend CTO, Shift Commerce ryan.townsend@shiftcommerce.com @ryantownsend chris.castle@salesforce.com @crc Chris

    Castle Heroku Developer Advocate