Git Product home page Git Product logo

js-compute-lambda's Introduction

Node.js 'super-compute'

Dispatch stateless functions to remote workers that will evaluate complex expressions, such as prime numbers calculation, using a lambda "serverless" based infrastructure to comlete expressions without needing to run a server for each specific computational environment.

Installation

  $: npm install -g pm2
  $: git clone https://github.com/xCykrix/js-super-compute-lambda
  $: cd ./js-super-compute-lambda
  $: npm install && npm upgrade
  $: pm2 start ecosystem.config.js # Must be ran on host machine, unless configured otherwise, and all workers.

Thats it! You have downloaded and got the client and server ready! You can take a look right below to see how to start the example client.

Implementation(s)

dispatchers/prime-number.js

Dispatch a Prime Number calculation to all workers in your configured node.

Usage

# Calculate 1 to 1,000,000 Prime Numbers
# Replace {RAM} with the maximum available RAM you have, in megabytes. (1024 * GB)
# 1 = Minimum Value to Dispatch
# 1,000,000 = Maximum Value to Dispatch
# 30000 = Average steps per Worker to compute
  $: node --max-old-space-size={RAM} ./dispatchers/prime-numbers.js 1 1000000 3000

Authentication

All of the clusters have a very basic authentication system in place to prevent against malicious arbitrary code execution. To configure authentication, copy /secrets.template.json to /secrets.json and set the authentication password phrase you would wish to use. The example prime number client and server will handle all the authentication for you, but you should not use this in a production environment without taking the required steps to secure your network and infrastructure to prevent against malicious actors. I would greatly suggest running these in docker containers or a kubernetes cluster.

Networking Nodes and Clusters

Would you like to expand beyond your personal network? Well that is fairly easy! You can configure /ecosystem.config.js to include the list of all remote servers that you have the server worker running, just be careful to make sure you keep the amount of clusters and servers matching across the entire compute network! You can also link many computers together and execute on the network from any worker server in the cluster.

Building Expressions for Computation

You can copy /dispatchers/prime-numbers.js and modify it to meet your needs. Each expression requires its own form of input and output and can be modified to do just about anything you need, as long as authentication and versioning is handled correctly.

js-compute-lambda's People

Contributors

dependabot[bot] avatar xcykrix 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.