I want to design a feed reader that will render feeds grouped by topic

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:

  1. grab all the feeds from my db and fetch the xml for each feed
  2. 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?

1 Like

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.

In “Programming elixir 1.3” ? Which section, I’m on Chapter 19.

Thanks!

The book You mentionned in the op :slight_smile:

PS. Oh… I am sorry, I am refereing to chapter 10 of the second edition of Elixir in Action.
I just checked in the first edition, it’s also chapter 10.

1 Like