chirpstack/api
Orne Brocaar 098f8db4c6 Migrate device-sessions from Redis to PostgreSQL.
This migrates the device-sessions from Redis into PostgreSQL. This fixes
a performance issue in case the same DevAddr is reused many times
(e.g. devices rejoining very often or a NetID with small DevAddr space).

There were two issues:

The Redis key containing the DevAddr -> DevEUIs mapping could contain
DevEUIs that no longer used the DevAddr. This mapping would only expire
from the Redis database after none of the devices would use the DevAddr
for more than the configured device_session_ttl.

The other issue with the previous approach was that on for example a
Type 7 NetID, a single DevAddr could be re-used multiple times. As each
device-session could be stored on a different Redis Cluster instance,
there was no option to retrieve all device-sessions at once. Thus a high
re-usage of a single DevAddr would cause an increase in Redis queries.

Both issues are solved by moving the device-session into PostgreSQL
as the DevAddr is a column of the device record and thus filtering on
this DevAddr would always result in the devices using that DevAddr, as
well all device-sessions for a DevAddr can be retrieved by a single
query.

Note that to migrate the device-sessions, you must run:

chirpstack -c path/to/config migrate-device-sessions-to-postgres

A nice side-effect is that a PostgreSQL backup / restore will also
restore the device connectivity.

Closes #362 and #74.
2024-02-27 16:17:15 +00:00
..
csharp Add js context to get_activation api method. 2024-02-06 13:16:26 +00:00
go Add js context to get_activation api method. 2024-02-06 13:16:26 +00:00
grpc-web Add js context to get_activation api method. 2024-02-06 13:16:26 +00:00
java Bump version to 4.7.0-test.3 2024-01-12 09:19:50 +00:00
js Add js context to get_activation api method. 2024-02-06 13:16:26 +00:00
kotlin Bump version to 4.7.0-test.3 2024-01-12 09:19:50 +00:00
md Add js context to get_activation api method. 2024-02-06 13:16:26 +00:00
proto Migrate device-sessions from Redis to PostgreSQL. 2024-02-27 16:17:15 +00:00
python Add js context to get_activation api method. 2024-02-06 13:16:26 +00:00
rust Migrate device-sessions from Redis to PostgreSQL. 2024-02-27 16:17:15 +00:00
docker-compose.yml Adds C# builds and namespaces (#100) 2023-01-31 18:29:21 +00:00
Dockerfile-csharp Adds C# builds and namespaces (#100) 2023-01-31 18:29:21 +00:00
Dockerfile-go Update API docker files. 2022-12-05 10:44:46 +00:00
Dockerfile-grpc-web Add device-profile option to configure region configuration. 2023-01-09 12:04:10 +00:00
Dockerfile-java Protobuf Java and Kotlin code generation. (#64) 2023-01-10 15:46:04 +00:00
Dockerfile-js Update API docker files. 2022-12-05 10:44:46 +00:00
Dockerfile-kotlin Protobuf Java and Kotlin code generation. (#64) 2023-01-10 15:46:04 +00:00
Dockerfile-md Update API docker files. 2022-12-05 10:44:46 +00:00
Dockerfile-python Update API docker files. 2022-12-05 10:44:46 +00:00
Dockerfile-rust api: Update build image to Rust 1.73.0. 2023-10-16 11:43:31 +01:00
Makefile api: Refactor meta/meta.proto to streams/meta.proto. 2023-10-31 10:19:38 +00:00