如何保存并重新加载 MySQL 查询缓存以保持站点以峰值速度运行

发布于 2024-10-19 06:07:50 字数 388 浏览 5 评论 0原文

我正在测试服务器上运行 Magento 电子商务安装(在 PHP/MySQL 上运行)。我有一个相当大的(根据我读到的)query_cache_size 272,629,760 字节,它工作得很好。

一旦大多数查询加载到查询缓存中,该站点就会以闪电般的速度运行,与最快的生产站点(可能除了 Google.com 或 Amazon.com)一样快。但我遇到的问题是,为了将所有这些查询加载到查询缓存中,我必须手动单击网站上的 100 个链接。每次单击链接时,都会将查询发送到数据库并保存在缓存中。但如果我重新启动服务器,那么我必须重新做一遍。一定有更好的办法!

理想情况下,我认为应该有一种方法可以在重新启动之前“备份”查询缓存并在重新启动时加载它。这可能吗?

否则,我只需要设计一个网络爬虫来自动点击我的所有链接。

I am running a Magento e-commerce installation (which runs on PHP/MySQL) on a testing server. I have a fairly large (from what I've read) query_cache_size of 272,629,760 bytes and it works great.

The site runs lightning fast once most of the queries are loaded into the query cache, as fast as the fastest production sites (other than perhaps Google.com or Amazon.com). But the problem I have is that in order to load all of those queries into the query cache I have to manually click through 100's of links on the site. Every time you click a link, a query is sent to the database and saved in the cache. But if I restart the server, then I have to do that all over again. There must be a better way!

Ideally, I think there should just be a way to "backup" the query cache before restart and load it upon restart. Is this possible?

Otherwise, i'm just going to have to design a web crawler that automatically clicks all my links.

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

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

发布评论

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

评论(2

晨光如昨 2024-10-26 06:07:50

除了 MySQL 的查询缓存之外,您还应该使用 APC(替代 PHP 缓存),以及可能的 Magento 的一些内置全页缓存机制。

这可以减少 MySQL 之间的往返次数,从而减少对已准备好的 MySQL 缓存的需求。您可以手动“启动”Magento 数据库的缓存,但这隐藏了真正的问题,那就是完全避免使用 MySQL - 尤其是在 Magento 中。

无论如何,您是我遇到的第一个将 Magento 的速度与 Google 和 Yahoo 的速度进行比较的人。 :)

Aside from MySQL's query cache, you should be using APC (Alternative PHP Cache) as well, and possibly some of Magento's built-in full-page caching mechanisms.

This could mitigate some of your round-trips to MySQL and back, lessening your need for a primed MySQL cache. You can 'prime' the cache of your Magento DB manually, but that's hiding the real issue here, and that's to avoid going to MySQL at all - especially within Magento.

And for what it's worth - you're the first person I've ever come across that compared Magento's speed with that of Google and Yahoo. :)

恰似旧人归 2024-10-26 06:07:50

这个问题可能更适合服务器故障,但很有趣,所以这里:)

Magento 主要使用 InnoDB 表,所以在阅读时考虑到这一点 这个这个

我还会根据 @philwinkle 的建议推荐 APC,这对我的性能产生了巨大的影响。与使用 CDN 减轻服务小文件 (img/js/css) 的负载相同

This question may be better suited to serverfault, but it's interesting, so here goes :)

Magento mostly uses InnoDB tables, so take that into consideration as you read this and this

I would also recommend APC per @philwinkle's suggestion, that's made a huge difference to the performance for me. Ditto to using a CDN to take off the load of serving small files (img/js/css)

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