koajs/compress

4.x seems to be significantly slower (not related to brotli!)

indeyets opened this issue · 4 comments

I see that my app works with much higher CPU load and produces 20% throughput at the same time.

3.1.0 with no options: fast (119MB/s)
4.0.0 / 4.0.1 with no options: slow (20 MB/s)
4.0.x with { br: false }: slow
4.0.x with { br: false, gzip: false, deflate: false }: fast again

same machine, same nodejs version (12.16.3)

3.1.0 produces compressed output (I checked)

trying to trace it further

@uhop can it be related to the new "external" checks of Accept: headers?

uhop commented

4.0.0 was based on my ideas, but not on my code. I have to look first and compare versions.

In general, I would assume that any checks are fast, and, probably, done just once, and all CPU time is spent compressing. Could it be that gzip is running with a higher compression rate by default than in 3.1.0? One way to see it is to compare sizes produced by different versions.

I'll investigate.

Could it be that gzip is running with a higher compression rate by default than in 3.1.0

I doubt it is, as default invocation is without any options both in old and in new code. Will try to run another round of tests a bit later

ok. I guess it is related to #112

benchmark tool does not request compressed responses by default, but it gets one now.

I'll make separate investigation about why it hurts my production installation so hard.

I will close this issue, but #112 should be fixed