如何调整 Sitecore 预取缓存
使用 Sitecore 预取缓存的最佳方法是什么?给定一个带有本地 SQL Server、8GB RAM 和 2,000 个内容项的独立 Sitecore 服务器,假设批量加载项的效率更高,我是否应该预先预取大量网站内容?为了更清晰的场景,假设预取所有 2000 个项目将占用 2GB,如 /sitecore/admin/cache.aspx 报告的那样。
此外,配置的预取缓存大小相对于所需大小是否也会影响性能,即如果设置为大于 3 倍必要时,与设置为 1.1 倍所需大小相比,这是否会导致性能下降?
What is the best approach to using sitecore prefetch caches? Given a stand alone Sitecore server with local SQL Server, 8gb ram and 2,000 content items, should I aim to prefetch the bulk of website content up front on the assumption that it is more efficient to bulk load items? For the sake of a clearer scenario assume that prefetching all 2000 items would take up 2gb as reported by /sitecore/admin/cache.aspx
Also, does the configured prefetch cache size in relation to required size also affect performance i.e. if set 3x larger than necessary, does this result in a performance hit compared to being set at 1.1x required size?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
预取是一个灰色地带。如果您预取大量内容,则每个应用程序重新启动将花费更长的时间,因为它会填充预取。如果预取很少,应用程序重新启动会很快,但你从中获得的好处很少。你应该在它们之间找到平衡。
我建议您预取主页所需的任何内容,例如主页项目及其直接子项目(可能用于主导航)。此外,如果主页上使用了其他数据项,并且您知道它们始终在那里使用,您也可以预取它们。我将从基础知识开始,慢慢添加,看看它如何影响性能和应用程序重新启动。
至于预取的大小,它只是定义最大大小。因此,如果您将其设置为标准大小的 3 倍,这意味着您可能会在预取中获取最多 3 倍的数据,但并不保证一定会。但无论如何,预取越多,应用程序重新启动的速度就越慢。
我强烈建议您观看 Sitecore 缓存技术深入探讨 网络研讨会以了解预取。关于预取的内容只有几分钟,但它是一个非常好的视频。 它可在 SPN 上使用(而非 SDN)
The prefetch is a bit of a gray area. If you prefetch A LOT of content, each app restart will take longer, because its populating the prefetch. If you have very little in the prefetch, app restarts will be quick but then you're getting little advantage from it. You should find a balance between them.
I recommend you prefetch anything that you need for the home page, e.g. the home item and its immediate children (likely for a main nav). Also, if there are other data items that are used on the home page and you know they are always used there, you can prefetch them too. I would start with the basics and slowly add to it and see how it affects performance and app restarts.
As for the sizing of the prefetch, it just define the max size. So if you set it to 3x the standard size, that means you could potentially get up to 3x more of data in the prefetch, it doesn't guarantee you will. But the more in the prefetch, the slower app restarts, regardless.
I highly recommend you watch the Sitecore Caching Technical Deep Dive webinar to understand the prefetch. There's only a few minutes in it about prefetch but its a really good video. It's available on the SPN (not the SDN)
一些新信息已曝光最近关于预取缓存。 简而言之,永远不要将其设置得太小。它是 Sitecore 最重要的缓存。项目不仅在启动时添加到预取缓存中,相反,它们在整个应用程序生命周期中添加。
不要将预取行为与预取缓存本身混淆。在链接的博客文章中,我认为它应该被称为“项目引导”而不是预取,以免将其与同名的缓存混淆。预取一个项目确实会将其添加到预取缓存中,但仅此而已。使用 SQL 的任何其他操作也会影响预取缓存(读取项目、创建项目等......包括配置中未列出的那些)。
正如马克的回答所述 - 是的,预取您最有影响力的项目。但是,请根据应用程序统计信息调整预取缓存的大小。检查您的
\diagnostics\health_monitor\CacheStatus..html
文件,确保您没有超过最大大小,然后给自己一个缓冲区。Some new information has come to light recently regarding the prefetch cache. In short, don't ever size it too small. It's the most important cache of Sitecore. Items are not only added to the prefetch cache at startup, on the contrary, they are added throughout the application lifetime.
Do not confuse the act of prefetching with the prefetch cache itself. In the linked blog post I argue that it should have been termed "item bootstrapping" instead of prefetch to not confuse it with the cache of the same name. Prefetching an item DOES add it to the prefetch cache but that's it. Any other operation with SQL also affects the prefetch cache (read an item, create an item, etc... including those not listed in the config).
As Mark's answer states- yes, prefetch your most impactful items. However, SIZE your prefetch cache based on the application statistics. Review your
<data folder>\diagnostics\health_monitor\CacheStatus.<date>.html
files to ensure you aren't exceeding the maximum size and then give yourself a buffer.