Battle of the Bandwidths

Wednesday, August 17th, 2020

I decided to peek at my Firebase project cost for PromptBase the other day and noticed 2 things:

1. It was way higher than I thought it would be.

2. It was shooting up fast.

For context, it costs me about £5/month to run Mailoji.

The main cost was from "cloud storage bandwidth".

When a user uploads a prompt, they upload some example images with it to Firebase storage. Then, when a user is viewing the store page for that prompt, the images served on that page are also from cloud storage.

The problem was, I was serving the raw images uploaded by the user from Dall-E, which are 1024 × 1024 and about 1.5 MB each.

On a store page with 9 example images, that's over 10 MB of bandwidth per page view! Not good.

Fortunately, Firebase have this great "Image resizing" extension that I could just turn on, and now my images are resized and served at a much smaller size of 600 x 600, with a lower bandwidth.

I know I shouldn't be optimising for costs at this stage, but it felt like an important one over the long haul for image-heavy PromptBase.

<< Next
Prev >>