我有以下情况:
每周大约5次(与缓存清除,流量高峰等任何特定情况无关),某些查询停留在发送数据(show processlist
)上:
> SELECT `main_table`.`entity_id`, `main_table`.`level`, `main_table`.`path`, `main_table`.`position`,
> `main_table`.`is_active`, `main_table`.`is_anchor`,
> `main_table`.`name`, `url_rewrite`.`request_path` FROM
> `catalog_category_flat_store_30` AS `main_table`
> LEFT JOIN `core_url_rewrite` AS `url_rewrite` ON url_rewrite.category_id=main_table.entity_id AND
> url_rewrite.is_system=1 AND url_rewrite.product_id IS NULL AND
> url_rewrite.store_id='30' AND url_rewrite.id_path LIKE 'category/%'
> WHERE (path LIKE '1/2/%') AND (main_table.store_id = '30') AND
> (is_active = '1') AND (include_in_menu = '1') ORDER BY name ASC
第二个:
> SELECT `main_table`.`entity_id`, main_table.`name`, main_table.`path`,
> `main_table`.`is_active`, `main_table`.`is_anchor`,
> `main_table`.`manually`, `url_rewrite`.`request_path` FROM
> `catalog_category_flat_store_10` AS `main_table` LEFT JOIN
> `core_url_rewrite` AS `url_rewrite` ON
> url_rewrite.category_id=main_table.entity_id AND
> url_rewrite.is_system=1 AND url_rewrite.product_id IS NULL AND
> url_rewrite.store_id='10' AND url_rewrite.id_path LIKE 'category/%'
> WHERE (main_table.is_active = '1') AND (main_table.include_in_menu =
> '1') AND (main_table.path like '1/2/1528/1569/%') AND (`level` <= 4)
> ORDER BY `main_table`.`position` ASC
这些查询与生成导航菜单有关。它们运行时没有任何问题,而且一直非常快。
一个月很少有几次其他查询卡在seding数据或等待表锁定上:
INSERT INTO `catalogsearch_result` SELECT 316598 AS `query_id`, `s`.`product_id`, MATCH (s.data_index) AGAINST ('STRING HERE' IN BOOLEAN MODE) AS `relevance` FROM `catalogsearch_fulltext` AS `s`
INNER JOIN `catalog_product_entity` AS `e` ON e.entity_id = s.product_id WHERE (s.store_id = 38) AND (MATCH (s.data_index) AGAINST ('STRING HERE' IN BOOLEAN MODE)) ON DUPLICATE KEY UPDATE `relevance` = VALUES(`relevance`)
(与搜索相关)
附加信息:
- core_url_rewrite-3M条记录(30个网站,10万个产品)
- catalog_category_flat_store_ *-2000条记录(启用了使用平面类别)
这是在一些大型硬件上使用vmware的安装程序上运行的(mysql主站分配了8个核心,并在SAN存储上分配了64Gb的RAM和SSD磁盘),对mysql进行了优化和连续监控。过去存在一些与I / O相关的问题(服务器和SAN存储之间的链接存在一些问题)。
我们无法确定问题的原因,因为在高压力条件下(运行攻城+负载测试方案,没有缓存),在裸机上运行(无虚拟化,配置相同)永远不会发生。
还有其他人遇到类似的问题吗?
更新:
reindexAll搜索已移动到临时表(因此它不会锁定生产使用的主表,然后重命名tmp表)。因此,重新索引过程不会干扰访问者搜索网站。 https://github.com/magendooro/magento-fulltext-reindex对carco表示感谢