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
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
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
) 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 ![]()
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.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









