jordelver

jordelver

I’ve got a potential project that I think Broadway is well matched for, but I wanted to ask here for a sanity check :slight_smile:

The basic workflow is:

  1. Periodically fetch data from a JSON HTTP API
  2. Store / cache the data
  3. Convert data / munge data into another format
  4. Provide data over XML HTTP API

To begin with there will only be one endpoint, but in the future there will be many different sources. Each may have different schedules for fetching data.

If I was doing this in Ruby (my background) I would probably use some sort of background job to fetch and convert the data, and then serve the data via Rails.

One reason Broadway is attractive to me is because it has features like rate limiting, which I can see being useful as this scales.

Would you use Broadway for this?

Showing Posts 1 to 10

axelson

axelson

Scenic Core Team

Disclaimer: I have never actually used broadway

I don’t think that broadway seems like a good fit since it won’t help you with this piece since the official and unofficial producers all pull from an event stream of sorts:

Currently we officially support three Broadway producers:

    Amazon SQS: Source - Guide
    Google Cloud Pub/Sub: Source - Guide
    RabbitMQ: Source - Guide

Although perhaps someone who’s actually used broadway could offer more guidance.

sorentwo

sorentwo

Oban Core Team

I’m extremely biased, but I would use oban. It has periodic jobs, scheduled jobs, retries, resiliency, etc. Broadway is tailored for ingesting high throughout event streams.

jordelver

jordelver OP

I’m extremely biased, but I would use oban . It has periodic jobs, scheduled jobs, retries, resiliency, etc. Broadway is tailored for ingesting high throughout event streams.

Oban was actually on my list for consideration :wink: I discovered it last week and haven’t had time to play with it yet but it looks really good :+1:

jordelver

jordelver OP

I don’t think that broadway seems like a good fit since it won’t help you with this piece since the official and unofficial producers all pull from an event stream

That’s actually part of the reason I was asking the question - the README does focus on usage with event streams as you say. However, this article uses fetching JSON as an example, but not quite in the same way as I was planning, which confused my thinking.

Thanks for your response :slight_smile: :+1:

svilen

svilen

Author of Concurrent Data Processing in Elixir

Disclaimer: I haven’t used Oban :smile:

I don’t see a reason not to use Broadway, but I haven’t used it extensively myself either. You can give it a go by creating a custom producer as shown in the official guide:

It’s easy to make it do work periodically using Process.send_after/4.

It’s true that Broadway is great for data-ingestion pipelines because you can implement events acknowledgement when dealing with SQS. But if you don’t need that, you can still roll out your producer without acknowledgements and use the rest that Broadway provides.

chasers

chasers

I’ve used Broadway extensively. Have not used Oban.

You can use Broadway to poll you just put stuff in your own producer. So you can totally use Broadway here and it would be great.

With Broadway, you do need to understand the lifecycle of a process and your app if you want to make sure you get every event.

Oban is backed by a database so your state is always there. You don’t have to worry about deploys affecting processes, etc. You sacrifice some throughout for this.

So those are mostly your high level trade offs.

If you’re not super comfortable with gen servers I’d say use Oban. If you need all the throughput use Broadway.

Edit: I should maybe clarify. Broadway won’t do the polling for you. Make your poller and put the results in a queue somewhere (ETS probably) and the have your producer pull from that.

sorentwo

sorentwo

Oban Core Team

There is definitely a difference in throughput between batch ingesting SQS events and pulling from a transactional database. However, I think you’ll be limited by the actual job processing before the job processor’s throughput comes into play.

In my benchmarking Oban can process 15k no-op jobs per second on a single node—and batch processing is currently in the works which will increase that throughput significantly.

akoutmos

akoutmos

Author of Build a Weather Station with Elixir and Nerves

I have written a few article/tutorials on Broadway and perhaps those can help inform your decision:
https://akoutmos.com/post/using-broadway/
https://akoutmos.com/post/broadway-rabbitmq-and-the-rise-of-elixir/
https://akoutmos.com/post/broadway-rabbitmq-and-the-rise-of-elixir-two/

I think some more information may be required to better answer your question:

  • How often are you fetching data from this JSON API?
  • Is it a singular piece of information that needs to be processed (i.e no benefit from concurrent processing)?
  • Do you require a message queue to persist messages across deployments of your service?

On the simple side of the spectrum, you could have a simple GenServer with a send_after to do everything that you outlined and just start that process up in your application.ex supervision tree. On the complex side of things, you could run RabbitMQ and Broadway to do your processing, but that depends on the answers to the Qs above :smiley:. Like others have mentioned, Oban is also a good tool for the requirements that you outlined.

jordelver

jordelver OP

Thanks. I’ll have a read of those docs :+1:

jordelver

jordelver OP

Your top article is the one I quoted above :smiley: Thanks for writing it. I haven’t read your others yet, but will.

To be completely honest, I don’t know the answers to your questions yet - this project is in the very early stages. It’s great to be aware of multiple strategies that may fit, so thanks for contributing to this post :+1:

Where Next? Top

Trending in Questions Top

Blokh
Hey guys, I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly Do you guys have any suggestions what is the best prac...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New
FlyingNoodle
If a change or preparation module uses Ash.Changeset.get_argument/2 or Ash.Query.get_argument/2 (or any of the other get_argument functio...
New
psy-q
I’m trying to set up Emacs with elixir-ls via lsp-mode and credo via Flycheck. This should mostly be preconfigured as Flycheck picks up c...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews