We have a decently big Rails app. However, the restful APIs are slow.
Hence, we are prototyping to move the API layer outside of Rails. We are currently considering grape (https://github.com/intridea/grape) which will remove ActiveRecord and other heavy Rails code. The whole API layer will be in core Ruby.
To manage connection pools with PG we are have written a piece of code that opens n number of DB connections and maintains them. Whenever we want to run a query, we use one of those connections and then return them back to the available pool.
Now, we want to somehow run the connection pool generation code to RACKUP server start. So when the RACK server starts all the connection pools are open and stored in RAM.
Any idea how we can invoke certain code at start of RACKUP server?
Thank you in advance