Frnak
Frnak

Reputation: 6802

Web Sockets vs Interval Polling

I'm currently looking for the best fitting solution to handle notifications. My current options are either using websockets or just do a polling (only 1 request every minute, no long polling, no permanent polling)

I somehow have problems to find performance indicators for these methods. The result should be able to handle a lot of users in parallel without taking too much resources.

Option A:

Option B:

In the backend i'm using java spring with spring boot. Do you know any best practices or reference implementations?

Upvotes: 6

Views: 3516

Answers (1)

hasan
hasan

Reputation: 553

I would suggest to use option A since you just need a quick response and dont want to deliver further information in real time. You also speak of many users so it should be less resource consuming to request user notifications in a certain timeinterval than keeping an open websocket for each user. it also depends on your environment.

have also a look here: How many system resources will be held for keeping 1,000,000 websocket open?

Upvotes: 7

Related Questions