Hi all! After years using Stackoverflow, I am posting my first question. Here it is!
I am creating an application that performs social media analytics for several customers. Everything was easy when my NodeJS
app was only dealing with a single customer, because I could use Socket.io
to connect to
Twitter
and Instagram
real time APIs, do some calculations and return data to the browser (also using Socket.io
).
Now I need to scale this solution, and I was wondering if it's feasible to refactor the App, so on startup, it loads the configuration for all the customers using it (social media account details, basically), and use threads (or clusters) to have dedicated processes for each customer.
Each client would open a socket to the server, with an identifier, and they would get their data from that specific thread/cluster. Also, some processes can be running for days (i.e.: analysing a marketing campaign impact on Twitter for a week). So I definitely can't block another customer's processes. And I could be opening real time streams from Twitter using different api keys, searching for different things.
I bet it must be quite complex to achieve this, specially when the number of customers grows. If there was no real time data, I could just have a Rest API and a single process serving all requests. But the main feature I would like to have is true real-time data, to display it in interactive dashboards.
I've seen this: node-cluster-socket.i0
It seems interesting, but since I am quite new to NodeJS
, maybe that approach is not quite what I need.
Any advise, suggestion or solution when implementing a similar solution using NodeJS
?