Code Monkey home page Code Monkey logo

kinesis_demo's Introduction

This is a demo of AWS Kinesis for the logistsic system event streaming. There are 3 events:

  1. event: order_created, data: order id, ship from region, ship to region, pick up time, price
  2. event: order_assigned, data: order id, driver (who accepted the order)
  3. event: order_completed, data: order id,

We created 3 Kinesis Streams by the script (create_stream.sh). Each stream has 2 shards. The simulator.py will create 2 threads for producer to create order, and then 2 threads to consumer the event message and then forward to the 2nd stream (assign_driver). It will set a random time for the driver assignment time taken for simulation. And then there will also be 2 threads to receive the event and forward to the final queue (complete_order)

Each consumer thread will print out its own message througput.

We also created 3 lambda functions (create_lambda.sh/lamda_function.py) to listen the Kinesis event to analyse the statistics: price, ship_from_region, and time taken. The function will update the statistics into DynamoDB. The tables was created by (create_table.sh). And the statistics will be shown by (monitor.py).

The demo video can be found in youtube: https://youtu.be/aGrNBKNiaUo

The lambda function is supposed to be called per second, but i found that due to the poor performance of dynamoDB, it took 3 sec to run for each invocation. Therefore, there is a time lag in the statistics update on the dynamoDB. To solve this problem, we either improve the dynamodb performance or use a faster local db solution or even put the statistics update in the consumer python script.

kinesis_demo's People

Stargazers

phaneendra avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.