Re:Rails on Docker · Fly
by dewey on Thursday January 26, 2023 @12:51PM
(#34535523)
Yes, usually you still serve your asset (images,...) directory through nginx or something similar, though.
[ Parent
| on HN ]
Re:Rails on Docker · Fly
by ye-olde-sysrq on Thursday January 26, 2023 @04:31PM
(#34539123)
This has been my experience too, and I've never even used Rails at scale. Puma will struggle to serve "lots" (tens on a single page) of (for example) static images (though the actual user experience varies across browsers - safari does okay but firefox chokes and chromium is in the middle). This is with puma on a decent intel prosumer CPU (an i7 iirc) using x-sendfiles through nginx. So puma isn't even actually pushing the image bytes here.
I replaced it with nginx intercepting the image URLs to serve them without even letting puma know and it was instantly zippy. I still use sendfile to support when I'm doing dev and not running nginx in front of it, and I'm not happy with the kind of leaky abstraction there, but damn are the benefits in prod too difficult to ignore.
Re:Rails on Docker · Fly
by jrochkind1 on Thursday January 26, 2023 @06:31PM
(#34540363)
Serving the assets directly with the Rails app, but with a CDN caching layer in front, is also common, and is what heroku for instance recommends.