[英]Caching strategy for heavily used web-site
We're in process of designing caching strategy for a heavily used web-site. 我们正在为一个经常使用的网站设计缓存策略。 The site consists of a mix of dynamic and static content. 该站点包含动态和静态内容。 The front-end is PHP, middle tier is Tomcat and mysql on the back. 前端是PHP,中间层是Tomcat,后面是mysql。
Only user login screen is done over HTTPS to secure the credentials. 仅用户登录屏幕通过HTTPS完成,以保护凭据。 After that, all content is served over plain HTTP. 之后,所有内容都通过纯HTTP提供。 Some of the screens are specific to the customer (let's say his last orders), while other screens are common to everybody (most popular products, promotions, rules, etc). 一些屏幕是特定于客户的(例如,他的最后订单),而其他屏幕是每个人都通用的(最受欢迎的产品,促销,规则等)。
Given the expected traffic volume it's clear that we need a comprehensive caching strategy. 给定预期的流量,很明显,我们需要一个全面的缓存策略。 So we're considering following options: 因此,我们正在考虑以下选项:
It's possible that we will use a combination of those strategies. 我们可能会结合使用这些策略。
So the question is whether it's worthwhile to add front cache like Varnish, or just use Zend Cache inside? 所以问题是,是否值得添加像Varnish这样的前端缓存,还是仅在内部使用Zend Cache?
The other option that i forgot to mention is to use PHP-level cache like Zend Cache and store there fragments of the pages. 我忘了提到的另一个选项是使用Zend Cache之类的PHP级别的缓存并在那里存储页面的片段。 This is close to the second option that i mentioned but it's built into the Zend framework. 这接近于我提到的第二个选项,但它内置在Zend框架中。
So the question is whether it's worthwhile to add front cache like Varnish, or just use Zend Cache inside? 所以问题是,是否值得添加像Varnish这样的前端缓存,还是仅在内部使用Zend Cache?
Thanks again, Philopator. 再次感谢Philopator。
I've done quite a few projects like this and found that: 我已经完成了很多这样的项目,发现:
These days I like Varnish a lot: it's a separate layer that doesn't clutter the Java/PHP code, it's fast and very flexible. 如今,我非常喜欢Varnish:它是一个独立的层,不会使Java / PHP代码混乱,它既快速又非常灵活。 Downside is that the configuration in vcl is a bit too complex. 缺点是vcl中的配置太复杂了。
I typically use ehcache + in memory storage to avoid latency (eg database queries or service requests) with small data sets, and memcached when there's a lot of data and the cache needs to shared by multiple nodes. 我通常在内存存储中使用ehcache +来避免小数据集的延迟(例如,数据库查询或服务请求),并在有大量数据且需要由多个节点共享缓存的情况下使用memcached。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.