발생 에러
Clickhouse JSONExtractString 쿼리 실행에 CANNOT_ALLOCATE_MEMORY 에러가 발생하는 오류 가 있었다.
Error> TCPHandler: Code: 173. DB::Exception: Couldn't allocate 1898 bytes when parsing JSON: while executing 'FUNCTION JSONExtractString(labels :: 0, 'host_name' :: 1) -> JSONExtractString(labels, 'host_name') String : 2'. (CANNOT_ALLOCATE_MEMORY), Stack trace (when copying this message, always include the lines below):
Error> TCPHandler: Code: 173. DB::Exception: Couldn't allocate 1898 bytes when parsing JSON: while executing 'FUNCTION JSONExtractString(labels :: 0, 'host_name' :: 1) -> JSONExtractString(labels, 'host_name') String : 2'. (CANNOT_ALLOCATE_MEMORY), Stack trace (when copying this message, always include the lines below):
발생 원인
OS 자체를 가상화 시키는 하이퍼바이저 사용 시(ec2, openstack 등) 충돌이 있음.
특히 QEMU 일 때 문제가 있다고 하는데, 처음에는 확인해보고, KVM인데? 라고 생각했지만
오픈스택에서 확인하니 QEMU 였다..
# lscpu
…
Model name: Common KVM processor
해결
스택오버플로우에서 동일한 문제가 있어서 해결할 수 있었다.
https://github.com/ClickHouse/ClickHouse/issues/60661
clickhouse-users.xml에 profile 부분에 allow_simdjson 을 비활성화 하는 설정을 추가했다.
<profiles>
<default>
...
<allow_simdjson>0</allow_simdjson>
...
</default>
...
</profiles>
allow_simdjson
allow_simdjson 은 JSON 파싱 성능을 개선하는 라이브러리인데, 이 부분이 가상 하이퍼바이저 host 사용과 충돌하는 부분이 있는 것으로 추측된다.
테스트 쿼리
단순 JSON 쿼리 구문 문제인지, 확실히 설정 문제인지 확인을 위한 쿼리
SELECT JSONExtractKeysAndValuesRaw('{"a": "hello", "b": [-100, 200.0, 300]}')[1].1 = 'a' res
┌─res─┐
│ 1 │
└─────┘
GPT 검색 내용:
설정의 의미 :
- <allow_simdjson>1</allow_simdjson>: SIMD JSON 파서를 활성화합니다. 이는 성능을 개선할 수 있지만, 특정 환경이나 JSON 형식에서 문제가 발생할 수도 있습니다.
- <allow_simdjson>0</allow_simdjson>: SIMD JSON 파서를 비활성화하고, 기본 JSON 파서를 사용합니다. 성능은 다소 낮을 수 있지만, 호환성 문제를 줄일 수 있습니다.
<allow_simdjson> 설정은 ClickHouse에서 SIMD (Single Instruction, Multiple Data) JSON 파서를 사용할지 여부를 결정하는 설정입니다. 이 설정을 통해 SIMD JSON 파서를 활성화하거나 비활성화할 수 있습니다. SIMD JSON 파서는 성능을 개선하기 위해 SIMD 명령을 사용하여 JSON 데이터를 파싱하는 고성능 라이브러리입니다
참고한 글 :
https://github.com/ClickHouse/ClickHouse/issues/60661
SIMDJSON and QEMU - does not work in newer ClickHouse versions (low priority) · Issue #60661 · ClickHouse/ClickHouse
There are a few machines with QEMU-virtual 2.5+. After upgrading ClickHouse, the following error started to appear: https://pastila.nl/?00862072/e302a4bf914007f737f1564a659ccf4c#Sd5QBcg5zbPOvy+VyPD...
github.com
'Monitoring > Signoz' 카테고리의 다른 글
Signoz Cloud 버전을 Helm chart to Yaml로 설치 (1) (2) | 2025.02.07 |
---|---|
오픈 소스 APM도구 SIGNOZ (2) (6) | 2025.02.05 |
오픈 소스 APM도구 SIGNOZ (1) (0) | 2025.02.05 |
Signoz 모니터링에 앞서, 사용한 로그 형식 (0) | 2025.02.03 |