Is any reason why Rack::Deflater gzip is not enabled by default in Ruby on Rails?

1.1k views Asked by At

Is any reason why Rack::Deflater gzip is not enabled by default in Ruby on Rails? What are the downsides of gzip for rails, if there is any?

1

There are 1 answers

0
ralinc On BEST ANSWER

I don't know the official reason behind this but most obviously they do not do this because there are better places to do gzip compression of responses. Like a frontend proxy or load balancer or your CDN. For example, I use AWS Elastic Beanstalk for deploying Rails applications and I configure the gzip compression on the Elastic Load Balancer (ELB), not inside the Rails application. You want to alleviate your application from doing compression and let it focus on its core business logic. As compressing HTML, CSS and JS is a trivial task that any proxy can do, you want to put that load off your application onto your load balancer. I don't think anyone let's Rack middleware do the compression in production. May be only for very simple and small applications that run on a single instance without load balancer in front. For bigger and complex applications you want your proxy to handle this "work".