rellocs wood
rellocs wood

Reputation: 1471

Redis performance: hIncrByFloat function or custom Lua script ?

let's say I have hash data stored in redis:

{"fee":0.11,"name":"scott"}

now I want to add some value to the field 'fee', should I use the hIncrByFloat command or , write a Lua script to implement that? please advice from the performance view, thanks!

Upvotes: 1

Views: 226

Answers (1)

Itamar Haber
Itamar Haber

Reputation: 49982

Use HINCRBYFLOAT.

Core commands are more performant than Lua scripts in (probably) every scenario. Use Lua to compose flows that consist of core commands and server-side logic, but not to replace a single core command.

You can, and should, test performance yourself - redis-benchmark can be used for that.

Upvotes: 2

Related Questions