Skip to content

Use Valkey's EVALSHA to execute loaded Lua scripts for optimization #831

Description

@jordigilh

Valkey was introduced as a dependency as part of the development of the M1, M2 and M6 sections of the TRL epic (#121) in PR (#796).

The code loaded Lua scripts using the EVAL command to execute the script with the parameters. This can impact performance as each flow will perform the same call.

It was suggested during the review to use the EVALSHA command instead, which uses a unique SHA for each script that is a 40 char long and uses the cached script in Valkey instead of processing the script per call.

The goal is to replace the EVAL with EVALSHA and implement a fallback to reload the script on failure (flush cache, for instance).

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