Device storage in Redis

Is the device information also stored in Redis??

Transient data like device-sessions is stored in Redis, other information like settings that you don’t want to expire is stored in PostgreSQL.

1 Like

Can I configure the receiving window by any means? Somewhere it must be deciding about the receiving windows for downlink packets? I want to implememt my own algorithm for it… I need some help

That is a different question than where the device info is stored. LoRa Server currently uses RX1 (Class-A), but I’m planning to implement also RX2 in case RX1 is nacked by the gateway because of timing issues. You will find all logic here: https://github.com/brocaar/loraserver/blob/master/internal/downlink/data/data.go

Hello, your response implies that the data from redis can be discarded and the operation of the server will not be affected, am I right?
I tried deleting redis state, I’ve lost all the data from activation page. So if I have ABP devices, the data about keys would have to be entered again. Is this by design or am I missing something?
I would assume that redis would only be used as a cache and all data should be recoverable from postgres.

Session data is stored in Redis. When flusing your Redis storage, all session-keys, frame-counter states, device states etc… are lost. For performance reasons these are not stored in PostgreSQL.

Thanks, I have some doubts wrt reliability of this setup, maybe it is just my lack of experience
I am aware that redis can be configured to perform write after every modification, but wouldn’t it negate the performance gains?
I think that the device session data should be split into transient and persistent. Postgres seems as a natural fit for session keys, whereas counters can be primarily in redis and be synced to postgres.
Do you have any intuition about scaling of this setup? E.g. number of packets per second where current setup would behave differently to the one proposed?

Typically you configure Redis to write to disk after x modifications and / or each time-based interval.

Personally I think this setup improves scalability. Redis is easier to shard over multiple machines. Note that all data required to activate a device (OTAA) is stored in PostgreSQL. So even if you would completely flush your Redis database, your devices could still re-activate using OTAA.

Hii Brocaar,

Where does device session data stored in Redis Database, I had checked all data but didn’t get frame counter, i.e uplink and downlink frame counter from device activation page.
Please help with your inputs.

Thanks in Advance…!!

Kinjal Chhaparwal

1 Like

You will find the source here:

2 Likes