Disclaimer: I'm new to node.js, so I'm sorry if this is a weird question :)
I have node.js using express.js to serve the REST API. The data served by the REST API is retrieved from the nosql database by node.js. All clients use HTTP-GET. There is one exception: Data - PUT and DELETEd from the main database (relational database on another server). The idea for this installation, of course, allows the server 'node.js / nosql database' to be a public interface and thereby protect the main database from heavy traffic.
Potentially, several different client applications will use the REST-API, but it will mainly be used by a client application with a long service life (usually from 0.5 to 2 hours). Instead of allowing this application to constantly test the REST-API to receive new data, I want to use web ports so that data is sent only to the client when there is any new data. I will use the node.js application for this and possibly socket.io so that it can return to api-poll if the websites are not supported by the client. New data should be sent to clients each time the main database PUT or DELETEs objects in the nosql database.
The question is whether I should use one node.js for both the API and websockets, or for the API, and for websockets.
What to consider: - Performance. Applications (applications) will be hosted on a server cluster with a load balancer and an HTTP accelerator in front. Will one application handle everything better than two applications with different tasks? - Traffic between applications. If I select two applications, the api application receiving PUT and DELETE from the main database will notice the websocket application each time it receives new data (or both applications will have to notice the main database). Could double traffic be a performance issue? - Clean lines of code: I believe that two applications will lead to cleaner and better codes, but again, of course, there will be some common code for both applications, which will lead to it having two copies.
, , , :
50000
5
25% ( , , 1% )
UPDATE:
, . . node.js, REST-API -. , , . , , node.js REST-API , websocket, , .