I’m making a demo app for bidding. It is a POC for channels and now I decided to try to persist data using
Mnesia. First thing is that I’m struggling with decision whether to use
Amnesia wrapper or
Mnesia directly… (but thats off-topic)
The main thing is that before the idea of persisting data I designed the app so that each item that yet to be/is auctioned should rest in dedicated
GenServer and users (via websockets) will
place_bids from channels by issuing message to dedicated
GenServer for given auction item. I thought this solution might be a good idea to leverage the parallelism of
ErlangVM. But now with
Mnesia I feel like I dont need individual
GenServers because I can directly access
Mnesia data… Am I correct? I also thought of preserving the idea of individual
GenServers that would keep the state of the auction item but would periodically/by debounce “flush” the state to
Mnesia… (but that would probably open space for potential loss of unsaved data) Is that dumb idea?
Or would any other approach fit here better?
Thanks in advance!