Sistemas y TecnologĂ­as Web: Servidor

Master de II. ULL. 1er cuatrimestre. 2020/2021


Organization ULL-MII-SYTWS-2021   Classroom ULL-MII-SYTWS-2021   Campus Virtual SYTWS   Chat Chat   Profesor Casiano

Table of Contents

PrĂĄctica Connecting Robust Microservices (p6-t2-microservices)

  • Lea el CapĂ­tulo 4 “Connecting Robust Microservices” de Node.JS The Right Way ` ` y resuelva los problemas en la secciones

  • Error Handling,
  • Robustness y
  • Bidirectional Messaging:

  • Error Handling
    • The zmq-filer-rep.js program uses fs.readfile() to serve up file contents. However it doesn’t handle error cases.
      • What should the program do in the case of error?
      • How would you change the JSON object structure of messages to support sending an error to the requester?
    • Later in the same program we listen for the Unix signal SIGINT to detect the user’s Ctrl-C in the terminal
      • What happens if the program ends in some other way , like SIGTERM (the termination signal)?
      • What happens if there is an unhandled Node.js exception, and how should we deal with it?
        • Hint: you can listen for the uncaughtException event on the process object
  • Robustness
    • In Building a Cluster we created a Node.js cluster that spins up a pool of worker processes.
    • In the master process we listened for online events and logged a message when the workers came up.
    • But we didn’t specify what should happen when a worker ends.
      • What happens when you kill a worker process from the command line?
        • Hint: Use kill [pid]from the command line
      • How would you change the zmq-filer-rep-cluster.js program to fork a new worker whenever one dies?
  • Bidirectional Messaging
    • For this project you’ll need to use 0MQ PUSH/PULL sockets and the Node.js clustering techniques.
    • Your clustered program will spin up a pool of workers and distribute 30 jobs.
    • The master process should:
      • Create a PUSH socket and bind it to an IPC endpoint. This socket will be for sending jobs to the workers
      • Create a PULL socket and bind it to a different IPC endpoint. This socket will receive messages from the workers
      • Keep a count of ready workers
      • Listen for messages on the PULL socket, and
        • If the message is a ready message, increment the ready counter, or
        • If the message is a result message , output it to the console
      • Spin up the worker processes
      • When the ready counter reaches 3 send 30 job messages out through the push socket
    • The worker process should:
      • Create a PULL socket and connect it to the master ‘s PUSH endpoint
      • Create a PUSH socket and connect it to the master ‘s PULL endpoint
      • Listen for job messages on the PULL socket, and respond by sending a result message out on the PUSH socket
      • Send a ready message out on the PUSH socket.
    • Make sure your result messages include at least the process ID of the worker. This way you can inspect the console output and confirm that the workload is being balanced among the worker processes.
    • See the example in directory ventilator-worker-sink
    • See section PUSH-PULL in file Readme.md in the folder connecting-robust-microservices-chapter-4/microservices in our repo ULL-MII-CA-1819/nodejs-the-right-way
  • Añada documentaciĂłn

Recursos

Node.js 0MQ API

La GuĂ­a de ZeroMQ

Tutoriales

Parallel Computing

Retos para el CapĂ­tulo Connectiong Robust Microservices

Comment with GitHub Utterances

Comment with Disqus

thread de discusion