전체 글
-
Real My SQL 8.0 읽고 공부하기 - ⑧-①,② 인덱스SQL 공부/MySQL 8.0 2023. 9. 21. 02:09
MySQL 8.0 버전까지 업그레이드가 되면서 MyISAM 스토리지엔진에서만 제공하던 전문검색, 위치기반 검색 기능 모두 InnoDB스토리지 엔진에서 사용할 수 있게 개선되었다. MySQL서버의 옵티마이저가 발전하고 성능이 개선되었어도 여전히 관리자의 역할은 매우 중요하기 때문에 인덱스에 관한 지식은 개발자나 관리자에게 모두 중요하며, 쿼리 튜닝의 기본이 된다. 1) 디스크 읽기 방식 데이터베이스의 성능 튜닝은 어떻게 디스크 I/O를 줄이느냐가 큰 관건이다. 컴퓨터에서 CPU나 메모리 같은 주요 장치는 전자식 장치이지만 HDD의 경우 기계식 장치이다. 이런 HDD를 대체하기 위해 전자식 저장 매체인 SSD가 많이 출시 되고 있다. SSD는 기존 하드 디스크 드라이브에서 데이터 저장용 플래터(원판)을 제거..
-
Real My SQL 8.0 읽고 공부하기 - ⑦-③,④,⑤데이터 암호화SQL 공부/MySQL 8.0 2023. 9. 20. 01:06
3) 테이블 암호화 키링 플러그인은 마스터 키를 생성하고 관리하는 부분까지만 담당하기 때문에 어떤 키링 플러그인을 사용하든 암호화된 테이블을 생성하고 활용하는 방법 모두 동일하다. 테이블 생성은 다음과 같이 할 수 있다. CREATE TABLE tab_encrypted ( id INT, data VARCHAR(100), PRIMARY KEY(id) ) ENCRYPTION='Y'; 기존 테이블 생성 구문과 동일하며 마지막에 ENCRYPTION ='Y' 옵션만 추가로 넣으면 된다. 응용프로그램에서 직접 암호화해서 MySQL 서버에 저장하는 경우가 있는데, MySQL은 이 컬럼이 암호화된것인지 여부를 판단하지 못한다. 이에 따라서 해당 컬럼을 인덱스를 생성하더라도 인덱스 기능을 100% 활용 할 수 없다. 응..
-
Java 8 ~ 17 주요 변경점 정리하기JAVA공부/JAVA 2023. 9. 17. 02:22
현업에서 Java 17버전을 사용하게 되었는데, 주요 변경점들에 대해서 너무 모르고 있는 것이 많아 정리하려고 한다. Java 8 → Java 11 1. 모듈 시스템 자바 9부터 모듈 시스템이 도입되어 라이브러리와 애플리케이션을 모듈로 분리하는 기능을 제공한다. 2. 로우-레벨 프로파일러 (JMH) 자바 11에는 JMH를 지원하는 도구가 포함되어 있어 , 로우-레벨에서 성능 테스트를 수행하기가 더 쉬워졌다. ※ JMH: Java언어로 작성된 마이크로 벤치마킹 도구이다. Java코드의 작은 부분을 테스트하고 성능 특성을 분석하는데 쓰인다. Java 성능 튜닝과 최적화에 매우 유용한 도구로 인정받고 있다. 3. HTTP/2 지원 자바 9부터 HTTP/2 프로토콜을 지원한다. 이를 통해 네트워크 통신의 성능을..
-
Java 성능 모니터링 ②-① 본론 (VisualVM 분석 및 연동)JAVA공부/JAVA 2023. 9. 13. 02:39
자바애플리케이션에서 JVM을 모니터링하기 위해 가장 많이 쓰이는 VisualVM을 연동을 하여 어떠한 지표들을 보아야하는지, 트러블을 일으키고 해결하는 것을 실습해보도록 하자. 여기서 애플리케이션은 스프링 부트 웹 애플리케이션을 이용하도록 하겠다. 1. 설치 VisualVM: Download 이곳에 가서 각 운영체제 맞는 VisualVM을 설치하도록 하자. 필자는 Windows여서 Zip파일을 받아서 압축해제하였다. 2. 실행 압축해제를 진행하면 bin폴더에 visualvm.exe 파일이 존재한다. 실행시키고 라이센스에 동의한다. 실행에 성공하면 다음과 같은 화면이 나오게 된다. 현재 구동중인 자바 애플리케이션이 존재하지 않아서 Local밑에 나오는 자바애플리케이션이 VisualVM외에 존재하지 않는다...
-
Java 성능 모니터링 ① - 서론JAVA공부/JAVA 2023. 9. 12. 02:55
개발을 진행하면서 설정을 위해 성능을 측정해보거나 사용자의 경험을 위해 좋은 성능의 서비스를 제공해야하는데, 이를 위해 모니터링을 해야하는 부분과 제공하는 프로그램(툴)들을 Chat-GPT와 함께 확인(공부)해보도록 하자. 1. 모니터링 목록 1) CPU 사용량 CPU 프로파일링: 가장 많은 CPU 시간을 소비(점유)하는 코드부분이나 메서드를 식별 2) 메모리사용량 힙 분석: Java 힙 메모리 사용량을 모니터링 하여 메모리 누수, 과도한 객체 생성, 불필요한 메모리 소비 식별 GC 분석: 가비지 수집(GC) 로그를 분석하여 가비지 수집 설정을 최적화하고 stop-the-world를 최소화한다. 3) 스레드 활동 스레드 덤프 분석: 스레드 덤프를 캡처하고 분석하여 스레드 경합, 교착 상태 또는 장기 실행..
-
MyBatis 의도치 않은 캐싱SPRING 공부/기타 2023. 9. 5. 23:35
1. 발견 실무에서 복잡한 비즈니스를 다루는 로직에서 도저히 이해가 안가는 상황이 나오게 되었다. 상황은 이렇다. 첫 번째로 조회한 객체에는 객체 내부에 컬렉션을 가지고 있는데, 다음 메서드가 실행되기 전에는 비어있는 컬렉션인 것을 확인하였으나 메서드 실행 직후 내부 컬렉션에 객체들이 존재하는 것을 확인하였다. 분명 해당 객체를 어디선가 수정메서드를 통해 변경하는일이 없는데도 말이다. 도저히 납득이 가지 않아서 객체를 파라미터로 넘겨주고 복잡한 비즈니스를 파고파고 들어가서 해당 상태가 바뀌는 시점을 체크해보았으나 해당 메서드에서 바뀌는 이유를 종 잡을 수 없었다. 그때 혹시나 스쳐가는 생각이 JPA에서 캐시 기능을 사용하여 동일성을 보장해주는 것이 생각났다. 위에서 사용한 비즈니스에 조건의 범위가 다른 ..
-
Real My SQL 8.0 읽고 공부하기 - ⑤-④ MySQL의 격리 수준SQL 공부/MySQL 8.0 2023. 9. 5. 02:06
트랜잭션의 격리 수준 이란 여러 트랜잭션이 동시에 처리 될 때 특정 트랜잭션이 다른 트랜잭션에서 변경하거나 조회하는 데이터를 볼 수 있게 허용할지 말지를 결정하는 것이다. 격리 수준을 알기 전에 용어 부터 정리해보자 1. DIRTY READ 한 트랜잭션이 다른 트랜잭션에 의해 수정되었지만 커밋되지 않은 데이터를 읽어오는 상황 만약 커밋되지 않고 롤백되어버린다면 데이터가 일관되지 않은 상태여서 잘못된 결과가 도출될 수 있다. 2. NON-REPEATABLE READ 동일한 트랜잭션 내에서 처음 조회한 데이터가 다른 트랜잭션에 의해 수정되고 커밋되고나서 다시 조회한 경우 수정된 데이터를 읽어오는 상황 3. PHANTOM READ 트랜잭션이 특정조건을 만족하는 행 집합 을 읽은 후 에 동일한 트랜잭션 내에서 ..
-
Real My SQL 8.0 읽고 공부하기 - ⑤-③ InnoDB 스토리지 엔진 잠금SQL 공부/MySQL 8.0 2023. 9. 4. 02:36
1) InnoDB 스토리지 엔진의 잠금 InnoDB스토리지 엔진은 레코드 기반의 잠금을 제공한다. 잠금 정보가 상당히 작은 공간으로 관리되기 때문에 레코드락이 페이지 락 혹은 테이블락으로 레벨업(락 에스컬레이션) 는 존재하지 않는다. InnoDB엔진에서는 레코드와 레코드 사이의 간격을 잠그는 갭(GAP) 락이라는 것이 존재한다. 1. 레코드락 레코드 자체만을 잠그는것을 레코드 락이라고 하며, InnoDB엔진은 레코드 자체가 아니라 인덱스 레코드를 잠근다. 만약 인덱스가 존재하지 않더라도 내부적으로 자동 생성된 클러스터 인덱스를 이용해 잠금을 설정한다. 보조 인덱스를 이용한 변경 작업은 넥스트 키 락 혹은 갭 락을 사용하지만 프라이머리 키 혹은 유니크 인덱스에 의한 변경 작업에서는 갭에 대해서는 잠그지 않..