Webrick and Thin are really slow serving static files in Windows. How can I speed them up? Webrick and Thin are really slow serving static files in Windows. How can I speed them up? windows windows

Webrick and Thin are really slow serving static files in Windows. How can I speed them up?


You are running into two existential problems that have plagued Ruby developers for a long time:

  • Webrick is slow. Always. Just don't even bother.
  • Ruby is always slower on Windows. Sometimes by orders of magnitude as you've found.

So if you insist on doing development on Windows proper (as opposed to developing only on Linux or developing on a Linux VM running on Windows), then we need to figure out some ways of putting lipstick on a pig.

Some ideas:

  • Make sure you run the latest version of Ruby.
  • Try deploying nginx with Thin as shown in this helpful albeit dated tutorial. This will help you get the most out of Thin's multithreading and asynchronicity.
  • Use Capistrano to deploy to Windows via this also dated GitHub project.

If you do decide you've had enough of developing Rails on an environment it wasn't designed for, you can set up a VM in the manner described here. The author reports significant speedup.


Use an Ubuntu VM inside VirtualBox, it's probably much closer to your deployment environment then mac and windows which means less "but it worked in development" troubles in production.

Also, you will save yourself a lot of time dealing with quirks of different ruby/gems implementations and various levels of headache due to native extensions.

You can:

  1. set up internal network so you can use browser under windows to browse the app running inside the VM
  2. use something like putty to open console sessions to VM
  3. share a Dropbox/Sparkleshare folder with your Ubuntu VM so you always have same code between Windows and Mac box and Ubuntu VM
  4. and this enables you to use your favorite editor under windows/macos to edit files inside the VM
  5. you can use that same VM under Mac too

Ubuntu installation under VirtualBox is fast, easy and well documented, it's pretty much just a wizard. Alternatively, you can try finding a good vagrant recipee (see http://www.vagrantup.com/) or ask around to see if a colleague of yours would be willing to share his/her vbox.


I experienced a performance decrease on development (due to real-time compilation) working with projects with a large number of assets, but I was not on Windows.

I assume the large performance difference may be caused by some inefficient asset compilation under Windows.

I don't any Windows development experience, I haven't been using a Windows machine for a long time, however I registered a noticeable performance increase in parallel asset processing (in development) when I switched to multi-thread servers, specifically Puma. Keep in mind that, in any case, the default Rails webserver (Webrick) is very inefficient.

As Konstantine explained in this answer, there are currently several choices available. You can group them by the processing mode.

Skipping all the background history about Ruby threads, multi-process etc, I'd invite you to try Puma in your machine and see if it improves the load.

Puma works better with Ruby implementations that offer real multi threading, but quoting the official readme

On MRI, there is a Global Interpreter Lock (GIL) that ensures only one thread can be run at a time. But if you're doing a lot of blocking IO (such as HTTP calls to external APIs like Twitter), Puma still improves MRI's throughput by allowing blocking IO to be run concurrently (EventMachine-based servers such as Thin turn off this ability, requiring you to use special libraries). Puma is designed to provide a simple and high performance request/response pipeline to Rack apps.