Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
May 28, 2022 11:46 am GMT

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 SizeBeforeAfterImprovement
2.60 MB5.379 seconds4.119 seconds23.42%
2.75 MB4.345 seconds5.6 seconds28.88%
3.38 MB8.136 seconds8.174 seconds0.46%
23.60 MB23.159 seconds21.168 seconds8.60%
141.70 MB119.21 seconds82.018 seconds31.20%
354.40 MB306.75 seconds217.76 seconds29.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.


Original Link: https://dev.to/enteio/making-file-uploads-faster-44i0

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To