Memory efficient data structure for IoT?

Hi everyone,
What is the most memory efficent Redis data structure for an IoT app??


It depends on the shape of your data, if each event is just a single numeric value, then RedisTimeSeries.
If instead you have multiple properties, then it’s probably Redis Streams.

1 Like

Definitely agree with that assessment and with IoT you will likely end up using Redis Streams.

1 Like


It depends on what kind of data you are processing, attributes and data follow. few examples came in my mind:

  1. use case just ingesting IoT data and you may want to process the response. in this case Redis Streams might be good option:

XADD mystream * cpu-temp 23.4 load 2.3
XADD mystream * cpu-temp 23.2 load 2.1

  1. If the use case is for analytics then you can use RedisTimeSeries

TS.ADD temperature:2:32 1548149180000 26 LABELS sensor_id 2 area_id 32
(integer) 1548149180000
TS.ADD temperature:3:11 1548149183000 27 RETENTION 3600
(integer) 1548149183000
TS.ADD temperature:3:11 * 30
(integer) 1559718352000

  1. If are just storing IoT devices meta data as cache and not frequently going to change then you many use Hashes key per device and put all fields with respective fields.

Hope this helps. If you can describe your use case in more details, it will be easy to answer with better approach.