Coder Social home page Coder Social logo

serverless-relay's Introduction

Serverless-relay

A Relay maintaining persistent connection between serverless functions. A relay is needed when two clients want to send communicate between each other without having to host a server, and maintaining connections. This is especially the case when we want one or more serverless functions/jobs to communicate with each other.

Why is this needed?

A serverless job generally doesnt accept incoming connections. Hence, when two serverless jobs needs to communicate with each other, they would need to connect through a central relay/router.

In the context of Clusterlink, currently ClusterLink gateways expect reachability to the destination service which has to receive connections. An application if it wants to connect to a service, it will connect to the GWs and the GW in the destination cluster needs to make a tcp connection with the destination service.

However, when two transient jobs/functions running in serverless need to contact each other over a tcp connection, there is no generic way of doing this assuming the functions do not have/want to expose publicly reachable endpoints. This problem is currently not solved by Clusterlink, since it requires the GW to initiate a connection with one of the functions, which requires at least one of the functions to have a reachable endpoint accepting connections.

How does serverless-relay solve this?

The serverless-relay runs as a separate process within a VM.

It does the following:

  1. Binds and listen to a specific port, for the job/function to connect and send messages to the remote service. The remote service is already discovered by the gateway.
  2. The relay at one end accepts connection from a func1, and other end accepts connection from func2. Ideally it should validate the func1 & func2 using their certificates.
  3. When both funcs connect to the relay, an end-to-end connection is established, and funcs upgrade the connection to mTLS, and communicate with each other.

Details :

  1. The relay starts a listener for each {func1, func2} pair communication.
  2. It verifies the functions and manages routing between them.

Steps to run serverless-relay

make build

./bin/frelay start --port

Run a test client

export MODE=flock_tls_server

./bin/client_function

Run a test server

export MODE=flock_tls_client

./bin/client_function

Problem

Forwarding over the TCP socket of the tls connection fails.

TODO

  1. Move relay configuration to separate API, e.g. specify addRoute(func1, func2), and deleteRoute(func1,func2).

serverless-relay's People

Contributors

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