egze

egze

Erlang lib or System.cmd to other binaries for AWS?

At work we ran into the situation that Elixir AWS libraries are too limited/rough for our needs. There is an option to use erlang libraries (erlcloud is quite a good lib) or shell out to some other command line tool with System.cmd.

I have a feeling that native is better, but when confronted with the choice - I couldn’t really give any strong arguments why it’s better to use an erlang library with its inconveniences of charlists and a bit different style than Elixir, instead of cmd and parsing json.

Is there actually a benefit? Performance? Anything else?

Most Liked

hauleth

hauleth

Spawning OS processes is way more expensive than calling local functions (even if the function spawn Erlang processes). Also it is much harder to end with zombie processes (which can be painful in poorly configured Docker containers) or any other issue with running external processes.

vrcca

vrcca

Yes. It is as simple as this:

defmodule AWS.SNS do
  def publish(topic, payload) do
    :erlcloud_sns.publish_to_topic(topic, Jason.encode!(payload))
  end
end

Also it helps when unit testing because we can configure a different implementation or use a mock instead of this.

vrcca

vrcca

At work we built a load generator app in Elixir which uses erlcloud. We are sending 2m SNS messages with no issues (at some point you may notice that the HTTP connection pool becomes the bottleneck, but not the lib itself). Also, calls to erlcloud are wrapped in an Elixir module. Eg.: AWS.SNS.publish(topic, message), this in turn calls :erlcloud.

Where Next?

Popular in Discussions Top

Donovan
Hello everyone, I’m so glad to have discovered this awesome community. Thanks for creating it! This is my second post, and apologies for...
New
hazardfn
I suppose this question is effectively hackney vs. ibrowse but we are at a point in our project where we have to make a choice between th...
New
ben-pr-p
In general I’ve been sticking to this community style guide GitHub - christopheradams/elixir_style_guide: A community driven style guide ...
New
acrolink
How does the two languages compare when it comes to server side application development? Any experiences or ideas? Thank you.
New
AstonJ
If so I (and hopefully others!) might have some tips for you :slight_smile: But first, please say which area you’re finding most challen...
New
scouten
I’m looking for a host for the server part of a small (personal) side project that I’m working on. It’s currently written in Node.js and ...
New
Fl4m3Ph03n1x
Background A few days ago I was listening to The future of Elixir from Elixir Talks, with Dave Thomas (@pragdave ) and Brian Mitchell. I...
New
axelson
Decided against including more info in the title, but the gist is that Plataformatec sponsored projects will continue with the assets bei...
New
Markusxmr
Since Drab has been developed for a while in the open, introducing the Liveview functionality in a way it happend appears to undermine th...
New
slashdotdash
Phoenix Live View is now publicly available on GitHub. Here’s Chris McCord’s tweet announcing making it public.
New

Other popular topics Top

TunkShif
This post is an instruction guide to help you setup your Neovim for Elixir development from scratch. It includes general information on h...
274 42158 114
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New
baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
shahryarjb
Hello, I have map which I want to convert it to string like this: the map: %{last_name: "tavakkoli", name: "shahryar"} the string I ne...
New
stefanluptak
Hello everybody, usually, I use a 29" ultra-wide monitor for VSCode which can easily accomodate explorer (files panel) + file with code ...
New
boundedvariable
I am going through the kafka architecture. All the features what the kafka is providing are already in Erlang. I would like hear your opi...
New
klo
Got a question about when to concat vs. prepending items to list then reversing to achieve appending. So i know lists boil down to [1 | ...
New
Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 127536 1222
New

We're in Beta

About us Mission Statement