diaspora / diaspora_federation

A library that provides functionalities needed for the diaspora* federation protocol.
GNU Affero General Public License v3.0
101 stars 29 forks source link

Do not reuse cURL sockets #37

Closed denschub closed 8 years ago

denschub commented 8 years ago

This patch sets CURLOPT_FORBID_REUSE, which tells cURL to close all connections when they are done. By default, connections are held open for later use unless explicitly closed or expired by a timeout. This can improve performance if the same instance is used for multiple requests to a single host.

We never have that: a host receives only one message per queue job, so keeping the socket opened for 60 seconds (the default timeout) is totally useless.

In addition, keeping the sockets open can cause problems for larger instances with fast workers and a lot of jobs. Mainly, https://github.com/diaspora/diaspora/issues/6485 is caused by this very issue, which is resolved by this as well.

This also may resolve some of the memory bloat described in https://github.com/diaspora/diaspora/issues/6763, but we would have to dig further into that to confirm or deny.

SuperTux88 commented 8 years ago

Thanks ❤️