I quickly browsed the source code of Feign, I found that Feign uses JDK's HttpUrlConnection
to issue HTTP request and close it when request finished without using a connection pool. I doubt the efficiency of this kind of manner. Then I read the document of Spring's RestTemplate
which says RestTemplate
can switch to Apache Http Client or OKHttp to send HTTP request:
Note: by default the RestTemplate relies on standard JDK facilities to establish HTTP connections. You can switch to use a different HTTP library such as Apache HttpComponents, Netty, and OkHttp through the HttpAccessor.setRequestFactory(org.springframework.http.client.ClientHttpRequestFactory) property.
Does it mean RestTemplate is better than Feign at the view of performance?