I'm developing a website that uses a notification system (like the Facebook's one). For this purpose I think I'll write a JQuery polling function that look for new notification in the server side, using ajax.

My question is, is this a good idea?

有帮助吗?

解决方案

It will be ok for client side, it's more likely to be a server issue. http://swerl.tudelft.nl/twiki/pub/Main/TechnicalReports/TUD-SERG-2007-016.pdf

In conclusion, if you want high data coherence and network performance you should use push rather than pulling. But push will consume more cpu thus has scalability issue.

The efficiency of pulling depends on the pull interval vs publish interval. If they equal, everything will be perfect. But realistically they will never meet.

Some additional personal opinion, if your server script is blocking in nature (like ruby on rails with single thread server). You better rethink the solution.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top