Objective C # Reading Notes-entry 28: Provides coarse-grained Internet APIs

Source: Internet
Author: User

In the use of Web Services,. NET remote calls or to AzureProgramThe most time-consuming is the transmission process with the remote server. If the local API is simply encapsulated, it becomes an API for remote use. This feature does not have problems, but is inefficient. The finer the API granularity, the more additional events are required to wait for data to return.

When creating a web-based service, the communication process between the client and the server should be the same as sending a fax: the client can work for a period of time without having to contact the server. Then, after all the data required for one communication is in place, the client will send all the information to the server at one time. The server should also do the same: when sending data from the server to the client, all the content should be sent at one time so that the client can complete all the current tasks.

Now let's assume that the system has only one server, and there are more than 1 million customers. Assume that each customer made an average of 15 orders in the year of last year. Each telemarketing call operates a client during the ordering process and needs to query or create a customer when answering the call. How can we design a series of objects that are most effective on the client and server? Here, it is unrealistic to send each customer and each order to the client at a time: there are too many data records corresponding to 1 million of customers and 15 million of orders.

When designing a web service that communicates with remote computers, we hope to reduce the frequency of communication and the amount of data transmitted during each communication. The two goals are not both the fish and the bear's paw, and we must strike a balance between them. We should try not to go to two extremes, but we can select a smaller number of communications and try to transmit more data at a time.

 

Related Article

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.