DEV Community

Cover image for Making file uploads faster
ente
ente

Posted on • Originally published at ente.io

Making file uploads faster

Using Cloudflare Workers for improving upload speeds

We are an end-to-end encrypted photo service, and we were able to ship an improvement to make uploads faster for our customers ⚡️ This post explains the small but important change.

How uploads happened before

When uploading a file, we fetched a list of URLs from the server to PUT files to. Then, the encrypted files / file parts were uploaded to those URLs, that are hosted on storage servers located in Europe.

We noticed that this could be improved by proxying data through Cloudflare Workers that are deployed across the world, there by ensuring proximity to our customers. There was also the added advantage of Cloudflare's great network speeds.

How uploads happen now

Now, we upload the same encrypted file / file parts to the Cloudflare Worker rather than directly uploading to our servers in Europe. The Worker then uploads these to our servers.

Even though this has increased the complexity of uploads on the backend, this has made our uploads faster due to the Workers being closer and having greater network speeds. This gain is even more pronounced for large multi-part uploads.

We got the following results from a sample test using the same set of files:

File Size Before After Improvement
2.60 MB 5.379 seconds 4.119 seconds 23.42%
2.75 MB 4.345 seconds 5.6 seconds 28.88%
3.38 MB 8.136 seconds 8.174 seconds 0.46%
23.60 MB 23.159 seconds 21.168 seconds 8.60%
141.70 MB 119.21 seconds 82.018 seconds 31.20%
354.40 MB 306.75 seconds 217.76 seconds 29.01%

A small change, but faster uploads! 😊


Cover image: Julian Hochgesang

If you'd like to hear more about our performance challenges, follow us on Twitter.

Or if you'd hang out with a bunch of engineers building an e2ee photo storage service, come say hello on Discord.

Top comments (0)