본문 바로가기
반응형

전체 글52

Spring EventListener EventListener 정의 Event 객체를 spring 에서 제공해주는 publiser Bean의 1개의 Api를 호출할 경우 등록된 Event객체를 사용하는 listener의 비즈니스 로직을 모두 호출 하는 기능 비동기 처리 및 결합도가 높은 독립된 비즈니스 로직을 때어낼때 사용합니다 구성 Bean 객체를 관리하는 ApplicationContext는 ApplicatioinEventPubliser interface를 상속 받습니다 public abstract class AbstractApplicationContext extends DefaultResourceLoader implements ConfigurableApplicationContext { protected void publishEvent(O.. 2022. 5. 28.
Atomic Query 작성 Atomic Query 정의 isolation에서 serializable을 사용해 where 절 조건과 index 자체에 lock을 걸지 않는 이상 write누락 이슈가 발생합니다 Atomic Query는 Table내부 Data를 update하는 작업에서 기존 데이터를 이용해서 변경하는 것을 의미 합니다 예시 일반 update query update from food set number_of_likes = 10 # 기존 number_of_likes : 9 where food_id = 15; Atomic Query update from food set number_of_likes = number_of_likes + 1 where food_id = 15; 위 결과는 동일하게 number_of_likes의 값.. 2022. 4. 28.
Spring Transactional 동작 과정 전체 로직 Flow public abstract class TransactionAspectSupport implements BeanFactoryAware, InitializingBean { @Nullable protected Object invokeWithinTransaction(Method method, @Nullable Class targetClass, final InvocationCallback invocation) throws Throwable { TransactionAttributeSource tas = getTransactionAttributeSource(); final TransactionAttribute txAttr = (tas != null ? tas.getTransactionAttrib.. 2022. 4. 10.
Replica 싱크 불일치 이슈 Replica 복제 지연 문제 복제 지연 발생 이슈 원인: Amazon RDS for MySQL은 비동기 복제를 사용하기 때문에 일부 DB 변경 사항이 반영되지 않는 경우가 있습니다 seconds_behind_master: master DB와 slave DB사이에 현재 타임스탬프 간의 차이가 표시하는 것입니다 MySQL 복제를 위한 Thread master slave cf)SHOW PROCESSLIST 명령어를 통해서 내부 process list를 볼 수 있습니다 Binlog Dump Thread replica에 binary log 정보를 전송하는 역할을 담당합니다 현재 master process list 사진에서 ID 7에 해당합니다 Replica IO Thread start slave query가 s.. 2022. 4. 7.
반응형