Performance Comparison Between Restful and TCP call methods in WCF, wcfrestful
1. Lab background
For the distributed access service provided by WCF, the two most common methods are Restful and Tcp.
The results show that the Rest mode is the best performance in stress testing.
In addition, it is considered to be cross-platform, and automated testing is convenient. It also uses the Restful method to provide services.
2. Features of the WCF Service:
This service provides real-time and unified serial numbers for all clients (CS clients or B/S browsers ).
3. Test Results
Test 1: Provides services based on the Restful method, and the client uses the http route request method to access the service:
Rest service address: http://xxx.xxx.xxx.xxx: 6211/ITSTemplate. Study. RestAPI/SeqService/
Two clients call 100000 times, respectively. Average Call time: 0.59 ~ 0.61 ms, 50 times the performance of TCP (2.66/0.59 ).
Before calling, you can use netstat-aon | findstr "6211". Restful has no client to call the instance.
In the call, you can use netstat-aon | findstr "6211". Restful has two clients to call the instance.
After the call is completed, the last call is completed. About 1 minute later, WCF will automatically release the 6211 port instance created by the server. You can see that the average call time is 0.59 ~ 0.61 Ms
Test 2: Provides services based on the TCP mode. The client uses the Libary interface to reference the class library to access the service:
TCP Service address: net. tcp: // xxx. xxx: 6212/ITSTemplate. Study. RestAPI/SeqService/
Two clients call 100000 times, with an average call time of 2.66 s.
Before calling, you can use netstat-aon | findstr "6212". TCP has no client to call the instance.
In the call, you can use netstat-aon | findstr "6212". TCPl has two clients to call the instance.
After the call is completed, the last call is completed. About 1 minute later, WCF will automatically release the 6211 port instance created by the server. You can see that the average call time is 2.66 milliseconds.
Summary: in the next section, I will test the concurrent performance of REST on a remote ECs instance, and set the response timeout time of REST to 1 second.
In addition, through MQ, the server can handle concurrent requests as much as possible and make asynchronous and asynchronous responses to client service requests.