railsmechanic

railsmechanic

Is Phoenix well suited to handle large file uploads?

Hi all!

I am currently investigating different options in order to handle large file uploads.
As our application needs additional logic to be executed after a file was successfully uploaded, I think a simple FTP server is not well suited for that use case. Ok, many FTP servers offer hooks after a file was uploaded, but starting a bunch of small applications is not the thing we want.

As we’re already using Elixir in a couple of applications I tend to write an upload sever using Phoenix. As the uploaded files my vary from 200MB to 2 or more GB I’m not fully convinced that Phoenix is the right tool for that type of task.

What do you think, is Phoenix well suited for that kind of use case?

Many thanks!

Most Liked

josevalim

josevalim

Creator of Elixir

For those generally wondering about file uploads, Phoenix by default streams file upload to disk. That is done by Plug.Parsers. The file is never fully loaded in memory and Plug.Parsers allow you to control precisely the maximum file size, the upload speed, etc. The file is removed from disk after the request finishes (unless you move the file elsewhere). It should suit for most needs without a need to resort to put nginx in the front.

If you want to perform other forms of streaming, for example, working as a proxy, then you can dump Plug.Parsers and roll your own. But generally speaking, all of the tools are there and Plug.Parsers should suit the majority of cases.

railsmechanic

railsmechanic

I’ve written a small prototype Phoenix application and have done a couple of tests, e.g. uploading 500MB files in parallel. The results looks promising. The load is (as expected with Elixir :grin:) really low and the performance is only limited by the network connection and the attached disk(s) of the server.

As a first result, I’m happy with that. I think I’ll do a stress test over the weekend…
The problems stated by @idi527 seems really be resolved by now :+1:

10
Post #6
mpugach

mpugach

I think that it should no be the responsibility of your application.

Let it be handled by Nginx. After saving the file it will call the app back.

This applies to any framework and also saves app server’s connections.

Where Next?

Popular in Questions Top

hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
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
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
Tee
can someone please explain to me how Enum.reduce works with maps
New
JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
openscript
Hello! Sorry for this astonishing simple question, but I’m really stuck. I try to set up the intellij-elixir plugin, but I don’t know ho...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New

Other popular topics Top

WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
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
pmjoe
I have a relationship of love and hate with Elixir. Lots of things are just absolutely right, but there are some things that are kind of ...
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
KronicDeth
Elixir plugin for JetBrain’s IntelliJ Platform (including Rubymine) This is a plugin that adds support for Elixir to JetBrains IntelliJ...
289 36352 110
New
Brian
What is the proper way to load a module from a file in to IEX? In the python world, doing something like this pretty standard: from ....
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 54120 245
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement