简体   繁体   中英

puma: faster server reload?

I'm using Puma for a Rails app and I need to speed up the iteration loop of making a file change and having the web server able to reload the page. Right now it takes at least 30 seconds which is too slow. Ideally, it would only be a few seconds.

Here's the output from starting the server if that helps:

[26861] Puma starting in cluster mode...
[26861] * Version 2.8.2 (ruby 2.0.0-p451)
[26861] * Min threads: 4, max threads: 8
[26861] * Environment: development
[26861] * Process workers: 1
[26861] * Preloading application
[SKYLIGHT] [0.3.12] Running Skylight in development mode. No data will be reported until you deploy your app.
Deprecated, please require 'sidekiq/pro/web' now at /usr/local/lib/ruby/gems/2.0.0/gems/railties-3.2.18/lib/rails/application/routes_reloader.rb:40:in `block in load_paths'
[26861] * Listening on tcp://0.0.0.0:4000
[26861] Use Ctrl-C to stop
[26939] + Gemfile in context: ~/project/Gemfile
2014-05-14T00:18:16Z 26939 TID-owgxfytuc INFO: Sidekiq Pro client with redis options {:url=>"redis://localhost:6001”, :driver=>:hiredis}
[26861] - Worker 0 (pid: 26939) booted, phase: 0

You should be able to make changes in your rails app without having to restart your server in development mode (which is what I assume your are in). There are some exceptions like initialisers and migrations that require a full reboot but most of the time you should be able to get away with not restarting your sever.

However there are also application pre-loaders out there that speed up your server start time by watching for file changes and loading the server.

As of rails 4.1 this has been rolled into the framework with spring https://github.com/rails/spring which has support for rails 3.2 upwards.

Another pre-loader that I have used is Zeus with some good results https://github.com/burke/zeus

That isn't an exhaustive list of the pre-loaders out there, just the ones I have actually used

Hope that helps

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM