Jaypee

Jaypee

Dear Elixir Community,

First, I hope I choosed the right thread to post…

After Clojure last year, I’m currently studiying Elixir.
I’ve read several books, seen tons of videos and also struggled with some exercices on Exercism/Elixir ( a bit less “beginners friendly” than its Clojure counterpart “4Clojure” !).

It happens that the advantages of Elixir/OTP could benefit to the project I’m working on at the moment, so I would like to do some tests/benchmarks on some basics componants of this project:

I want to implement small servers in Elixir, that could be located on several computers/VM which simply send and receive files and could also verify their integrity (MD5 checksum ?)

The benchmark will mainly focus on scalability (multiply the servers and test a lot of simultaneaous file transfers) and robustness (test the transfer of huge files between two servers).

At the moment, I must confess that I’m a bit confused with the Elixir/OTP Genservers, Supervisors, Workers and others and how to correctly articulate them.
So I would like to have some advices/suggestions/hints on the correct way to use and organise these entities in order to implement the most efficient file transfer server in Elixir, regarding the goals of the benchmark.

I’m also open to suggestions concerning tips and tricks I could use to optimize my FT servers.

To my knowledge, Elixir is not used in my (big) company and I’d really like to succeed in providing a “proof of concept” ! :wink:

Best regards and thanks in advance for your help.

P.S.: Please forgive my English as long as you roughly understand what I write !

Showing Posts 1 to 10

Fl4m3Ph03n1x

Fl4m3Ph03n1x

Can you send the files via HTTP POST? If so, a simple app using HTTPoison (or HTTPotion) with cowboy would likely suffice.

Otherwise, using Phoenix may be more up you alley:

https://phoenixframework.org/blog/file-uploads


Generally speaking using Phoenix will likely be easier, since the framework already does most of the work for you, but you will suffer in performance when compared to the first option.

brightball

brightball

But not much

Jaypee

Jaypee OP

I thought about Phoenix (and tryed it, following the “Chat” course) but it seemed to me that a framework could be a bit “heavy” for my simple FT servers.
I will then considere it.
Thanks.

Fl4m3Ph03n1x

Fl4m3Ph03n1x

Depends on the level on incoming traffic you actually have. The more traffic, the more you will feel Phoenix dragging.

Jaypee

Jaypee OP

My first idea was to set my servers as nodes, sending them files streams.
This could allow me to incrementally calculate the MD5 checksum while the files are streamed and avoid the waste of time.
Something like:

File.stream!("./thefile",[],2048) 
|> Enum.reduce(:crypto.hash_init(:md5),fn(line, acc) -> :crypto.hash_update(acc,line) end ) 
|> :crypto.hash_final 
|> Base.encode16(case: :lower)
brightball

brightball

Maybe this hasn’t been updated in a while but this really shouldn’t be an issue.

AstonJ

AstonJ

What is your experience on which you base such comments?

As shown in the benchmarks by @brightball any performance hit by Phoenix for the majority of apps would generally be considered to be negligible.

Fl4m3Ph03n1x

Fl4m3Ph03n1x

Our system with hundreds of thousands of requests per seconds and the fact we are looking into alternatives to phoenix templating because of that.

I don’t know if the OP will test his system the same way we use ours, it may also be because we are not using Phoenix at the best of its potential, but this is my experience.

Still, I find what I say not to be polemic - I still recommended Phoenix to the OP and even directed him to some documentation.

It’s up to the OP to check both options and decide for himself. If Phoenix was borderline unusable with high traffic (like some community packeges in hex) then I wouldn’t recommend it in the first place.

AstonJ

AstonJ

Can you share what app/site that is? I’d love to see :smiley:

Fl4m3Ph03n1x

Fl4m3Ph03n1x

I can’t :frowning:

We do backend and for all purposes we are invisible to people. We deal mainly with data from providers and we use Phoenix Views as an easier means to modify XML, HTML, JS and JSON files (a decision was made that using Phoenix would be easier than dealing with AST trees). We are now updating Phoenix from 1.2 but it is proving to be a battle we want to avoid.

Not only that, sharing company code would get me fired. Hence the reason why I always have MWE in my forum threads and not real code.

I know this is not the answer one would expect. It even undermines my argument (I am asking readers to trust my word without real proof).

To add to that, I don’t even know if the OP will use Phoenix the same way we did. These reasons are exactly why I still recommended OP to try it out in my first post.

I think Phoenix is awesome, it’s not working for us and I am sorry I can’t provide additional context.

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
Onor.io
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
Trolleger
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
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
matt-savvy
Anyone here using Honeybadger? My Honeybadger account is being overwhelmed with noise from some bots. Seeing a lot of Bandit.HTTPError...
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

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
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
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews