SlideShare ist ein Scribd-Unternehmen logo
1 von 17
새벽 점검 작업 : 설정 변경을 위한 MariaDB 재시작
- InnoDB Redo Log Size
50MB x 2 => 2GB x 3
- InnoDB Buffer Pool (전체 물리 메모리 64GB)
32GB => 40GB
- 서비스 차단 후 DB Shutdown
- 버퍼 풀 덤프 & 로드
- MariaDB 설정 변수 변경
새벽 시간이라 가볍게 생각했던 부분
- mysqldump 를 이용한 DB 풀백업
서비스 오픈 이후 DB의 급격한 성능 저하!
mysql> SHOW PROCESSLIST;
+-----+------+------+------+---------+------+------------+--------------------------------+
| Id | User | Host | db | Command | Time | State | Info |
+-----+------+------+------+---------+------+------------+--------------------------------+
| ... | ... | ... | ... | ... | ... | ... | ... |
| ... | ... | ... | ... | ... | 3 | statistic | INSERT INTO LOG_TBL ... |
| ... | ... | ... | ... | ... | 2 | update | INSERT INTO LOG_TBL ... |
| ... | ... | ... | ... | ... | 3 | Sending.. | SELECT COL1, COl2, ... |
| ... | ... | ... | ... | ... | 2 | Sending.. | SELECT COL1, COl2, ... |
| ... | ... | ... | ... | ... | 3 | statistic | INSERT INTO LOG_TBL ... |
| ... | ... | ... | ... | ... | 2 | Sending.. | SELECT COUNT(*) FROM ... |
| ... | ... | ... | ... | ... | 2 | Sending.. | SELECT COUNT(*) FROM ... |
| ... | ... | ... | ... | ... | 3 | statistic | INSERT INTO LOG_TBL ... |
| ... | ... | ... | ... | ... | 2 | Sorting.. | SELECT COL5, COl6, ... |
| ... | ... | ... | ... | ... | 5 | update | INSERT INTO LOG_TBL ... |
| ... | ... | ... | ... | ... | 3 | Sending.. | SELECT COL3, COl4, ... |
| ... | ... | ... | ... | ... | 2 | Copying to | SELECT * FROM ( SEL ... |
| ... | ... | ... | ... | ... | 0 | closing.. | drop temporary table ... |
| ... | ... | ... | ... | ... | 2 | Sorting.. | SELECT COL5, COl6, ... |
| ... | ... | ... | ... | ... | 2 | Sorting.. | SELECT COL5, COl6, ... |
| ... | ... | ... | ... | ... | 2 | update | INSERT INTO LOG_TBL ... |
| ... | ... | ... | ... | ... | ... | ... | ... |
+-----+------+------+------+---------+------+------------+--------------------------------+
SHOW ENGINE INNODB STATUS 의
SEMAPHORE 절에서 경합을 발견
storage/innobase/include/dict0boot.ic
dict_sys->mutex
구글링 !!!
InnoDB scalability issues due to tables without primary keys
PK가 없는 InnoDB 테이블에서
내부적으로 관리되는 row id 값을
획득하기 위해 데이터 딕셔너리에 접근
상황 파악 1차
1) DB 재시작 이후, mysqldump 실행으로 자주 사용되지 않는
테이블의 데이터 페이지가 버퍼 풀에 적재
2) 서비스 오픈 이후 메모리 효율 저하 및 I/O 부하 증가
3) 쿼리 처리가 지연되며, 많은 양의 스레드가 적체
4) PK 없는 테이블의 INSERT에서 dict_sys mutex 경합 발생
=> dict_sys mutex 경합을 DB 부하의 결과로 파악
자주 활용되는 데이터가 메모리에 적재되며
DB 부하가 해소되었으나..
처리 성능이 튜닝 전보다 나빠짐
피크 타임 때, 다시 한 번 부하 발생하며 멘탈붕괴!!!
“무슨 설정 DB 설정을 바꿨냐?”
... Write Ahead Logging .. Buffer Pool ..
DBA로서 가지고 있던 상식에 대한 믿음이 흔들림
mysql> SHOW PROCESSLIST;
+-----+------+------+------+---------+------+------------+--------------------------------+
| Id | User | Host | db | Command | Time | State | Info |
+-----+------+------+------+---------+------+------------+--------------------------------+
| ... | ... | ... | ... | ... | ... | ... | ... |
| ... | ... | ... | ... | ... | 3 | statistic | INSERT INTO LOG_TBL ... |
| ... | ... | ... | ... | ... | 2 | update | INSERT INTO LOG_TBL ... |
| ... | ... | ... | ... | ... | 3 | Sending.. | SELECT COL1, COl2, ... |
| ... | ... | ... | ... | ... | 2 | Sending.. | SELECT COL1, COl2, ... |
| ... | ... | ... | ... | ... | 3 | statistic | INSERT INTO LOG_TBL ... |
| ... | ... | ... | ... | ... | 2 | Sending.. | SELECT COUNT(*) FROM ... |
| ... | ... | ... | ... | ... | 2 | Sending.. | SELECT COUNT(*) FROM ... |
| ... | ... | ... | ... | ... | 3 | statistic | INSERT INTO LOG_TBL ... |
| ... | ... | ... | ... | ... | 2 | Sorting.. | SELECT COL5, COl6, ... |
| ... | ... | ... | ... | ... | 5 | update | INSERT INTO LOG_TBL ... |
| ... | ... | ... | ... | ... | 3 | Sending.. | SELECT COL3, COl4, ... |
| ... | ... | ... | ... | ... | 2 | Copying to | SELECT * FROM ( SEL ... |
| ... | ... | ... | ... | ... | 0 | closing.. | drop temporary table ... |
| ... | ... | ... | ... | ... | 2 | Sorting.. | SELECT COL5, COl6, ... |
| ... | ... | ... | ... | ... | 2 | Sorting.. | SELECT COL5, COl6, ... |
| ... | ... | ... | ... | ... | 2 | update | INSERT INTO LOG_TBL ... |
| ... | ... | ... | ... | ... | ... | ... | ... |
+-----+------+------+------+---------+------+------------+--------------------------------+
크고 작은 부하 발생시마다 눈에 보이는 한 줄
!!!!!!!!!!!
다시 한 번 문서 확인
InnoDB scalability issues due to tables without primary keys
drop temporary table ~
해당 구문을 처리하는 배치 프로세스 확인
배치 실행시, 3~4만번 정도의 반복문을 통하여 특정
프로시저를 호출하는데, 이 프로시저 내부에서
create/drop temporary table 구문을 사용
매우 빠른 속도로
create/drop temporary table
구문이 반복적으로 수행됨
상황 파악 2차
1) CREATE/DROP 구문이 Loop 형태로 사용되며, 데이터 딕
셔너리 정보 갱신을 위해 반복적으로 dict_sys mutex 점유
2) PK없는 테이블이 INSERT를 처리하면서, row id 획득을 위
해 데이터 딕셔너리 테이블 접근
3) dict_sys mutex 발생
4) INSERT 쿼리가 처리되지 못하며, 다른 쿼리의 처리 또한 영
향을 받음
=> dict_sys mutex 경합이 DB 부하의 원인!
create/drop temporary 를 사용하지 않도록
프로시저를 수정 한 이후 문제가 해결!
하지만 적은 빈도로 수행되는 DDL 명령 수행 시,
심하지 않지만 dict_sys mutex 경합은 여전
* 고민이 필요한 부분
- InnoDB 테이블에는 PK 설정에 문제가 없는가?
(파티션 제약)
- 로그성 테이블이 물리적으로 분리가 가능한가?
- 로그성 데이터 입력을 실시간이 아닌,
배치 형태로 변경이 가능한가?
* 결론
장애 상황은 DBA의 수명을 줄인다.
장애 상황은 문서를 통한 간접 경험만으로도 충분하다.

Weitere ähnliche Inhalte

Empfohlen

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Empfohlen (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

[MySQL 스터디] 기타기능

  • 1. 새벽 점검 작업 : 설정 변경을 위한 MariaDB 재시작 - InnoDB Redo Log Size 50MB x 2 => 2GB x 3 - InnoDB Buffer Pool (전체 물리 메모리 64GB) 32GB => 40GB
  • 2. - 서비스 차단 후 DB Shutdown - 버퍼 풀 덤프 & 로드 - MariaDB 설정 변수 변경
  • 3. 새벽 시간이라 가볍게 생각했던 부분 - mysqldump 를 이용한 DB 풀백업
  • 4. 서비스 오픈 이후 DB의 급격한 성능 저하! mysql> SHOW PROCESSLIST; +-----+------+------+------+---------+------+------------+--------------------------------+ | Id | User | Host | db | Command | Time | State | Info | +-----+------+------+------+---------+------+------------+--------------------------------+ | ... | ... | ... | ... | ... | ... | ... | ... | | ... | ... | ... | ... | ... | 3 | statistic | INSERT INTO LOG_TBL ... | | ... | ... | ... | ... | ... | 2 | update | INSERT INTO LOG_TBL ... | | ... | ... | ... | ... | ... | 3 | Sending.. | SELECT COL1, COl2, ... | | ... | ... | ... | ... | ... | 2 | Sending.. | SELECT COL1, COl2, ... | | ... | ... | ... | ... | ... | 3 | statistic | INSERT INTO LOG_TBL ... | | ... | ... | ... | ... | ... | 2 | Sending.. | SELECT COUNT(*) FROM ... | | ... | ... | ... | ... | ... | 2 | Sending.. | SELECT COUNT(*) FROM ... | | ... | ... | ... | ... | ... | 3 | statistic | INSERT INTO LOG_TBL ... | | ... | ... | ... | ... | ... | 2 | Sorting.. | SELECT COL5, COl6, ... | | ... | ... | ... | ... | ... | 5 | update | INSERT INTO LOG_TBL ... | | ... | ... | ... | ... | ... | 3 | Sending.. | SELECT COL3, COl4, ... | | ... | ... | ... | ... | ... | 2 | Copying to | SELECT * FROM ( SEL ... | | ... | ... | ... | ... | ... | 0 | closing.. | drop temporary table ... | | ... | ... | ... | ... | ... | 2 | Sorting.. | SELECT COL5, COl6, ... | | ... | ... | ... | ... | ... | 2 | Sorting.. | SELECT COL5, COl6, ... | | ... | ... | ... | ... | ... | 2 | update | INSERT INTO LOG_TBL ... | | ... | ... | ... | ... | ... | ... | ... | ... | +-----+------+------+------+---------+------+------------+--------------------------------+
  • 5. SHOW ENGINE INNODB STATUS 의 SEMAPHORE 절에서 경합을 발견 storage/innobase/include/dict0boot.ic dict_sys->mutex
  • 6. 구글링 !!! InnoDB scalability issues due to tables without primary keys PK가 없는 InnoDB 테이블에서 내부적으로 관리되는 row id 값을 획득하기 위해 데이터 딕셔너리에 접근
  • 7. 상황 파악 1차 1) DB 재시작 이후, mysqldump 실행으로 자주 사용되지 않는 테이블의 데이터 페이지가 버퍼 풀에 적재 2) 서비스 오픈 이후 메모리 효율 저하 및 I/O 부하 증가 3) 쿼리 처리가 지연되며, 많은 양의 스레드가 적체 4) PK 없는 테이블의 INSERT에서 dict_sys mutex 경합 발생 => dict_sys mutex 경합을 DB 부하의 결과로 파악
  • 8. 자주 활용되는 데이터가 메모리에 적재되며 DB 부하가 해소되었으나.. 처리 성능이 튜닝 전보다 나빠짐
  • 9. 피크 타임 때, 다시 한 번 부하 발생하며 멘탈붕괴!!! “무슨 설정 DB 설정을 바꿨냐?” ... Write Ahead Logging .. Buffer Pool .. DBA로서 가지고 있던 상식에 대한 믿음이 흔들림
  • 10. mysql> SHOW PROCESSLIST; +-----+------+------+------+---------+------+------------+--------------------------------+ | Id | User | Host | db | Command | Time | State | Info | +-----+------+------+------+---------+------+------------+--------------------------------+ | ... | ... | ... | ... | ... | ... | ... | ... | | ... | ... | ... | ... | ... | 3 | statistic | INSERT INTO LOG_TBL ... | | ... | ... | ... | ... | ... | 2 | update | INSERT INTO LOG_TBL ... | | ... | ... | ... | ... | ... | 3 | Sending.. | SELECT COL1, COl2, ... | | ... | ... | ... | ... | ... | 2 | Sending.. | SELECT COL1, COl2, ... | | ... | ... | ... | ... | ... | 3 | statistic | INSERT INTO LOG_TBL ... | | ... | ... | ... | ... | ... | 2 | Sending.. | SELECT COUNT(*) FROM ... | | ... | ... | ... | ... | ... | 2 | Sending.. | SELECT COUNT(*) FROM ... | | ... | ... | ... | ... | ... | 3 | statistic | INSERT INTO LOG_TBL ... | | ... | ... | ... | ... | ... | 2 | Sorting.. | SELECT COL5, COl6, ... | | ... | ... | ... | ... | ... | 5 | update | INSERT INTO LOG_TBL ... | | ... | ... | ... | ... | ... | 3 | Sending.. | SELECT COL3, COl4, ... | | ... | ... | ... | ... | ... | 2 | Copying to | SELECT * FROM ( SEL ... | | ... | ... | ... | ... | ... | 0 | closing.. | drop temporary table ... | | ... | ... | ... | ... | ... | 2 | Sorting.. | SELECT COL5, COl6, ... | | ... | ... | ... | ... | ... | 2 | Sorting.. | SELECT COL5, COl6, ... | | ... | ... | ... | ... | ... | 2 | update | INSERT INTO LOG_TBL ... | | ... | ... | ... | ... | ... | ... | ... | ... | +-----+------+------+------+---------+------+------------+--------------------------------+ 크고 작은 부하 발생시마다 눈에 보이는 한 줄
  • 11. !!!!!!!!!!! 다시 한 번 문서 확인 InnoDB scalability issues due to tables without primary keys
  • 12. drop temporary table ~ 해당 구문을 처리하는 배치 프로세스 확인 배치 실행시, 3~4만번 정도의 반복문을 통하여 특정 프로시저를 호출하는데, 이 프로시저 내부에서 create/drop temporary table 구문을 사용
  • 13. 매우 빠른 속도로 create/drop temporary table 구문이 반복적으로 수행됨
  • 14. 상황 파악 2차 1) CREATE/DROP 구문이 Loop 형태로 사용되며, 데이터 딕 셔너리 정보 갱신을 위해 반복적으로 dict_sys mutex 점유 2) PK없는 테이블이 INSERT를 처리하면서, row id 획득을 위 해 데이터 딕셔너리 테이블 접근 3) dict_sys mutex 발생 4) INSERT 쿼리가 처리되지 못하며, 다른 쿼리의 처리 또한 영 향을 받음 => dict_sys mutex 경합이 DB 부하의 원인!
  • 15. create/drop temporary 를 사용하지 않도록 프로시저를 수정 한 이후 문제가 해결! 하지만 적은 빈도로 수행되는 DDL 명령 수행 시, 심하지 않지만 dict_sys mutex 경합은 여전
  • 16. * 고민이 필요한 부분 - InnoDB 테이블에는 PK 설정에 문제가 없는가? (파티션 제약) - 로그성 테이블이 물리적으로 분리가 가능한가? - 로그성 데이터 입력을 실시간이 아닌, 배치 형태로 변경이 가능한가?
  • 17. * 결론 장애 상황은 DBA의 수명을 줄인다. 장애 상황은 문서를 통한 간접 경험만으로도 충분하다.