Please sign in to comment.
Add Rack::Builder#warmup method for app preloading.
This new `warmup` method takes a block which is invoked after the app is built. The block can be used to make mock requests that ensure all application dependencies are loaded before the app starts serving traffic. With complex frameworks like Rails, many dependencies are auto-loaded and data like mime-type and i18n is not loaded into memory by default. This often means the first few requests handled by an application are quite slow. With this patch, config.ru can simply make requests via warmup to exercise the app before it is used: $ tail -4 config.ru warmup do |app| client = Rack::MockRequest.new(app) client.get('/') end
- Loading branch information...
Showing with 28 additions and 2 deletions.