-
2024.04.06 spring kafka transaction isolation level, L4L7TIL 2024. 4. 6. 17:09
spring kafka를 사용 중이다.
다른 서비스가 transaction producer를 사용해서 우리의 서비스도 isolation level을 read commited로 변경했다.
커밋된 메시지만 읽기 위해서이다.
우리 팀이 관리하는 서비스가 2개인데 2개의 서비스가 각자 spring kafka version이 다르다.
default isolation level이 read uncommited로 알고 있는데 특정 서비스가 원하는데로 동작하지 않는다.
default isolcation levlel이 version마다 다른가?
-> 다르지 않은데 프로젝트 내부에 properties가 2개로 관리되고 있었고 그 중 하나가 read_commited였다.
transaction이 commit되지 않아서 read_commited인 consumer는 lag이 증가하게 된다.
lag은 kafka consumer가 얼마나 정상적으로 동작하는 지를 보는 지표로 활용되는데 tx때문에 lag이 증가하는 것은 혼란을 가져온다.
spring kafka에는 이를 커버하는 설정 값이 있다.
fixTxOffsetsIfNeeded이라는 함수로 commit을 유도하는데 metadata로 fix해야하는지 offset인지를 파악하는 것 같다.
https://docs.spring.io/spring-kafka/reference/kafka/container-props.html#fixTxOffsets
Listener Container Properties :: Spring Kafka
When consuming records produced by a transactional producer, and the consumer is positioned at the end of a partition, the lag can incorrectly be reported as greater than zero, due to the pseudo record used to indicate transaction commit/rollback and, poss
docs.spring.io
L4 로드밸런서와 L7로드밸런서는 무엇을 보고 로드밸런싱을 할 거냐로 구분할 수 있다.
L4는 4계층의 Ip와 port를 본다면 L7는 7계층의 http 헤더를 보고 로드밸런싱을 할 수 있는 것이다.
더 세세하게 이미지는 이쪽으로 동영상은 저쪽으로 할 수 있다는 것이다.
'TIL' 카테고리의 다른 글
2024.04.22 (0) 2024.04.22 2024.04.16 Multitenancy환경에서의 auth gateway (0) 2024.04.17 2024.03.31 MMM galera cluster (0) 2024.03.31 2024.02.25 AuthorizationManager (0) 2024.02.25 2024.02.23 DLT logging custom (0) 2024.02.23