C++ to Go
Introducing Ziegel
박재완
Luft
- OLAP database for analize the analyzing user behavior in real-time
- Use TrailDB as a storage
- Written in C/C++ and Go
- TrailDB is an efficient tool for storing and querying series of events
- Written in C
- New storage engine for the Luft
- Written in Go
Why?
- TrailDB has been a suitable solution for the Luft
- But development was halted in 2019
- Issues with peformance and productivity
Issues
- Inefficient multi-core utilization
// finalize. this could take a while with idle CPU usage but don't panic.
// it's not freeze;
// it's because TrailDB indexing process is not parallelized yet :(
- Row store data structure
- Use multiple language: C/C++ and Go
Journey for the migration
- Add more tests for consistency verification
- Add interface for engine replacement
- With this interface, we can easily replace the engine(partial or full)
- Implement storage engine
- Peformance tuning
- 2x fater for the ingestion, 1.2 slower for the query
Go provides great tools for measuring performance.
Dave Cheney의 The Zen of Go를 번역했습니다. 좀 더 알고 싶으신 분은 발표 영상과 블로그 글을 함께 참고해 주십시오.
Go의 철학
쉽고, 읽기 좋으며, 유지가능한 Go 코드 작성을 위한 10가지 엔지니어링 가치. 고퍼콘 이스라엘 2020에 발표하였음.
패키지는 하나의 목적만을 달성합니다
잘 디자인된 Go 패키지는 단 하나의 아이디어와 관련 동작을 제공합니다. 좋은 Go 패키지를 위해 좋은 이름을 먼저 정해야 합니다. 엘리베이터 피치라고 생각하며 패키지 이름을 정해보십시오.
에러는 명시적으로 처리합니다
단단한 프로그램은 문제가 생기기 전에 실패처리를 하는 요소들로 이루어져 있습니다. 실패를 발생지점에서 의도적으로 처리할 수 있다는 것은 if err != nil { return err } 의 장황함마저 대수롭지 않아 보이게 합니다. panic과 recover는 예외가 아니며, 그런 식으로 사용되게 의도되지 않았습니다.
Go에서 GLFW 등을 이용해 그래픽스 관련 작업을 할 때에도 자동화
테스트 구성이 가능합니다. 하지만 GitHub Actions과 같이
디스플레이가 없는 환경에서는 의존성을 가지고 있다는 이유만으로 그래픽스 관련 테스트가 실패합니다.
xvfb는 메뉴얼에서 virtual framebuffer X server for X Version 라고 소개되고 있으며, 서버 사이드
테스트를 위해 주로 사용됩니다.
Ubuntu 기준으로 sudo apt install xvfb로 설치하고 xvfb-run에 이어서 테스트 명령어를 추가하여
테스트할 수 있습니다. 실제 GitHub Actions에 적용한 예시를
공유드립니다.
Go module에서 GitHub private 저장소를 사용하는 방법입니다.
git 설정에서 GitHub 접근을 계정과 토큰을 사용하게 변경
git config --global url."https://${GITHUB_USER}:${{GITHUB_TOKEN}}@github.com".insteadOf "https://github.com"
GOPRIVATE 환경변수에 private 저장소 등록
GOPRIVATE="github.com/hueypark/asset"
개요
이번에는 간단하게 해결할 수 있는 이슈를 수정했습니다. 이 정도의 이슈는 처음 스프린트에 참여하는 분도 해결할 수 있을 것으로 기대합니다.
개요
Pebble은 LevelDB/RocksDB에서 영감을 받은 카크로치디비용 키-밸류 저장소입니다. 현재(2019년 8월)는 개발 진행중인 상태이며, 2020년 카크로치디비 적용을 계획하고 있습니다.
On Visual Studio Code, Go debugging is very slow because that always rebuild everything.
If you set following settings on your .vscode folder Visual Studio Code will only build when changed.