stmcginnis / gofish

Gofish is a Golang client library for DMTF Redfish and SNIA Swordfish interaction.
BSD 3-Clause "New" or "Revised" License
204 stars 109 forks source link

Expose config option to keep alive TCP connections #351

Closed stmcginnis closed 3 weeks ago

stmcginnis commented 3 weeks ago

This adds a ReuseConnections configuration flag. When set, this will try to configure the HTTPClient transport to not immediately close connections so that they can be reused by subsequent API calls.

Closes: #349

Testing

I ran something that collects a lot of different information from a system. Its original unmodified timing was:

real    0m35.706s
user    0m0.165s
sys 0m0.063s

After setting the new reuse flag, the same operations timing was:

real    0m26.284s
user    0m0.266s
sys 0m0.083s

I also tried tweaking both ReuseConnections: true and MaxConcurrentRequests: 2 and got even better results:

real    0m21.510s
user    0m0.092s
sys 0m0.039s
stmcginnis commented 3 weeks ago

Local testing is good, so I'm going to merge this. But I would still appreciate any feedback from others to make sure this seems to work as expected and to know if there are any issues with this approach that I've overlooked. Please open an issue if there are any negative side effects from this that I've overlooked.