Websockets API with async processing (is there a better way?)
My Deno app has a websockets layer that receives "requests" from the websocket clients.
The clients ask it to update data in the database, retrieve data, etc. similar to a REST api
There will be 5-10 clients who will be sending a very large volume of requests.
In my initial setup, I created this websockets layer that would offload the actual work for each request to a pool of Workers, who would then send the response back through the Worker pool.
I'm hitting some kind of bottleneck. Despite my best efforts, I don't know how to identify it.
So I have a few questions:
1. Do you know of an obvious bottleneck with this setup that I'm not realizing?
2. Is there a better way to go about this? I would really like to keep this app simple, and it doesn't feel simple right now
A couple of bits of context:
1. I simply need to use Websockets. In the ecosystem I'm developing for, HTTP calls are not a good option
2. My main goal with the Worker Pool was to make sure my Websockets layer wasn't being blocked or delayed while each request is processed, but I'm starting to second guess this design
Some code, in case it helps paint a better picture:
The websockets layer:
The Worker Pool is attached as a file to this message.
I'm feeling worried about my decisions here, I need to come up with a good solution soon.
Any help at all is greatly appreciated
The clients ask it to update data in the database, retrieve data, etc. similar to a REST api
There will be 5-10 clients who will be sending a very large volume of requests.
In my initial setup, I created this websockets layer that would offload the actual work for each request to a pool of Workers, who would then send the response back through the Worker pool.
I'm hitting some kind of bottleneck. Despite my best efforts, I don't know how to identify it.
So I have a few questions:
1. Do you know of an obvious bottleneck with this setup that I'm not realizing?
2. Is there a better way to go about this? I would really like to keep this app simple, and it doesn't feel simple right now
A couple of bits of context:
1. I simply need to use Websockets. In the ecosystem I'm developing for, HTTP calls are not a good option
2. My main goal with the Worker Pool was to make sure my Websockets layer wasn't being blocked or delayed while each request is processed, but I'm starting to second guess this design
Some code, in case it helps paint a better picture:
The websockets layer:
The Worker Pool is attached as a file to this message.
I'm feeling worried about my decisions here, I need to come up with a good solution soon.
Any help at all is greatly appreciated
