E
E
et_samoe2017-04-28 10:55:57
Erlang
et_samoe, 2017-04-28 10:55:57

OTP application architecture on Elixir?

I'm learning Elixir, for example I decided to make an application for pinging a list of proxies. The bottom line is that you need to periodically download a list with a proxy from the link, and ping this list into a bunch of streams, leaving only live proxies. As I see it so far:
There is a supervisor for pinger processes. Each pinger knows its own configuration (ping timeout, etc.). Once launched, the pinger sends a message to the importer process "give me a ping proxy" and waits for a response.
There is an import supervisor. The importer receives a message with a request to issue a proxy for ping, and if its proxy list is empty, it replies to the pinger "no proxy yet" and downloads a list of new proxies. After that, it waits for messages from pingers. After receiving the message, it sends information about the proxy to the pinger. The pinger, having done its job, sends a message to the importer with the result of the ping. The importer saves the proxy.
Is such a scheme optimal? It is planned that there will be no more than 1000 pingers, but no less than 500. Is it correct to build getting a proxy for ping and returning the result through messages between processes? Or is it better to let the importer load the list of proxies, for example, into redis, and the pingers themselves take the proxy for ping from there and process the result themselves?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
et_samoe, 2017-05-02
@et_samoe

On the advice of experienced, I decided to use GenStage

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question