Datasnap persistent connection and short connection

Source: Internet
Author: User

If the communication protocol uses TCP/IP, the socket connection between the client and the middleware is very exquisite.

The short connection and persistent connection should be cleverly used in applications. Purely using persistent connections or purely using short connections,

Usually not reasonable. If a socket is used for a long time to relax, this will undoubtedly be a waste of middleware resources. If the number of such casual persistent connections is large, it may affect the middleware performance. Middleware automatically disconnects casual connections for a long time through heartbeat packets. In fact, this is the last line of defense of middleware against such events.

It is not very good if the remote equations are all short connections. For example, some remote methods are executed in blocks. If a remote method is executed to establish a socket connection with the middleware, the connection will be closed immediately after execution, this is not good. Because it is time-consuming to establish a socket connection, some remote methods are executed in blocks, and

It takes a lot of time. Therefore, we can establish a persistent connection before these block-based remote methods are executed. It is reasonable to close this persistent connection after these remote methods are executed.

In fact, both persistent connections and short connections are relative. Things in the world are often not pure. The so-called persistent connection has short connections and short connections have long connections. Can you see it?

Set the thread mode of the middleware thread pool, and skillfully use the combination of long and short connections on the client side to reasonably build a multi-layer architecture.

 

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.