Redmine
redmine 糟糕的寫入性能(更新不是真正的多執行緒)
(已經自我回答)我正在與大約 100 個使用者的 redmine 性能不佳作鬥爭。為了測試它,我設置了一個簡單的場景來更新五個不同範例問題的“完成百分比”。所有更新都在同一秒開始,使用
curl
. 令我驚訝的是,redmine 中的更新似乎是序列化的(我的意思是不是多執行緒的),時序如下:real 0m1.122s real 0m1.404s real 0m2.258s real 0m2.782s real 0m3.151s real 0m3.336s
或者另一種嘗試,當其他會話的一些處理也受到阻礙時:
real 0m7.492s real 0m7.803s real 0m8.045s real 0m8.246s real 0m8.597s real 0m8.825s
production.log
在處理大量 SQL 查詢後的關鍵時刻是 COMMIT 階段。請注意 COMMIT 是如何在毫秒內完成的,但在 COMMIT 之間發生了一些神秘的事情,不僅將它們序列化,而且需要幾秒鐘才能達到 Completed 狀態。此日誌摘錄完好無損 - 我沒有刪除中間的任何行。(0.6ms) SELECT COUNT(*) FROM `custom_workflows` WHERE `custom_workflows`.`active` = 1 AND `custom_workflows`.`observable` = 'issue' AND (is_for_all OR EXISTS (SELECT * FROM custom_workflows_projects WHERE project_id=123 AND custom_workflow_id=id)) (30.1ms) COMMIT Redirected to http://redmine.mydomain.local/issues/11973 Completed 302 Found in 7418.4ms (ActiveRecord: 135.8ms) (0.6ms) SELECT COUNT(*) FROM `custom_workflows` WHERE `custom_workflows`.`active` = 1 AND `custom_workflows`.`observable` = 'issue' AND (is_for_all OR EXISTS (SELECT * FROM custom_workflows_projects WHERE project_id=123 AND custom_workflow_id=id)) (24.8ms) COMMIT Redirected to http://redmine.mydomain.local/issues/9240 Completed 302 Found in 7738.3ms (ActiveRecord: 57.4ms) (0.4ms) SELECT COUNT(*) FROM `custom_workflows` WHERE `custom_workflows`.`active` = 1 AND `custom_workflows`.`observable` = 'issue' AND (is_for_all OR EXISTS (SELECT * FROM custom_workflows_projects WHERE project_id=123 AND custom_workflow_id=id)) (25.9ms) COMMIT Redirected to http://redmine.mydomain.local/issues/9614 Completed 302 Found in 7949.0ms (ActiveRecord: 135.7ms) (0.5ms) SELECT COUNT(*) FROM `custom_workflows` WHERE `custom_workflows`.`active` = 1 AND `custom_workflows`.`observable` = 'issue' AND (is_for_all OR EXISTS (SELECT * FROM custom_workflows_projects WHERE project_id=123 AND custom_workflow_id=id)) (24.6ms) COMMIT Redirected to http://redmine.mydomain.local/issues/12016 Completed 302 Found in 8058.5ms (ActiveRecord: 102.5ms) (0.5ms) SELECT COUNT(*) FROM `custom_workflows` WHERE `custom_workflows`.`active` = 1 AND `custom_workflows`.`observable` = 'issue' AND (is_for_all OR EXISTS (SELECT * FROM custom_workflows_projects WHERE project_id=123 AND custom_workflow_id=id)) (21.2ms) COMMIT Redirected to http://redmine.mydomain.local/issues/8853 Completed 302 Found in 8472.5ms (ActiveRecord: 90.4ms) (0.5ms) SELECT COUNT(*) FROM `custom_workflows` WHERE `custom_workflows`.`active` = 1 AND `custom_workflows`.`observable` = 'issue' AND (is_for_all OR EXISTS (SELECT * FROM custom_workflows_projects WHERE project_id=123 AND custom_workflow_id=id)) (27.9ms) COMMIT Redirected to http://redmine.mydomain.local/issues/10007 Completed 302 Found in 8700.4ms (ActiveRecord: 137.4ms)
我已經檢查過的內容:
- 乘客狀態的執行緒數綽綽有餘
- apache2 httpd 的程序數綽綽有餘
- mysql 5.1 使用 innodb
- innotop 不顯示鎖
- innotop 不會過多的 I/O
- iostat 沒有顯示過多的 I/O(大約 10-15 IOPS,磁碟最大 17% 的時間使用)
- top 沒有顯示過多的 CPU 使用率(最多可能 400% 的 70%)。
好的,這是 SMTP 序列化的東西;預設情況下它以某種方式未記錄。
我改變了
/var/www/html/redmine/config/configuration.yml
:email_delivery: # delivery_method: :smtp # slows down everything! delivery_method: :async_smtp