Long polling and worker pools

Hello there, I’m coding a new service and trying to figure out the best possible solution.

It would be a rest API endpoint that handles sessions. The user will make a request and wait indefinitely for new information.
I was thinking to create a worker pool that each worker is linked to a user and waits till there is info for him and returns it. This comes with two doubts

  1. how do I inject the new info to the worker?

  2. how do I make sure the workers that are just waiting don’t take up substantial resources?

I’m trying not to use web sockets because of the limited users that can connect simultaneously. but if the performance is similar I can change to it.

Sounds like a contradiction.

I wouldn’t link a worker to a user, especially if you expect many simultaneously, unless new information is generated essentially continuously. Have the workers identify which user from the “new information,” and lookup the connection for the user from a map.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.