Skip to content

[Audit] drogon: gzip compression uses default level instead of level 1 #65

@jerrythetruckdriver

Description

@jerrythetruckdriver

Violation

File: frameworks/drogon/main.cc

What happens

The compression endpoint relies on drogon's built-in gzip via:

app().enableGzip(true);

Drogon's gzip implementation uses Z_DEFAULT_COMPRESSION (zlib level 6) by default. There is no configuration in main.cc or the build to set gzip level 1.

What the spec requires

Must use gzip level 1 (fastest) — check the code for compression level config

Using level 6 instead of level 1 means significantly more CPU time is spent on compression per request, making the framework look slower than it would be with the correct level, while also producing smaller output than competitors using level 1. This distorts the benchmark in both directions.

Suggested fix

Drogon v1.9.x supports app().setGzipLevel(1) (or check the drogon docs for exact API). Add before app().run():

app().enableGzip(true);
// Set gzip compression level to 1 (fastest) per benchmark spec
// Note: check drogon API - may need a custom middleware or config file approach

If drogon doesn't expose compression level configuration, this should be documented as a framework limitation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions