By Asored
I’m using Digital Ocean spaces for my Flutter application as file storage. I currently switched from Firebase to DO.
If I understand correctly, every time I want to show an image to the user, I need to presign it. Is it normal, that presigning is very slow? (0,5 seconds loading time)…so it makes no fun to switch images on image carousels for example because of loading times. On Firebase Storage the images are showing directly.
Or do I understand anything wrong?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
It’s normal for generating presigned URLs to take some time, as it involves creating a secure URL with a limited time window during which the user can access the file without needing authentication.
Server Location: The location of your DigitalOcean Space and your server can affect the time it takes to generate a presigned URL. If they are in different data centers, it may introduce additional latency. Make sure your Space and server are in the same region for faster access.
DigitalOcean Configuration: Ensure your DigitalOcean Space is properly configured. You can choose a region closer to your users and use a Content Delivery Network (CDN) to cache and serve your files faster.
Application Code: Review your code for generating presigned URLs. Make sure it’s not doing any unnecessary computations or network requests that could introduce delays.
Caching: Implement caching in your Flutter application to reduce the frequency of presigned URL generation. Once you generate a presigned URL for an image, you can cache it on the client-side for a certain period of time.
Parallelization: If your app loads multiple images simultaneously, consider parallelizing the presigned URL generation process to reduce the perceived loading time. This can be achieved using asynchronous programming techniques in Flutter.
Network Latency: Network latency can also affect the loading time. Make sure your server and DigitalOcean Space have fast and reliable internet connections.
Profiling: Profile your application to identify bottlenecks and slow code sections. Tools like Flutter DevTools can help you pinpoint performance issues.
DigitalOcean Support: If you’ve tried all the optimizations above and still face slow presigned URL generation, it might be worth reaching out to DigitalOcean support for assistance.
In general, while there will always be some overhead in generating presigned URLs for secure access, it shouldn’t take half a second for each image. By optimizing your setup and code, you should be able to reduce the loading times and provide a better user experience.
Hope that this helps!
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.