[Grafana Tempo] ์บ์ฑ ์ค์ (with Memcached)
Tempo๋ ์์ฒด์ ์ผ๋ก TraceQL ๋ฑ์ ์ด์ฉํ ์ฟผ๋ฆฌ ๊ธฐ๋ฅ์ ์ ๊ณตํ์ง๋ง, ์ฝ๊ธฐ ์ฑ๋ฅ ๋ถ๋ถ์์๋ ์์ฌ์ด ๋ถ๋ถ์ด ์์ ์ ์๋ค.
Tempo๋ ์ฟผ๋ฆฌ ์ฑ๋ฅ ํฅ์์ ์ํด์ ์ธ๋ฑ์ค ์ก๊ณ ๊ทธ๋ฐ๊ฑด ์๊ณ , ๊ทธ๋ฅ ์บ์ฑ์ ๊ตฌ์ฑํ๋ ๊ฒ์ ๊ถ์ฅํ๋ค.
์บ์ฑ ๋ฐฑ์๋๋ก๋ Redis, Memcached๊ฐ ์ง์๋๋ค.
์บ์๋ ๋ชจ๋ ๋ฐ์ดํฐ๋ฅผ ์ ์ฅํ๋ค๊ฑฐ๋ ํ๋๊ฑด ์๋๊ณ , ์ฟผ๋ฆฌ์์ ์กฐํ๋ ๋ธ๋ก์ ๋ธ๋ฃธ ํํฐ๋ฅผ ์ ์ฅํ๋ ํ์์ด๋ค.
Docker compose ๊ธฐ์ค์ผ๋ก ๋ค๋ฃฌ๋ค.
memcached:
image: memcached:1.6.29
ports:
- "11211:11211"
environment:
- MEMCACHED_MAX_MEMORY=64m # Set the maximum memory usage
- MEMCACHED_THREADS=1 # Number of threads to use
restart: always
์ด๋ฐ ์์ผ๋ก memcached DB๊ฐ ์๋ค๊ณ ํ๋ฉด
tempo config yaml์์ ์ด๋ฐ ์์ผ๋ก ๊ตฌ์ฑํ๋ฉด ๋๋ค.
cache:
background:
writeback_goroutines: 5
caches:
- roles:
- frontend-search
memcached:
addresses: dns+memcached:11211
์ฌ๊ธฐ์ docker ์์ฒด dns๋ก ๋ด๋ถ ํต์ ์ ํ๋๋ก ํ๋๋ฐ, ๋ค๋ฅธ ์์ญ์ ์๋ค๋ฉด ์ฃผ์๋ฅผ ์ฐ๊ฑฐ๋ ๋๋ฉ์ธ์ ๋ฃ๊ฑฐ๋ ํ๋ฉด ๋๋ค.
์ฐธ์กฐ
https://grafana.com/docs/tempo/latest/configuration/#cache
https://grafana.com/docs/tempo/latest/operations/caching/
https://grafana.com/docs/tempo/latest/operations/backend_search/