전체 글

전체 글

    [Spring] SpringBoot K6 + Grafana 부하 테스트 및 모니터링

    SpringBoot 프로젝트에 K6 + Grafana + InfluxDB를 사용해서 부하 테스트와 성능 테스트를 진행해보겠다. 1. k6 설치cmd 창에 다음을 입력한다.window가 아닌 다른 환경이라면 여기를 참고하면 된다.choco install k6  동작 확인을 위해 프로젝트 root 폴더 하위에 scripts폴더를 만들어 sample.js 파일을 생성해서 다음 코드를 작성해주었다.Http Get 메서드를 사용하여 해당 url로 요청을 보낸다. 해당 코드는 공식 문서에 있는 sample 코드이다.import http from 'k6/http';import { sleep } from 'k6';export default function () { http.get('https://test.k6.i..

    [Spring] Jacoco 적용하여 코드 커버리지 확인 및 Codecov사용한 PR에 커버리지 코멘트 추가

    프로젝트에 Jacoco를 적용해서 테스트 커버리지를 확인해보자. 그리고 나서 git actions와 codecov를 사용하여 PR에 커버리지 코멘트를 달아보자. 1. build.gradle 설정 plugins { // ... id 'jacoco' //추가 } group = 'com.example' version = '0.0.1-SNAPSHOT' sourceCompatibility = '17' configurations { compileOnly { extendsFrom annotationProcessor } } repositories { mavenCentral() } jacoco { toolVersion = "0.8.8" //추가: 버전 명시 } dependencies { //생략 } tasks.named..

    [TIL - 20230526] Github Actions Jacoco&Codecov

    💻문제점 jacoco로 테스트 커버리지 파일을 생성하고, PR을 보낼 때 커버리지가 Comment로 생성되기를 원했다. 하지만 Comment는 영 나올 생각을 안하고,,, CI도 계속 실패했다. 📃시도 name: Code Coverage sample on: push: branches: - 'develop' - 'main' pull_request: branches: - 'develop' - 'main' jobs: code-coverage: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Set up JDK 1.8 uses: actions/setup-java@v1 with: java-version: 1.8 - name: Grant exec..

    [TIL - 20230525] Prometheus, Grafana 적용, 오류 해결

    💻문제점1 프로젝트에 prometheus와 grafana 툴을 적용하여 모니터링 하려고 했다. 프로젝트 최상위 프로젝트 하위에 prometheus.yml을 생성하여 터미널에서 다음 명령어를 수행했다. docker run \ -d \ -p 9090:9090 \ -v ./prometheus.yml:/etc/prometheus/prometheus.yml \ prom/prometheus 다음과 같은 오류가 발생했다. failed to register layer: Error processing tar file(exit status 127): docker-untar: symbol lookup error: docker-untar: undefine d symbol: , version GLIBC_2.2.5 docker-..

    [Spring] SpringBoot Prometheus, Grafana를 사용한 모니터링(Feat. Docker)

    1. 의존성 추가 Spring Boot Actuator를 활성화하여 모니터링/관리할 수 있는 엔드포인트에 접속 할 수 있도록 해준다. implementation 'org.springframework.boot:spring-boot-starter-actuator' runtimeOnly 'io.micrometer:micrometer-registry-prometheus' 프로젝트를 실행하고, 다음 경로에 접속하자. http://localhost:8080/actuator 8080 부분에는 본인 프로젝트의 서버 포트를 입력해주면 된다. 접속하면 다음과 같은 창이 뜬다. Actuator가 현재 제공하는 엔드포인트를 확인할 수 있다. 2. application.yml 설정 actuator의 prometheus 엔드포인..

    [TIL - 20230524] WebFlux 예제 구현

    💻문제점 우리가 실시간 스트리밍 레퍼런스가 WebFlux로 작성된 코드기도 하고, 대규모 트래픽이 예상되는 프로젝트일 뿐더러 Spring MVC로 구현하면 많아질 수 있는 쓰레드를 줄이기 위해 WebFlux를 사용하는 방향으로 진행되고 있다. 그동안 배운게 Spring Web MVC라 새로운 프레임워크를 적용한다는 점이 위험 부담도 있고, 새롭게 공부해야 한다는 점에서 어려운 부분도 있다. 우선 간단한 CRUD부터 공부를 해야겠다 싶어서 유튜브 예제를 보고 간단한 예제를 구성해보고, 기능을 새롭게 추가해보기도 했다. 📃시도 간단하게 상품을 등록하고, 상품 담기/삭제, 카트에서 상품 하나 빼기/상품 전체 삭제 기능을 구현해보았다. https://yeon-dev.tistory.com/197 [Spring] ..

    [Spring] Spring WebFlux 간단한 예제

    Spring WebFlux를 이용하여 간단하게 상품 등록/삭제, 카트에 상품 담기/삭제 기능을 구현해보도록 하겠다. 1. 프로젝트 생성 2. 환경 구성 build.bradle 에 다음 dependency를 추가해준다. implementation 'de.flapdoodle.embed:de.flapdoodle.embed.mongo:3.3.0' implementation 'org.mongodb:mongodb-driver-sync' testImplementation 'de.flapdoodle.embed:de.flapdoodle.embed.mongo:3.3.0' 프로젝트 구조는 다음과 같다. 3. 코드 Cart.java @Getter @Setter @ToString @NoArgsConstructor @AllArg..