Just going through the book Elixir in action and want to understand how something like a feed reader would work.
Say I have 100’s of feeds that I want to parse on the web, and then display them in my phoenix app view. I will group the feeds by topic.
So I am planning something on the lines of:
grab all the feeds from my db and fetch the xml for each feed
I will store the feeds in memory, but take a snapshot of each feed every now and then so restarts will have data to display
So since a process is synchronized, would it still be safe to store all the feeds in a single process? In practise would something like this be a bottleneck and require a pool of processes?
That could be a bottleneck… and where there is a bottleneck, either spawn more processes, or use ets. As described, I would use ets, and there is a good example inside the book You are reading.
Spawning more processes can be done in multiple ways… Task, spawn, or use poolboy, to manage a pool of workers.
And there is also GenStage, it’s really nice to use.