# GitHub의 RDB 파티셔닝 후기

> Clean Markdown view of GeekNews topic #5101. Use the original source for factual precision when an external source URL is present.

## Metadata

- GeekNews HTML: [https://news.hada.io/topic?id=5101](https://news.hada.io/topic?id=5101)
- GeekNews Markdown: [https://news.hada.io/topic/5101.md](https://news.hada.io/topic/5101.md)
- Type: news
- Author: [xguru](https://news.hada.io/@xguru)
- Published: 2021-09-29T11:29:01+09:00
- Updated: 2021-09-29T11:29:01+09:00
- Original source: [github.blog](https://github.blog/2021-09-27-partitioning-githubs-relational-databases-scale/)
- Points: 12
- Comments: 0

## Topic Body

- 10여년 전에 RoR과 싱글 MySQL 인스턴스로 시작한 GitHub

- 2019년에 파티셔닝 시작해서 2년간 다양한 작업들을 수행한 후기

ㅤ→ 2021년 현재 DB의 로드가 50% 감소했다고

1. 가상 파티션

- 실제 테이블을 옮기기 전에 어플리케이션 레이어 단에서 가상으로 분리

- 테이블들을 그룹핑 하여 스키마 도메인으로 묶고, SQL Linter를 이용해서 경계를 두도록 강제

ㅤ→ 나중에 파티셔닝 할 때 안전하도록

- Query Linter 와 Transaction Linter 로 가상 경계 확인

2. 다운타임 없이 데이터 옮기기

- Vitess 의 Vertical Sharding 기능을 이용

ㅤ→ VTGate를 쿠버네티스 클러스터에 배포후 연결 포인트로 변경

- Write-cutover 프로세스 도입

ㅤ→ MySQL의 Replication 기능을 이용해서 데이터를 다른 클러스터로 피딩

ㅤ→ ProxySQL 을 이용해서 MySQL 클라이언트 연결을 Multiplex

결과

- 2019년에는 싱글 클러스터였던 mysql1은 초당 평균 95만 쿼리 응답

- 2021년에는 멀티 클러스터로 분산되었고, 초당 평균 120만 쿼리 응답 하면서 호스트 부하는 절반

## Comments



_No public comments on this page._
