Skip to content

Speed up $request_id generation #1193

@dkoreshkov

Description

Feature Overview

I'd like to have faster $request_id generation with satisfactory statistical properties.
When built with NGX_OPENSSL, nginx calls RAND_bytes( ,16) to generate request ids. It falls back to calling random() four times if RAND_bytes is unavailable. But RAND_bytes is very slow (50-100 times slower for raw bytes). And random() makes lousy 128-bit "random numbers".
Since no security properties are advertised for request_id, RAND_bytes should not be used there.
E.g. calling SipHash twice with a rolling counter and a secret key could give some security at much better speed.

Alternatives Considered

No response

Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions