用于缓存图像文件的Redis? [英] Redis for caching image files?

查看:27
本文介绍了用于缓存图像文件的Redis?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 Amazon S3 为图像存储网站存储和检索图像.问题是多个用户必须多次检索相同的图像.

I am using Amazon S3 for storing and retrieving images for an image storing website. The trouble is that multiple users have to retrieve same image multiple times.

是否建议使用 Redis 或 memcached 将图像文件直接存储到缓存中.

Is it suggested to use Redis or memcached for caching image files by storing them directly onto it.

与通过 Redis 缓存提供图像相比,Amazon S3 的数据传输定价要高得多.但是将图像文件直接存储在 Redis 上似乎是一个糟糕的提议,因为我在某处读到 Redis 不适合操作大型数据文件.另外我不明白,如果 Redis 将数据存储在内存中,它将如何存储这么多图像(除非我做了很多很多实例).

Amazon S3 pricing for data transfer is much higher than compared to serving images via Redis cache. But storing image files directly on Redis seems to be a bad proposition because I read somewhere that Redis is not good for operating on large data files. Also I don't understand that if Redis stores data on memory how will it store so many images(unless I make many many instances).

是否建议将图像文件直接存储到 Redis 或是否有其他方法可以缓存这些图像?

Is it advisable to store image files directly onto Redis or is there an alternate for caching these images?

pinterest 和 imgur 直接使用 Redis 和 memcache 存储图片吗?如果不是为什么他们有这么多实例?兴趣

Do pinterest and imgur use Redis and memcache for storing images directly? If not why do they have so many instances?Pinterest

推荐答案

您的创造力得到了赞誉,但您还没有在这里找到漏洞.

You get credit for creativity, but you have not found a loophole, here.

首先,尝试从 elasticache 提供图像是完全不合适的.这是一个缓存.根据定义,它是易变的.

First, it's entirely inappropriate to try to serve images from elasticache. It's a cache. It's volatile by definition.

其次,它不是网络服务器.

Second, it's not a web server.

第三,它不打算暴露在互联网上.

Third, it's not intended to be exposed to the Internet.

但即使这些没有说服力,您的问题似乎也是基于对多个层面的定价结构的误解.

But even if these aren't persuasive, your question seems premised on a misunderstanding of the pricing structure on several levels.

对进出 Amazon ElastiCache 节点本身的流量不收取 Amazon ElastiCache 数据传输费用.

There is no Amazon ElastiCache Data Transfer charge for traffic in or out of the Amazon ElastiCache Node itself.

https://aws.amazon.com/elasticache/pricing/

从技术上讲,这是准确的,但没有帮助.

Technically, this is accurate, but it is not helpful.

这仅与从 elasticache 传输到您的 EC2 实例相关.您仍然需要通过 Internet 将数据返回到浏览器,并且无论您是从/通过 EC2 还是从 S3 返回数据,其成本都是相同的.

This is only relevant to the transfer from elasticache to your EC2 instance. You still have to return the data to the browser, across the Internet, and this costs the same, whether you return it from/through EC2, or from S3.

数据从 Amazon EC2 传出到 Internet

每月最多 10 TB,每 GB 0.09 美元

Up to 10 TB / month $0.09 per GB

https://aws.amazon.com/ec2/pricing/

...或...

从 Amazon S3 到 Internet 的数据传出

每月最多 10 TB,每 GB 0.090 美元

Up to 10 TB / month $0.090 per GB

https://aws.amazon.com/ec2/pricing/

与此同时,CloudFront 为 0.085 美元/GB,用于发送到访问边缘站点的浏览器的流量在最低价格等级,美国和欧洲.当您选择全球价格等级以外的价格等级时,您可以控制哪些边缘位置可用:

Meanwhile, CloudFront is $0.085/GB for traffic sent to browsers that are accessing edge locations in the lowest price class, US and Europe. And you control which edge locations are available when you select a price class other than the global one:

如果您选择的价格等级不包括所有边缘站点……您需要支付所选价格等级中最便宜的区域的费率.

If you choose a price class that does not include all edge locations ... you're charged the rate for the least expensive region in your selected price class.

http://docs.aws.amazon.com/AmazonCloudFront/最新/DeveloperGuide/PriceClass.html

如果配置正确,则为 0.085 美元.

That's $0.085 if configured correctly.

从 S3 转移到 CloudFront 或从 EC2 转移到 CloudFront 是免费的.仅从 CloudFront 到 Internet 的费用.

There is no charge for transfer from S3 to CloudFront or from EC2 to CloudFront. Only the charge from CloudFront to the Internet.

这篇关于用于缓存图像文件的Redis?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆