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?

Vasu
  • 2,406
  • 3
  • 20
  • 26
  • 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

1 Answers1

3

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

Davidslv
  • 634
  • 1
  • 7
  • 18