Brad45
Brad45

Reputation: 199

How should I limit my ajax usage under these situations?

I'm constructing a social networking website and I'm currently testing Ajax on certain features.

Right now, I have 3 separate calls coming from my include (which is on every page) that will check the database for new messages, achievements, and notifications and update the specific divs.

My biggest worry is that 3 separate calls would eventually lead to performance issues.

I have no way of really seeing how a large user-base would affect this, because my site is currently in beta and I haven't advertised yet. So I have a limited number of people to test with. When I do advertise and gain more members, I don't want to run into any hiccups.

I currently have the calls being made every 20 seconds. I was hoping someone could give me some advice on how long I should set the intervals. I have no way of currently knowing if 20 seconds would be too much, or if I could even set it to 10 and be fine.

Any advice would be appreciated. Thanks.

Upvotes: 0

Views: 45

Answers (1)

F21
F21

Reputation: 33401

Perhaps you should look into server push to push the data to the client when there are new messages and so on. That means that instead of polling using resources, resources are only used when there are new messages and pushed to the client.

Some server push servers are:

Upvotes: 2

Related Questions