I have to create http connections within a rails app to pull some data from a remote server. I am using Net:HTTP, but the http connections created are not persistent. So I end up having lots of sockets in TIME_WAIT state, as these http connections are closed. Anyone knows a good pooling gem which will keep the connections persistent and reuse them?
Asked
Active
Viewed 3,558 times
5
-
Don't open connection on action level, use `initializers` for that so you will have one connection per server process. – Victor Moroz Mar 23 '12 at 16:13
-
I need multiple connections, so I have to do pooling myself or use a library. Don't want to re-invent the wheel :) – Vasu Mar 23 '12 at 16:42
-
Just found persistent_http. http://rubydoc.info/gems/persistent_http/PersistentHTTP – Vasu Mar 23 '12 at 17:58