In the current implimentation, LoadX509KeyPair() is executed when making a new http request. As a result, a new Transport is created for each request. However, TCP connections cannot be reused across different transports. This will cause the program to reach fd limits quickly under a heavy load, e.g., invoke actions programmingly.
Here is a demo of the deficiency:
When I invoke an action (host ip: 13.66.***.**) sequentially for a couple of times, several connections are established. Idealy, only one connection should be created and reused.
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
tcp 0 0 localhost:socks 0.0.0.0:* LISTEN
tcp 0 0 localhost:1188 0.0.0.0:* LISTEN
tcp 0 0 mingyu-virtual-ma:35702 13.66.***.**:https ESTABLISHED
tcp 0 0 mingyu-virtual-ma:35698 13.66.***.**:https ESTABLISHED
tcp 0 0 mingyu-virtual-ma:35696 13.66.***.**:https ESTABLISHED
tcp 0 0 mingyu-virtual-ma:35700 13.66.***.**:https ESTABLISHED
tcp 0 0 mingyu-virtual-ma:35704 13.66.***.**:https ESTABLISHED
tcp 0 0 mingyu-virtual-ma:35694 13.66.***.**:https ESTABLISHED
tcp6 0 0 ip6-localhost:ipp [::]:* LISTEN
tcp6 0 0 ip6-localhost:socks [::]:* LISTEN
In the current implimentation,
LoadX509KeyPair()
is executed when making a new http request. As a result, a newTransport
is created for each request. However, TCP connections cannot be reused across different transports. This will cause the program to reach fd limits quickly under a heavy load, e.g., invoke actions programmingly.Here is a demo of the deficiency: When I invoke an action (host ip:
13.66.***.**
) sequentially for a couple of times, several connections are established. Idealy, only one connection should be created and reused.