Skip to content

Support for large image uploads with nginx upload module #123

@jpunzel

Description

@jpunzel

We anticipate that after a production deployment of our registry instance, it won't be long before we have to handle very large container image uploads. We'd like to find a way to handle this before we actually open it up to a large audience.

As of right now, with a fairly stock configuration, nginx will buffer the POST body in memory, which will obviously fail on relatively small image uploads. This can be improved by tweaks to the client_body_temp_path and client_max_body_size settings, but no matter what, the upload is being buffered before being proxied to uwsgi, and a bottleneck exists.

Ideally, a large image would be uploaded directly to its final location on the filesystem. After some research, I believe the best method would be to use the nginx upload module: https://www.nginx.com/resources/wiki/modules/upload/

The documentation on how to use this with Django is sparse, but here are some links I've found that might be helpful (only the first one mentions a django solution, but the principle is the same):

https://blog.vrplumber.com/b/2013/06/07/nginx-upload-module/
https://thomas.rabaix.net/blog/2014/05/handling-file-upload-is-not-always-easy
https://jiripudil.cz/blog/blazing-fast-file-upload-through-nginx

I'm aware there's also a problem with HTTPS and size limits using Requests (issue #108 ), but we can live with allowing plain HTTP as long as there's a way to handle the use case of very large images.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions