being a good citizen in an event driven world ajay nair
play

Being a good citizen in an event driven world Ajay Nair Principal - PowerPoint PPT Presentation

Being a good citizen in an event driven world Ajay Nair Principal Product Manager Amazon Web Services @ajaynairthinks Serverless will fundamentally change how we build business around technology and how you code. - Geekwire


  1. Being a good citizen in an event driven world Ajay Nair Principal Product Manager Amazon Web Services @ajaynairthinks

  2. “Serverless will fundamentally change how we build business around technology and how you code.” - Geekwire @ajaynairthinks

  3. TODAY (from “AWS Lambda from the trenches” by Yan Cui) @ajaynairthinks

  4. TOMORROW Yubl (from “AWS Lambda from the trenches”) @ajaynairthinks (from “AWS Lambda from the trenches” by Yan Cui)

  5. USE CASES </> </> Web Backends Data Big Data Chatbots Autonomous Applications Processing IT Powering • chatbot logic • Static websites • Apps & services Real-time data MapReduce Policy engines • • • Powering • • Complex web • Mobile Streaming data Batch Infrastructure • • • voice-enabled apps management • IoT Media content • apps Alexa Skills Kit • @ajaynairthinks

  6. EVENT DRIVEN ARCHITECTURES (GROSSLY SIMPLIFIED) EVENT SOURCE ✓ Communicate Requests to endpoints Changes in resource state through events and Changes in data state APIs FUNCTIONS/ACTORS ✓ Stateless, ephemeral actors DOWNSTREAM ✓ Separation of logic from data, cache, and state @ajaynairthinks

  7. How do I build an effective event source? @ajaynairthinks

  8. Event delivery concepts @ajaynairthinks

  9. EVENT DELIVERY CONCEPTS Batching Payload On-success semantics On-Failure semantics Event Event Event destinatio source router n “An event is a signal emitted by a component upon reaching a given state.” – Reactive Manifesto @ajaynairthinks

  10. EVENT DELIVERY CONCEPTS Batching Payload On-success semantics On-Failure semantics Event Event Event destinatio source router n Responsible for emitting information when the event of interest happens. @ajaynairthinks

  11. EVENT DELIVERY CONCEPTS Batching Payload On-success semantics On-Failure semantics Event Event Event destinatio source router n Responsible for getting the event payload to the desired destination. @ajaynairthinks

  12. EVENT DELIVERY CONCEPTS Event source Event router Controls… Payload On-success semantics Retention Filtering On-Failure semantics AWS Examples Amazon SNS Amazon DynamoDB Amazon S3 CloudWatch events Rules CloudWatch events (CRON) Lambda (Event Source Mappings) EC2 AWS IoT (Gateway) @ajaynairthinks

  13. DECISION #1 - PAYLOAD @ajaynairthinks

  14. WHAT SHOULD BE IN THE EVENT? • Baseline - Provenance • “What happened for this notification to occur?” Pattern #1 - Event notification pattern* • Event processor expected to contact event source to do work • Requires characteristics/identifier – “ What can you tell the event destination about the event source and entity affected?” @ajaynairthinks * Martin Fowler – “What do you mean by “Event-Driven”?” – Feb 2017

  15. WHAT SHOULD BE IN THE EVENT? • Baseline - Provenance • “What happened for this notification to occur?” Pattern #2 - Event-carried state transfer pattern* • Event processor not expected to contact event source • Requires payload i.e. state you want to transfer downstream @ajaynairthinks * Martin Fowler – “What do you mean by “Event-Driven”?” – Feb 2017

  16. EXAMPLE EVENTS S3 IoT data through Kinesis { "Records":[ { "Records": [ "eventVersion":"2.0", { "eventSource":"aws:s3", "eventID": "awsRegion":"us-east-1", "shardId-000000000000:49545115243490985018280067714973144582180062593244200961 Provenance "eventTime":The time, in ISO-8601 format, for example, 1970-01-01T00:00:00.000Z, when S3 finished processing the request, "eventVersion": "1.0", "eventName":"event-type", "userIdentity":{ "kinesis": { "principalId":"Amazon-customer-ID-of-the-user-who-caused-the-event" "partitionKey": "partitionKey-3", }, "data": "SGVsbG8sIHRoaXMgaXMgYSB0ZXN0IDEyMy4=", "requestParameters":{ "kinesisSchemaVersion": "1.0", "sourceIPAddress":"ip-address-where-request-came-from" "sequenceNumber": "49545115243490985018280067714973144582180062593244200961" }, Payload "responseElements":{ }, "x-amz-request-id":"Amazon S3 generated request ID", "invokeIdentityArn": identityarn, "x-amz-id-2":"Amazon S3 host that processed the request" "eventName": "aws:kinesis:record", }, "eventSourceARN": eventsourcearn, "s3":{ "eventSource": "aws:kinesis", "s3SchemaVersion":"1.0", "configurationId":"ID found in the bucket notification configuration", "awsRegion": "us-east-1" "bucket":{ } "name":"bucket-name", ] "ownerIdentity":{ } "principalId":"Amazon-customer-ID-of-the-bucket-owner" }, "arn":"bucket-ARN" }, "object":{ "key":"object-key", "size":object-size, "eTag":"object eTag", "versionId":"object version if bucket is versioning-enabled, otherwise null", Characteristics "sequencer": "a string representation of a hexadecimal value used to determine event sequence, only used with PUTs and DELETEs" } } }, ] } @ajaynairthinks

  17. DECISION #2 – EVENT STORE @ajaynairthinks

  18. OPTIONAL: EVENT STORE Durability Cost Events are accessible even if Additional storage, data event source is down transfer, and service costs VS. Retention Complexity Events can be revisited until New service dependency, processed operational surface area Not required if: - Event source reclaims state (e.g. synchronous invocations) - Event source has persistent storage (e.g. S3) @ajaynairthinks

  19. OPTION #1 - STREAMS Entity store Benefits • Ordered processing on events Entities • Multiple consumers processing same event list • Downsides • Need to manage sharding and scaling • Restricted concurrency • Complex routing/filtering rules • Scenarios • Event sourcing (e.g. replication) • Aggregations @ajaynairthinks

  20. OPTION #2 - QUEUES Benefits • Concurrent processing on events • Better scaling/ease of use • Downsides • Limited consumers • Order not guaranteed • Scenarios • Idempotent inspections • Parallel processing (e.g. MapReduce) @ajaynairthinks

  21. IMPACT ON SCALING/RESILIENCE Notifications No event store State transfer Queue based State transfer Stream based @ajaynairthinks

  22. DECISION #3 – ROUTERS @ajaynairthinks

  23. RECAP: EVENT ROUTERS Event source Event router Controls… Payload On-success semantics Retention Filtering On-Failure semantics AWS Examples Amazon SNS Amazon DynamoDB Amazon S3 CloudWatch events Rules CloudWatch events (CRON) Lambda (Event Source Mappings) EC2 AWS IoT (Gateway) @ajaynairthinks

  24. EVENT ROUTER CHARACTERISTICS Must have Ideal • Pub/sub: Securely map arbitrary • Bidirectional discovery : sources/stores and destinations Discovery/registry for all available sources/stores and • Conditionals : Ability to discard destinations uninteresting events • Combinations : allows joins • E.g. S3 prefix filters merges between multiple event • On-failure hooks : Specific sources behavior if events are • Multiplexing : many-to-many unprocessed combinations of sources and • E.g. Lambda retries and Dead destinations Letter Queues @ajaynairthinks

  25. BRINGING IT ALL TOGETHER Entity store Entities SNS event consumer @ajaynairthinks

  26. RECAP 1.Be smart about what goes into your payload. 2.Surface an event store when appropriate. 3.Reuse standard routers where possible. @ajaynairthinks

  27. Supercharge the event driven and serverless journey for you and your customers. @ajaynairthinks

  28. Thank you! @ajaynairthinks

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend