ํผ๋๋ก ๋์๊ฐ๊ธฐ
Dev.toDevOps
์๋ฌธ ์ฝ๊ธฐ
CPU ๊ฒฝ๊ณ ์ ํจ์ , ๋ฉ๋ชจ๋ฆฌ ์๋ฐ๊ณผ ์ค๋ ๋ถ๊ท ํ ํด๊ฒฐ ๊ธฐ๋ก
๐จ Elasticsearch High CPU Issue Due to Memory Pressure โ Real Production Incident & Fix
AI ์์ฝ
Context
Elasticsearch ํด๋ฌ์คํฐ์์ High CPU ์๋ ๋ฐ์. ์ค์ CPU ์ฌ์ฉ๋ฅ ์ ๋ฎ์ผ๋ ํด๋ฌ์คํฐ ์ํ๊ฐ Yellow๋ก ์ ํ๋ ์ํฉ. ๋ฉ๋ชจ๋ฆฌ ์๋ฐ๊ณผ ์ค๋ ๋ถ๊ท ํ์ด ๊ฒฐํฉ๋ ๋ณตํฉ์ ์ฅ์ ๊ตฌ์กฐ.
Technical Solution
_cluster/healthAPI๋ฅผ ํตํ 193๊ฐ์ unassigned shards ์๋ณ_cat/nodes๋ถ์์ผ๋ก CPU ์ ๋ถํ ์ํ์ ๋๋น๋๋ RAM ์ฌ์ฉ๋ฅ 88~97%์ ๋ฉ๋ชจ๋ฆฌ ์๋ฐ ํ์ธ- OS ๋ ๋ฒจ
top๋ช ๋ น์ด๋ก Java ํ๋ก์ธ์ค์ ์์คํ ๋ฉ๋ชจ๋ฆฌ ์ ์ ์จ 65% ํ์ธ - JVM stats ๋ถ์์ ํตํ Old-gen ์์ญ์ ๋์ ์ฌ์ฉ๋ ๋ฐ ๋น๋ฒํ Garbage Collection ์ฌ์ดํด ํฌ์ฐฉ
- Disk watermark ์๊ณ์น ์ด๊ณผ๋ก ์ธํ ์ค๋ ํ ๋น ์คํจ ๋ฐ NODE_LEFT ์ํ์ ๋ ธ๋ ๋ถ์
- ๋์คํฌ ๊ณต๊ฐ ํ๋ณด ๋ฐ ์ค๋ ์ฌ๋ฐฐ์น๋ฅผ ํตํ ์๋ ํ ๋น ํ๋ก์ธ์ค ํ์ฑํ
Impact
- unassigned shards: 193๊ฐ $\rightarrow$ 0๊ฐ
- Cluster status: Yellow $\rightarrow$ Green
- active_shards_percent_as_number: 63.99% $\rightarrow$ 100.0%
Key Takeaway
Elasticsearch์์ ๋์คํฌ ๊ณต๊ฐ์ ๋จ์ ์ ์ฅ ์ฉ๋์ ๋์ด ์ค๋ ํ ๋น๊ณผ JVM ๋ฉ๋ชจ๋ฆฌ ํจ์จ์ ์ง์ ์ ์ธ ์ํฅ์ ๋ฏธ์น๋ ํต์ฌ ์์ ์ฑ ์งํ์.
์ค์ฒ ํฌ์ธํธ
CPU ๋ฉํธ๋ฆญ๋ง ์ ๋ขฐํ์ง ๋ง๊ณ Disk watermark, unassigned shards, JVM Heap ์ํ๋ฅผ ํตํฉ ๋ชจ๋ํฐ๋งํ ๊ฒ