Skip to content

Latest commit

History

History
128 lines (81 loc) · 3.47 KB

File metadata and controls

128 lines (81 loc) · 3.47 KB

System-Design-Interview

가상 면접 사례로 배우는 대규모 시스템 설계 기초 구현

Quick Start

프로메테우스 권한 추가

sudo chmod -R 755 ./prometheus

프로메테우스 접속 방법

http://localhost:9090

grafana 접속 방법

http://localhost:3000/

아이디 / 비밀번호

admin / admin

prometheus Datasource 추가

image

  1. 가운데 DATA SOURCES 클릭
  2. Prometheus 클릭

image

  1. HTTP URL 위와 같이 설정 (docker-compose 파일의 service 이름과 동일하게 맞춘다)
  2. 페이지 하단의 "Save & Test" 클릭

JVM Dashboard 추가

image

+Import 클릭

image

image

이 후 Prometheus 선택하고 Import

Result

image

Mysql Dashboard 추가

위와 동일하게 +Import 에서 아래 숫자를 입력하고 Load를 클릭

  • 7362

K6 사용하기(macOS ver)

  1. K6 설치
brew install k6
  1. k6 스크립트 작성(기본 예제)
importhttpfrom'k6/http';import{check,sleep}from'k6';exportconstoptions={stages: [{duration: '30s',target: 20},{duration: '1m30s',target: 10},{duration: '20s',target: 0},],};exportdefaultfunction(){constres=http.get('http://localhost:8080/test');check(res,{'status was 200': (r)=>r.status===200});sleep(1)}
  1. 스크립트 실행
k6 run ./generator/traffic.js

로드 밸런서 추가하기

  1. docker compose를 활용해, 동일한 was 이미지를 2개 띄우기
docker compose up --scale app=2

띄워진 컨테이너 확인

image

  1. 요청을 2번 보냈을때, 로드 밸런싱이 되는지 확인

image

  1. app-2 컨테이너 종료해보기

image

  1. 다시 요청을 보냈을때 app-1이 요청을 받는지 확인하기

image

  1. Grafana 확인
스크린샷 2023-06-10 오후 3 08 28