5

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?

3
  • Don't open connection on action level, use initializers for that so you will have one connection per server process. Mar 23, 2012 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, 2012 at 16:42
  • Just found persistent_http. rubydoc.info/gems/persistent_http/PersistentHTTP
    – Vasu
    Mar 23, 2012 at 17:58

1 Answer 1

3

Use https://github.com/mperham/connection_pool, it's actively maintained.

Not the answer you're looking for? Browse other questions tagged or ask your own question.