Is polling or long polling used for small push applications with Insite email/message functions? What should I do?

Source: Internet
Author: User
Is polling or long polling used for small push applications with Insite email/message functions? I have recently made a small application and I have checked a lot of information. It is difficult to determine which server load to use. I hope you can give me some advice. 1) If ajax performs a 3-second round robin, there will be many invalid requests, and if the server of the previous request fails to respond to the next request, the server must also be a small push application of the Insite email/message function of Yali. Do I use polling or long polling?
I have recently made a small application and I have checked a lot of information. It is difficult to determine which server load to use. I hope you can give me some advice.
1) If ajax performs a 3-second round robin, there will be a lot of invalid requests. if the server of the previous request fails to respond to the next request, the server will certainly be large.
2) for long polling, a single user will be connected, and the server will hold so many connections at the same time, and Yali is also very huge.
The younger brother doesn't understand the specific architecture. However, these two methods are very difficult because I won't analyze the specific server load or anything.

In addition, the server is a medium cloud host and the small application does not have high requirements on the real-time performance.

------ Solution --------------------
It is rare to push Insite emails. it takes not long for users to stop on a page. If you have this requirement, you should add a memcache. every time you have an update operation for a user, memchache is also updated.
In addition, the group function should be considered for Insite emails. in this case, you only need to insert a record and complete the record during user logon. We also need to divide the content into another table.
------ Solution --------------------
Link no. the sender's receiver's message No. status
1 ID1 ID2 3 read/unread


This is a relational table, and a message Table, user table.

Insite mail is generally a count of unread mails. select count gets the number of unread mails of the user, and reduces the query pressure caused by AJAX to the database to a tolerable extent, you can set a cache to store the number of unread records for 120 seconds, and then pull the logs for 20 seconds.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.