Open saimaz opened 11 years ago
+1
The problem is, that when we don't reuse the connection and close it every time, the calls will be much slower or we will have some memory leaks (as far as I remember that was the problem).
My suggestion would be, that we close the connection in case "persistent" is not set to true for the connection. Would that solve the problem to make it configurable?
Yes, that would solve our problem, because using persistent connections without closing them creates new connections and after some minutes you'll get thousends of open HTTP connections.
Actually it would be enough to add just availability to close single connection (public method) when it's not needed anymore
Yes the public method to close connection would be better.
@audriusb @saimaz Not sure how this would work as you rarely have the Transport object directly. As every client can have multiple connections, for which one you will get the transport and close it?
Actually static resource is created here (for all Transports) https://github.com/ruflin/Elastica/blob/master/lib/Elastica/Transport/Http.php#L175. In my opinion two things are missing:
A static resource for all Transport in one request is created, right? Most of the time php scripts are not long running. So the question is, what happens in case the script ends and the connection was not closed?
In the code, a new connection is only opened in case no other already exists already in this request. Unfortunately we do not have any persistency between the calls (which probably also good).
I agree on point two.
@audriusb @saimaz Any next steps here?
We have switched to https://github.com/elasticsearch/elasticsearch-php, sorry ;)
Ok. I hope the curl_close issue was not the main reason ;-)
IMO for this particular issue static close connection method would be helpful
Agree. I will keep the issue open.
@ruflin I guess this #465 would help a lot with similar problems.
Agree. Lets hope we get some updates from @webpatser
Any news?
Elastica Http Transport object has no curl_close. This causes some connection problems when client is used with http persistent connections.