npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node2faas

v0.2.14

Published

Module to convert node.js apps into faas based node.js apps

Downloads

2

Readme

images/node2faas-logo-big.png

Node Applications conversor to Function as a Service (FaaS) Deployments.

Hot Page

Versions

  • 0.2.0 - 2021,Oct
    1. AWS:
    • Add CloudWatch automatic integration;
    • Update runtime from nodejs10.x (deprecated) to nodejs14.x.
    1. FaaS zip file generated with dependencies (node_modules);
    2. Replacing package Request (deprecated) by Axios
    3. Automatically add Axios in generated app package.json
    4. Parameters passed via POST
    5. New annotation feature: force / skip publication on FaaS
  • 0.1.1 - 2020,Nov
    1. Minor bug corrections;
    2. Graphics on evaluations;
    3. Readme Update
  • 0.1.0 - 2019,Dec
    1. Add multicloud orchestrator (Terraform) with support to AWS, GCP and Azure FaaS services;
    2. Function pre-analysis;
  • 0.0.1 - 2018,Dec
    1. Initial Release

Purpose

This framework intend to help NodeJS developers to migrate from monolith model to function as a service (serverless) model. It parses the original code looking for exported functions and creates an equivalent function on the provider. Instead of the original function is placed a restAPI request to FaaS.

Pre-Requisites

To use this conversor you need to have an active account in one of this FaaS services:

  • Amazon AWS Lambda;
  • Google Functions;
  • Microsoft Azure Functions.

Get credentials parameters on AWS

  • Log in to your AWS Management Console.
  • Click on your user name at the top right of the page.
  • Click on the Security Credentials link from the drop-down menu.
  • Find the Access Credentials section, and copy the latest Access Key ID.
  • Click on the Show link in the same row, and copy the Secret Access Key.

You should obtain this parameters:

  • access_key_id
  • secret_access_key

Get credentials parameters on Azure

You should obtain this parameters:

  • subscription_id
  • azure_tenant_id
  • azure_client_id
  • azure_client_secret

Follow this instructions: click

Get credentials parameters on GCP

  • Create a service account and set permissions to operate the Compute Engine and VPC Networks.

You should obtain a JSON file with this parameters:

  • client_x509_cert_url
  • client_email
  • client_id
  • project_id
  • private_key_id
  • zone

The JSON file location will be prompted by the framework during its process.

Workflow

node2faas-workflow

Conversion Process

node2faas-workflow

Framework Composition

node2faas-composition

Installation

npm install node2faas

or

git clone https://github.com/node2faas/framework.git

cd node2faas

npm link

Usage

  • Run: node2faas --help on your terminal to get the CLI Instructions

node2faas-help

  • Run: node2faas --target [/path/to/original/application]

  • Follow de conversor instructions

  • After proccess, check the directory output and your application converted to operate with FaaS should be there.

Features

  • Convert only .js files (other file types are skipped)
  • Stores provider credentials after first execution (don't ask again)
  • Creates new FaaS function on the choose provider
  • Creates all provider API Gateway resources
  • Annotations (add a comment anywhere inside function definition)
    • Skip publication:
      • //@node2faas-skip
    • Force publication:
      • //@node2faas-force

Limitations

The framework is prepared to work only with:

  • Providers:
    • AWS Lambda
    • GCP Functions
    • Azure Functions
  • Function types:
    • exported
      • Ex: exports.functionName = function(params) { ... }

Examples

This project contains some examples to guide you. Look inside examples folder.

Overload example

  • available in path: examples/mocked/bounds

The load example explores 3 potential function loads:

  • Memory -> process with high memory consumption
  • CPU -> process with high CPU consumption
  • I/O -> process with high I/O consumption

Evaluations

Tests without orchestrator

  • 1 to 100 concurrent requests to each service (traditional and converted)
  • Simple Test (simple math operations)
  • CPU stress Test (multiple cycles of simple operations)
  • Memory stress Test (multiple cycles of writing on memory operations)
  • I/O stress Test (multiple cycles of writing on disk operations)
  • All data generated in this evaluation is available in path: evaluations/preliminary/outputs
  • Files generated have this structure: [initial timestamp in nanoseconds],[final timestamp in nanoseconds],[duration in nanoseconds],[output from service]

Test Architecture

node2faas-test-arch

Results of Simple Test

simple-test

Results of CPU Stress Test

cpu-test

Results of Memory Stress Test

memory-test

Results of Memory I/O Test

io-test

Tests with Terraform as orchestrator

  • CPU stress Test (multiple cycles of simple operations)
  • Memory stress Test (multiple cycles of writing on memory operations)
  • I/O stress Test (multiple cycles of writing on disk operations)

Parameters

conclusive-test-params

  • All data generated in this evaluation is available in path: evaluations/conclusive/results

  • A list of test case was generated using the parameters. This table is available in file: evaluation/conclusive/test_cases.csv

  • Files generated have this structure: [id test case],[sequence],[test output],[duration in nanoseconds]

Results of CPU Bound Test

cpu-conclusive-test

Results of Memory Bound Test

mem-conclusive-test

Results of I/O Bound Test

io-conclusive-test

Reliability rates

reliability

Minimal and maximal execution time

min_max_exec_time

Publications

  • 2019, May => CLOSER, Heraklion, Greece (paper)

  • 2020, May => CLOSER, Online Streaming (paper)

  • 2020, Nov => CCGRID, Melbourne, Australia (paper)

Support

If you need more information, please send a message to: [email protected]