Is there a way to maintain/work with a persistent connection for a POST command in rails?
I'd like to create an API where my app accepts what amounts to a stream of data from an external service (I'm writing this external service, so I can be flexible in my design here). Speed is critical. I need to get the information from the external source at a rate of 1000+ points per second. Talking with some fellow computer scientists, one came up with the idea of using a persistent connection so that the expensive TCP hand-shake would only have to be performed once. Using a library within the external service, I would then create multiple POST items that are pushed into my rails app and then process those POST items one by one.
My understanding of the rails paradigm is that each request (POST, GET, PUT, etc) takes one TCP connection. Is there a way I could utilize one TCP connection to get multiple POSTs?
I'm currently using the following:
- Rails 3.2
- Ruby 1.9.3 (Could switch to 2.0 if necessary)
EDIT
To help clarify what my goal is:
I have an external system that collects 1,000 data points a second (3 floating point numbers, a timestamp, and 2 integers). I'd like to push that data to my Ruby on Rails server. I'm hoping with a properly configured system I could just use the HTTP stack in real time (as a data point is collected, I push it to my rails server). I could also slow this rate of transmission down and group data points together to send them. I've looked at using messaging queues, but I'd like to see if I could write a more "standard" HTTP API before going to a specialized queue API.