Han Lim
Han Lim

Reputation: 691

Will calling AJAX in constant interval burden the server and browser itself?

I am currently developing a website where notification is needed. Therefore, I would like to call AJAX and detect changes on my database (storing notifications) constantly in a certain interval.

So my question is, as there are many users calling the AJAX at a same time and at constant rate, will performing such task burden the server?

And will this burden the browser for each users? I had a little bit of performance issues (slow loading / lag) when testing the website when I enable this method.

If this method is bad, can I have some suggestion for alternative method for this task?

Any help is appreciated =)

Upvotes: 0

Views: 113

Answers (1)

Sylwit
Sylwit

Reputation: 1577

With recurrent Ajax call your server will have to handle all those connections so yes it will load.

Another approach you can look is using websocket. Your client will subscribe to a chanel and your server ONLY when a change will be detected in database, will send a notification to the client.

With websocket your server push notifications to the client instead of a client fetching the notification.

Upvotes: 1

Related Questions