Giter Site home page Giter Site logo

linecode / dynein Goto Github PK

View Code? Open in Web Editor NEW

This project forked from airbnb/dynein

0.0 1.0 0.0 71 KB

Airbnb's Open-source Distributed Delayed Job Queueing System

Home Page: https://medium.com/airbnb-engineering/dynein-building-a-distributed-delayed-job-queueing-system-93ab10f05f99

License: Apache License 2.0

Java 100.00%

dynein's Introduction

Dynein

Dynein is Airbnb's Open-source Distributed Delayed Job Queueing System. Learn more about Dynein in this blog post: Dynein: Building an Open-source Distributed Delayed Job Queueing System.

Example

Dynein's components are structured as Managed objects in Dropwizard. We have prepared an example application to demonstrate how to integrate Dynein in your service in ./example.

To run this example, follow the following steps:

  1. Setup localstack. The following steps will be using the default ports of localstack.

  2. Run this command to create the necessary SQS queues:

    aws sqs create-queue --endpoint-url http://localhost:4576 --queue-name example --region us-east-1
    aws sqs create-queue --endpoint-url http://localhost:4576 --queue-name inbound --region us-east-1
  3. Run this command to create the DynamoDB table:

    aws dynamodb create-table --table-name dynein_schedules \
      --attribute-definitions AttributeName=shard_id,AttributeType=S AttributeName=date_token,AttributeType=S \
      --key-schema AttributeName=shard_id,KeyType=HASH AttributeName=date_token,KeyType=RANGE \
      --billing-mode PAY_PER_REQUEST --endpoint-url http://localhost:4569 --region us-east-1
  4. cd example && gradle run --args='server example.yml'

  5. In another terminal, use curl to schedule jobs. The following endpoints are available, which maps to scheduled, immediate, and sqs-delayed jobs:

    1. curl 'localhost:28080/schedule/scheduled'
    2. curl 'localhost:28080/schedule/immediate'
    3. curl 'localhost:28080/schedule/sqs-delayed'

    Each endpoint supports optional parameters delaySeconds and name. For example: curl 'localhost:28080/schedule/scheduled?name=testing-name&delaySeconds=15'

  6. In the original terminal where the example is started, at the scheduled time, the following log lines will be printed:

    INFO  [2019-12-10 01:59:04,785] com.airbnb.dynein.example.ExampleJob: Running job with name: "testing-name"
    INFO  [2019-12-10 01:59:04,800] com.airbnb.dynein.example.worker.ManagedWorker: Successfully consumed job from queue
    

Configuration

Here's an example from ./example/example.yml. We will use inline comments to explain what each option does.

scheduler:
  sqs:
    inboundQueueName: inbound # inboud queue name
    endpoint: "http://localhost:4576" # SQS endpoint. normally this line can be omitted, but it's useful for using localstack
  dynamoDb:
    schedulesTableName: dynein_schedules # dynamodb table name
    queryLimit: 10 # max number of results per query
    endpoint: "http://localhost:4569" # DynamoDB endpoint. normally this line can be omitted, but it's useful for localstack
  workers:
    numberOfWorkers: 1 # number of workers to start in this scheduler
    recoverStuckJobsLookAheadMs: 60000 # look ahead time for recovering stuck jobs
    threadPoolSize: 2 # must be at least 1 more than the number of workers
    partitionPolicy: STATIC # can also be `K8S` to use dynamic partitioning
    staticPartitionList: [0] # only needed for static partition policy
  heartbeat:
    monitorInterval: 60000 # the interval for heartbeat monitoring
    stallTolerance: 300000 # the minimum time for a worker to be considered stopped
  maxPartitions: 1 # max number of partitions. can only be increased without reassigning partitions for jobs already scheduled

dynein's People

Contributors

andyfangdz avatar connorads avatar

Watchers

 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.