[英]Firebase: cloud storage high bandwith
I'm making a Flutter app that is like social media, so uses pictures a lot.我正在制作一个类似于社交媒体的 Flutter 应用程序,因此经常使用图片。 With that in mind, looking at the Firestore data, the reads with about 15 people look like this:考虑到这一点,查看 Firestore 数据,大约 15 人的读取数据如下所示:
But they are far outpaced by my storage bandwidth usage:但它们的速度远远超过我的存储带宽使用量:
I'm thinking about possible reasons why this is the case.我正在考虑出现这种情况的可能原因。 First, I am not sure if this could potentially be a problem, but I save each user's images into a respective folder:首先,我不确定这是否可能是一个问题,但我将每个用户的图像保存到相应的文件夹中:
Furthermore, looking through the images, I notice that file sizes average around a few hundred kilobytes, with a few being sized in megabytes, the largest I found is 9 MB.此外,通过查看图像,我注意到文件大小平均约为几百 KB,其中一些以兆字节为单位,我发现最大的是 9 MB。 Are these too large?这些是不是太大了?
Are there any other ideas I am missing?我还有其他想法吗? I am trying to implement caching on my front end to help with this problem, but I am open to any other possible reasons and solutions.我正在尝试在前端实现缓存以帮助解决此问题,但我对任何其他可能的原因和解决方案持开放态度。
Furthermore, looking through the images, I notice that file sizes average around a few hundred kilobytes.此外,通过查看图像,我注意到文件大小平均约为几百 KB。
If you take a look, at the major social media apps, the average size is around a few tens of kilobytes and not a few hundred kilobytes.如果您看一下,在主要的社交媒体应用程序中,平均大小约为几十千字节,而不是几百千字节。 If you look at Instagram for instance, all images are around 40-50 kilobytes.例如,如果您查看 Instagram,所有图像都在 40-50 KB 左右。
With a few being sized in megabytes, the largest I found is 9 MB.有一些以兆字节为单位,我发现最大的是 9 MB。 Are these too large?这些是不是太大了?
Way too large.太大了。
Are there any other ideas I am missing?我还有其他想法吗?
Yes, resize the images before uploading them to storage.是的,在将图像上传到存储之前调整它们的大小。
I am trying to implement caching on my front end to help with this problem, but I am open to any other possible reasons and solutions.我正在尝试在前端实现缓存以帮助解决此问题,但我对任何其他可能的原因和解决方案持开放态度。
For not reading an image from the server, each time the user uses your app, a caching mechanism will be helpful.对于不从服务器读取图像,每次用户使用您的应用程序时,缓存机制都会有所帮助。 However, it will not help the first time the user opens the app.但是,这对用户第一次打开应用程序没有帮助。 When indeed it is needed to be downloaded.当确实需要下载时。
Instead of having a single 9 MB image, it's better to have 180 images of 50 KB.与其拥有一个 9 MB 的图像,不如拥有 180 个 50 KB 的图像。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.