9

【茶包射手雜記】Azure DevOps Server ElasticSearch 記憶體上限問題

 1 year ago
source link: https://blog.darkthread.net/blog/elasticsearch-max-memory/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

【茶包射手雜記】Azure DevOps Server ElasticSearch 記憶體上限問題-黑暗執行緒

幫忙看了一起 Azure DevOps Server 主機剩餘記憶體不足發出告警的案例。(註:Azure DevOps Server 就是 TFS Server 啦,TFS 從 2019 版改名叫 Azure DevOps Server,雖有 Azure 之名,但可安裝在地端)

重新認識幾件事:

  1. Azure DevOps Server/TFS 2018 的程式碼、Wiki 網頁及工作項目的搜尋功能是靠 ElasticSearch 完成的
  2. ElasticSearch 是個資料庫服務,跟全天下的資料庫一樣,策略上會積極佔用實體記憶體提升效能(也沒錯啦,RAM 買了都買了,拿來當 Cache 加速才不會浪費)
  3. Azure DevOps Server 安裝時預設會依主機記憶體多寡,設定 ElasticSearch 使用量

案例是台 16G RAM Azure DevOps Server,運作一段時間後出現可用記憶體低於 10% 告警,看了一下,elasticsearch-service-x64.exe 吃掉 5GB 是最大宗,加上 SQL、IIS 都是記憶體大戶,加上 OS 的檔案 Cache 等,導致記憶體剩餘量過低。註:作業系統 Cache 如 Mapped File、Metafile 等理應會在記憶體吃緊時逐步釋出 (參考:Windows記憶體都用到哪裡去了?),但警報一直響很困擾。

對照我手上的 VM,ElasticSearch 吃了 2.8GB,沒到 5G 那麼誇張。想了一下,應該是我 VM 一開始只配了 8G RAM,後來發現不夠才調到 16G,因此配給 ElasticSearch 的記憶體較少。

Fig1_638285175103327613.png

爬文查到可使用 C:\Program Files\Azure DevOps Server 2022\Search\ES\v7.17\bin\ealsticsearch-service.bat manager 叫出管理 UI 查看及修改設定,如下圖,我的 VM Initial memory pool 及 Maximum memory pool 都是 2400 MB;而案例中的主機是 4800,剛好兩倍,推測與安裝時主機 RAM 大小成正比。

Fig2_638285175107170451.png

基於不想常收到告警跟 Azure DevOps Server 使用者不多、搜索需求不大,將案例主機的設定也調至 2400 解決問題。結案。

補充:由於 ElasticSearch 記憶體用量上限不會自動調整,因效能不足加 RAM 後記得調設定。

【參考資料】

and has 0 comments

Comments

Be the first to post a comment

Post a comment

Comment
Name Captcha 87 - 67 =

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK