hashicorp / nomad

Nomad is an easy-to-use, flexible, and performant workload orchestrator that can deploy a mix of microservice, batch, containerized, and non-containerized applications. Nomad is easy to operate and scale and has native Consul and Vault integrations.
https://www.nomadproject.io/
Other
14.57k stars 1.92k forks source link

Websockets for Events Stream #13379

Open mr-karan opened 2 years ago

mr-karan commented 2 years ago

Proposal

I noticed that current Events Stream uses long polling to fetch new events establishing a connection from the server. Websockets are generally a better choice for this usecase as they are more reliable and chances of losing an event is lesser. It's also more convenient way to subscribe to events if the Nomad API is behind a proxy (to ensure proxy doesn't kill a long poll request after a certain time).

Curious, what does Nomad team think about it :smile:

DerekStrickland commented 2 years ago

Hi @mr-karan

We've thought about it a little bit. We've got an open issue with a rough todo list in the Nomad OpenAPI project.

If this is something you would find valuable, would you mind upvoting it here or over there, or both? We're currently trying to understand the community demand for this feature/enhancement so we know how to prioritize.

One piece of information that would be nice to have is whether you would find value in the AsyncAPI spec and generated clients, or if just extending the Nomad binary to support a WebSocket based endpoint would meet all your needs.

Other community members are encouraged to provide their input as well.

mr-karan commented 2 years ago

Hi @DerekStrickland

One piece of information that would be nice to have is whether you would find value in the AsyncAPI spec and generated clients, or if just extending the Nomad binary to support a WebSocket based endpoint would meet all your needs.

For my usecase, I think just extending the Nomad binary to support WS would be enough. I plan to use ws to connect via the Go Events SDK in Go, I believe instead of getting events from a channel, I'll be creating a ws client to receive events. But yeah AsyncAPI is something new that I've discovered today, sounds a nice idea for other languages.

DerekStrickland commented 2 years ago

Thanks for the additional information. I'll leave this open so others can comment/upvote and add it to the roadmapping queue.

dionjwa commented 4 months ago

+1 for this. Use case: fast user-defined docker batch jobs. The value is in the fastest iteration loop for sending a docker batch job, having nomad start the job, and knowing when the job is complete. Websockets would increase the speed and reliability compared to long polling.