Compressing json responses with gzip


#1

I’m investigating performance of the topology widget on large environments.
I found that using config.middleware.use Rack::Deflater
reduces greatly (10 times, sometimes even more) the size of the json response passed to client and helps reducing ui loading time.

@chessbyte @matthewd I remember there was some resistance to this method on gitter, so I’d like to resume this discussion here.
I do think that enabling it only on production env and not on dev env is not the optimal way as it
makes dev work not efficient, and also makes things harder to investigate/keep consistent because of performance differences on both environments, especially when it comes to client side.


#2

What where the arguments against compression?

I can see only one drawback – it will cost some CPU time on the server and I have no idea how significant that might be.


#3

I will let @matthewd to reply on why he prefers not to use the deflater, but as for the processing time - I haven’t measured it solely on server side, but checking how much time it takes the topology ui to get the json data needed to populate the topology from the server (the GET request with the json response), not only it is a smaller response about 10 times in size, it was in fact faster too in about 20 percent.


#4

ping, no responses on the discussion. adding also @Fryguy.


#5

I don’t really have a preference, but I can’t see why we wouldn’t apply it in production mode if it improves things.

and also makes things harder to investigate/keep consistent because of performance differences on both environments

I have to disagree with this bit though. dev and prod are already different for these reasons, especially since you can reload code and you don’t use precompiled assets. Trying to make them consistent doesn’t seem like a valid argument, but I can see the argument about things being faster, particularly if the middleware is relatively transparent.

@matthewd, what were your reservations?


#6

@Fryguy I agree that certain things are different between prod and dev environments. However it’s mostly around loading things as you said yourself, and making changes easier for developers.
Auto-compressing server/client communication doesn’t seem to me as the thing that needs to be different between those 2 setups, and also it’s really a one liner.


#7

still no response…


#8

Sorry… yeah, let’s just do it and see how it goes.