moja-global / FLINT.Cloud

The project aims to demonstrate a continuous deployment pipeline for FLINT.
Mozilla Public License 2.0
27 stars 67 forks source link

Use gRPC for communication between REST API and FLINT instances #1

Open arnav-t opened 3 years ago

arnav-t commented 3 years ago

Is your feature request related to a problem? Please describe. We need a way for instances of FLINT Docker containers to communicate with the outside world.

Describe the solution you'd like For this, I propose a multi-layer architecture. The top layer would be user-facing. The second layer would be a REST API (which may or may not scale as per the number of requests) and the final layer would be of ephemeral FLINT containers.

design

gRPC would be ideal for establishing communication between the FLINT containers. It's very lightweight, fast, and also language agnostic. The FLINT Docker images already come with Python preinstalled. To set up a gRPC server inside the containers, only two Python packages need to be installed.

Describe alternatives you've considered One way could be to expose a REST API from within the container itself. However, that would inefficient since the API server would be replicated for every instance of the container. All the heavy lifting (computational load) is handled by the FLINT instances only, so ideally we want the REST API to scale independently from FLINT instances.

Additional context I've created a basic proof-of-concept for the FLINT containers with a gRPC server here: https://github.com/arnav-t/FLINT-gRPC-POC This shows how we can invoke FLINT from outside using gRPC.

aornugent commented 3 years ago

Neat! I found this the other day - https://github.com/flash-oss/allserver

I like your proposed architecture. I don't think we need to carry the entire FLINT container around for the API server.