Skip to content

shanishiri/manager-worker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

managerWorker

This app implement a simple auto scale mechanism, using https://nodejs.org/api/cluster.html

Run the application via cmd: node src/app.js

The app exposing 2 APIs:

  1. POST: /messages - Push a new message into the queue. The body contains a json with the following format: { "message":"Message to send" }

Each pushed message should trigger a function run. The function will

  • Receive as input the message

  • then sleep for five seconds

  • and will print the content of the message to a shared file (file will be created if does not exist)

          curl --header "Content-Type: application/json" --request POST --data '{"message":"xyz"}' http://localhost:8000/messages
    
  1. GET: /statistics - Get back a json with the following structure: { "active_instances": 5, # Number of function instances that are active "total_invocation":20 # How many times the function got invocated }

           curl --header "Content-Type: application/json" --request GET  http://localhost:8000/statistics 
    

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published