VB_
VB_

Reputation: 45692

Node.js HTTP-proxy architecture: downloading big amount of data for client

I need: Write a proxy server which will download music for my client. Suppose each client wants to download 20-200 compositions (400MB-4GB of music) and I must support many users simultaneously.

Problem: I heard very different reasonings on how should I write that server: in the main event loop or open new worker for each user.

My process:

  1. User asks server to download data
  2. Server download data and pass streaming them to the client at once

Question: one thread or many workers for my needs? Why?

Upvotes: 0

Views: 48

Answers (1)

Rax Wunter
Rax Wunter

Reputation: 2767

Assume that several workers anyway, because it will often need to open tcp connections (blocking main thread) and your callbacks will wait for the main thread queue. Does your HTTP server has many workers? For my opinion, good decision is to make several workers binding to your HTTP port, and each one is a proxy. If your app is already clusterized, maby it's justified to use MQ + proxy cluster.

Upvotes: 1

Related Questions