How can I cache images (express, node, object storage)?

50 Views Asked by At

I have an object storage and an express API that accesses the images via the aws-idk framework to resize them, but I have a problem, the process takes a long time. I tested this with Postman and found out the following:

The load time is 200ms on average, sometimes more, sometimes less, the target is 40/60ms, except for the first load.

I get the desired result when I cache the images on the server with the express instance. But can't the browser do that too, or am I fundamentally misunderstanding something, why does my server need to cache the images? (Postman also has cache and with browsers like Edge or Chrome I have the same result)

Of course, I also send a cache control header that is set to 1 hour.

Unfortunately, the solution with caching on the express server is somehow unclear to me. As the images in the object memory are up to 32 MB in size (the test images currently have a size of 50kb), the working memory fills up quite quickly.

What alternatives, solutions are there to get the images to the user quickly?

Thank you, for help :,)

0

There are 0 best solutions below