Search code examples
node.jsconcurrencysocket.ioreal-time-data

Node.js Variable Transactions(Concurrent Modifications)


Good day, Currently i am building a HTTP server with node.js as the server side language. The main responsibilities currently is to accept requests such as add user,increment likes and dislikes etc. The architecture of the server is socket based.(socket.io) therefore allowing real time communication. The current client are android devices. Every thing works, from communication to simply making modifications. However the problem lies in the the real update occurring between multiple connected clients. Example multiple clients at the same time tries to increment a like count,subsequently incrementing the value.But it only does it for only one client at a time. I want a architecture in allowing concurrent modification from any amount of modification. Preferably from the server side. but client works as well.

I am looking to model fire-base transactions. Is there any library,method or best practice to overcome to situation. Thank You!


Solution

  • Well the answer is both ways , the client should model the concurrent logic on their end, and allow node.js to to be multi process, this way the node.js runtime will take advantage of multi core systems.