将数据迁移到 Sitecore CMS 时的优化技巧

发布于 2024-10-24 12:31:40 字数 991 浏览 2 评论 0原文

我目前面临着将大约 20 万个项目从自定义 CMS 实施导入 Sitecore 的任务。我创建了一个简单的导入页面,它使用实体框架连接到外部 SQL 数据库,并且创建了所有必需的数据模板。

在大约 5K 项目的测试导入过程中,我意识到我需要找到一种方法来使导入运行得更快,因此我开始寻找一些有关为此目的优化 Sitecore 的信息。我得出的结论是,没有太多具体信息,因此我想分享我所发现的内容,并为其他人提供进一步优化的机会。我的目标是为 Sitecore 创建某种可在导入大量数据时使用的维护模式。

我发现的最有用的信息是 Mark Cassidy 的博客文章 http:// intothecore.cassidy.dk/2009/04/migration-data-into-sitecore.html。在这篇文章的底部,他提供了一些运行导入时的提示。

  • 如果迁移大量数据,请尝试禁用尽可能多的 Sitecore 事件处理程序以及其他任何您可以逃脱的方法。
  • 使用 BulkUpdateContext()
  • 不要忘记您的目标语言
  • 如果可以的话,使字段共享且未版本化。这应该有助于提高迁移执行速度。

我从这个列表中注意到的第一件事是 BulkUpdateContext 类,因为我从未听说过它。我很快就明白了为什么在 SND 论坛和 PDF 文档中搜索没有返回结果。因此,想象一下当我实际测试它并发现它将项目创建/删除改进至少十倍时我的惊讶!

我接下来看的是第一点,他基本上建议创建一个仅包含执行导入所需的基本要素的 Web 配置版本。到目前为止,我已经删除了与创建、保存和删除项目和版本相关的所有事件。我还从 Web 配置中的主数据库元素以及任何自定义事件、计划和搜索配置中删除了历史引擎和系统索引声明。我希望我可以删除/禁用许多其他内容以提高性能。管道?时间表?

您有哪些优化技巧?

I am currently faced with the task of importing around 200K items from a custom CMS implementation into Sitecore. I have created a simple import page which connects to an external SQL database using Entity Framework and I have created all the required data templates.

During a test import of about 5K items I realized that I needed to find a way to make the import run a lot faster so I set about to find some information about optimizing Sitecore for this purpose. I have concluded that there is not much specific information out there so I'd like to share what I've found and open the floor for others to contribute further optimizations. My aim is to create some kind of maintenance mode for Sitecore that can be used when importing large columes of data.

The most useful information I found was on Mark Cassidy's blogpost http://intothecore.cassidy.dk/2009/04/migrating-data-into-sitecore.html. At the bottom of this post he provides a few tips for when you are running an import.

  • If migrating large quantities of data, try and disable as many Sitecore event handlers and whatever else you can get away with.
  • Use BulkUpdateContext()
  • Don't forget your target language
  • If you can, make the fields shared and unversioned. This should help migration execution speed.

The first thing I noticed out of this list was the BulkUpdateContext class as I had never heard of it. I quickly understood why as a search on the SND forum and in the PDF documentation returned no hits. So imagine my surprise when i actually tested it out and found that it improves item creation/deletes by at least ten fold!

The next thing I looked at was the first point where he basically suggests creating a version of web config that only has the bare essentials needed to perform the import. So far I have removed all events related to creating, saving and deleting items and versions. I have also removed the history engine and system index declarations from the master database element in web config as well as any custom events, schedules and search configurations. I expect that there are a lot of other things I could look to remove/disable in order to increase performance. Pipelines? Schedules?

What optimization tips do you have?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

顺便说一句,BulkUpdateContext() 是一个非常具有误导性的名称 - 因为它确实提高了项目创建速度,而不是项目更新速度。但正如您也指出的那样,它极大地提高了您的导入速度:-)

自从我写那篇文章以来,我在进行导入时在正常例程中添加了一些新内容。

  • 定期缩小数据库。它们往往会变得又大又笨重。为了做到这一点;首先进入Sitecore控制面板->数据库并选择“清理数据库”。此后,在 SQL 服务器上定期执行 ShrinkDB
  • 禁用索引,尤其如果导入到“master”数据库中。有关参考,请参阅 http://intothecore.cassidy.dk/2010/09 /disabling-lucene-indexes.html
  • 但是,尝试不要导入到“master”中。您通常会发现导入到“web”中要快得多,主要是因为该数据库未(默认情况下)连接 如果您真的喜欢冒险

,您可以尝试一下我一直在考虑亲自尝试但从未抽出时间的事情。它们可能会起作用,但我不能保证它们会:-)

  • 尝试从 App_Config/FieldTypes.config 中删除所有字段类型。这里的理论是,这实际上应该禁用 Sitecore 对这些字段内容的所有特殊处理(例如更新 LinkDatabase 等)。完成导入后,您需要手动触发 LinkDatabase 的重建,但这是一个相对较小的代价

希望这会有所帮助:-)

Incidentally, BulkUpdateContext() is a very misleading name - as it really improves item creation speed, not item updating speed. But as you also point out, it improves your import speed massively :-)

Since I wrote that post, I've added a few new things to my normal routines when doing imports.

  • Regularly shrink your databases. They tend to grow large and bulky. To do this; first go to Sitecore Control Panel -> Database and select "Clean Up Database". After this, do a regular ShrinkDB on your SQL server
  • Disable indexes, especially if importing into the "master" database. For reference, see http://intothecore.cassidy.dk/2010/09/disabling-lucene-indexes.html
  • Try not to import into "master" however.. you will usually find that imports into "web" is a lot faster, mostly because this database isn't (by default) connected to the HistoryManager or other gadgets

And if you're really adventureous, there's a thing you could try that I'd been considering trying out myself, but never got around to. They might work, but I can't guarantee that they will :-)

  • Try removing all your field types from App_Config/FieldTypes.config. The theory here is, that this should essentially disable all of Sitecore's special handling of the content of these fields (like updating the LinkDatabase and so on). You would need to manually trigger a rebuild of the LinkDatabase when done with the import, but that's a relatively small price to pay

Hope this helps a bit :-)

粉红×色少女 2024-10-31 12:31:40

我猜您已经遇到过这个问题,但是将代码放入 SecurityDisabler() 块中也可能会加快速度。

我更担心 Sitecore 如何处理这么多数据……假设您只导入一次,谁在乎这个过程需要多长时间。这会经常发生吗?

I'm guessing you've already hit this, but putting the code inside a SecurityDisabler() block may speed things up also.

I'd be a lot more worried about how Sitecore performs with this much data... assuming you only do the import once, who cares how long that process takes. Is this going to be a regular occurrence?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文