Giter Site home page Giter Site logo

check-db's Introduction

Architecture

Solution contains 4 main components

  1. DB getter - service which calls DBs, puts the results together and publishes them in message queue.
  2. Message queue NATS - decouples DB getter and worker, allows to run multiple workers & getters. NATS also ensures that only one worker is processing published message.
  3. Worker - here is where business logic lives. It listens to new messages from queue and process them one at the time. Can be easily scaled horizontally.
  4. Key-value store Redis - this is used to store last checked BlobStorageID.

Considerations

Efficiency & speed

This may be not very efficient, as I'm far from being SQL queries expert. This is the biggest issue in this solution.

Resiliency

It's pretty resilient as getters dump last checked index to Redis.

Scaling

You can scale both getter & worker horizontally. Only limitation here is DB resistant for such heavy load of queries.

Running

You'll need docker-compose installed.

  1. run make install_deps to install required python libraries.
  2. make setup_env will turn on docker-compose services (NATS, both databases & redis).
  3. make a_mess will introduce inconsistencies in DB.
  4. make look_for_incosistent will run single worker which will wait for new messages in queue & process them. It prints inconsistent entries to stdout, can be easily dumped to a file.
  5. make fetch_from_db is a service which runs DB queries and publishes BlobRefDTO objects to message queue.

Testing

You can run unit tests for business logic via make tests.

check-db's People

Watchers

 avatar  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.