Giter VIP home page Giter VIP logo

txt-streaming-k8s's Introduction

PoC: Text Streaming between microservices inside K8s using Redis

Exploring ways to stream data between 2 microservices (Node-MS and Python-MS) inside k8s.

We will use Redis as a message broker/Queue to enable "async" communication between the services.

This is a PoC, and it's not intended to be used in production.

diagram

Solution 1:

Redis as a job orchestrator

  • The client queries Node-MS with a text to be processed. Node-MS will keep the connection open.

  • Node-Ms will queue a "job" with the text to be processed and an ID.

  • After the dequeuing the job, Python-MS will publish a message containing its IP and the message ID.

  • After receiving the message, each Node-MS instance will check if the job ID belongs it. If it does, it will send a GET request to Python-MS to get the data as a stream.

  • Node-MS will forward the results to the client as a stream.

diagram

Solution 2:

Redis as the main communication channel:

  • The client queries Node-MS with a text to be processed. Node-MS will keep the connection open.

  • Node-Ms will queue a "job" with the text to be processed and an ID.

  • After the dequeuing the job, Python-MS will start publishing the results in chunks to a Redis channel (attaching the job ID to each message).

  • Upon receiving any message, each Node-MS instance will check if the job ID belongs it. If it does, it will write that message data to the client.

diagram

txt-streaming-k8s's People

Contributors

jihedmastouri avatar

Stargazers

Chehir Dhawedi avatar

Watchers

Chehir Dhawedi 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.