request-id

    Create a route and enable the request-id plugin on the route:

    The Snowflake algorithm is not enabled by default and needs to be configured in ‘conf/config.yaml’.

    Configuration parameters

    NameTypeRequirementDefaultValidDescription
    enablebooleanoptionalfalseWhen set it to true, enable the snowflake algorithm.
    snowflake_epocintegeroptional1609459200000Start timestamp (in milliseconds)
    data_machine_bitsintegeroptional12Maximum number of supported machines (processes) 1 << data_machine_bits
    sequence_bitsintegeroptional10Maximum number of generated ID per millisecond per node 1 << sequence_bits
    data_machine_ttlintegeroptional30Valid time of registration of ‘data_machine’ in ‘etcd’ (unit: seconds)
    data_machine_intervalintegeroptional10Time between ‘data_machine’ renewal in ‘etcd’ (unit: seconds)
    • snowflake_epoc default start time is 2021-01-01T00:00:00Z, and it can support approximately to 2090-09-0715:47:35Z according to the default configuration
    • defaults to 10 bits and each process generates up to 1024 ID per millisecond.

    example

    • Snowflake original configuration

    Remove the corresponding json configuration in the plugin configuration to disable the request-id. APISIX plugins are hot-reloaded, therefore no need to restart APISIX.