'SignalR Core - Storing multiple subgroups in cache
I've started playing with SignalR and I don't have an idea how to deal with storing subgroups. Let me draw a picture of a problem that I'm facing.
At first I want to say that I know that something like groups are already existing but probably will not help me.
I have, lets say, functionality X (some kind of a group) and each group have subgroups - some thing like X.a, X.b, X.c. And now each subgroup may be combined with other subgroups - like X.ab. I'm wondering how to deal with such when User 1 has subgroup a+b and User 2 has subgroup like a+c. Creating permutations is silly since it would require signalR creating groups as follows: X.a, X.b, X.c, X.ab, X.ac, X.bc, X.abc. And that's for only 3 subgroups but I'm expecting more that 200 subgroups (not combined).
I thought about using some kind of cache (i.e. Redis) and save those subgroups per User - (something like user1.X -> [a, b], user2.X -> [a, c]) but with 1k+ users looping though all users would be painful. So next idea is to group it by functionality like: X -> [ user1: [a, b]], user2: [a, c]] and again problem with number of users but at least easy to get everything from redis. This approach also exposes another problem: the size of value for key in redis. Storing such structure as json will be huge in size, deserialization will be slow and sending will be through the loop.
Do you maybe have some idea how to implement something like this? Should I use SignalR at all? Maybe I should use something else?
More details:
- Project will run on Raspberry Pi4
- Data will be used in frontend (Vue, React, whatever)
- Use case: There are 1k users. Each user can select categories of products and subcategories. Periodical new list will be send accordingly to user's requirements. User don't have to be registered.
- What is need is performance, data structure which provide this performance
- Idea how to send this data through SignalR. Loop or maybe something else?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|