본문 바로가기

전체 글

(50)
LinkedList 와 List 선언 차이 습관적으로 자바 Collection Framework의 자료구조를 사용할 때 public static void main(String[] args) { LinkedList linkedList = new LinkedList();}위와 같이 사용을 했었다. 자료구조를 직접 만들며 공부하던 중 한가지 의문이 생겼다.왜 List 으로 선언을 하면 안되는건가?대부분의 예제 설명에서 LinkedList로 선언을 하고 있고 List로는 선언을 하고 있지 않다. 과연 LinkedList 와 List 중 어떤걸 선언하는게 더 바람직한 사용법일까?결론 부터 말하자면 List로 선언하는게 더 바람직한 사용법이다. 왜냐하면 SOLID 원칙 중 D 의존 역전 원칙 - DIP (Dependency Inversion Princ..
Gitlab Runner 설치 레파지토리 추가curl -L "https://packages.gitlab.com/install/repositories/runner/gitlab-runner/script.rpm.sh" | sudo bashgitlab-runner 설치 dnf install gitlab-runner -y gitlab-runner 시작gitlab-runner start토큰 생성깃랩 등록gitlab-runner registerRuntime platform arch=amd64 os=linux pid=2792636 revision=66269445 version=17.3.1Running in system-mode.Enter the GitLab instance URL (fo..
로컬 llm 구현 1. ollama설치https://ollama.com/ OllamaGet up and running with large language models.ollama.com위 사이트에서 ollama 다운로드 및 설치2. ollama에서 open llm 설치cmd 창에서 ollama pull [llm 이름]명령어 실행저는 이번에 새로나온 gemma2를 사용할 예정이기 때문에ollama run gemma2:9b로 설치 진행하였습니다.3. 메모리 기능 추가from langchain_community.llms import Ollamafrom langchain.memory import ConversationSummaryBufferMemoryfrom langchain.schema.runnable import Runnab..
Spring Cloud GateWay API 인가 서버 구현 https://github.com/Sihyun3/BoardAuthServer GitHub - Sihyun3/BoardAuthServerContribute to Sihyun3/BoardAuthServer development by creating an account on GitHub.github.com스프링 클라우드 게이트웨이 인가 서버입니다.비동기식으로 구현이 되어 있으며, db는 MySQL을 활용하여 구현 되어 있습니다.
Java Spring WebFlux + MySQL CRUD 예제 Spring WebFlux 와 MySQL을 활용하여 가장 기본적인 CRUD를 만들어 볼 예정입니다. Spring WebFlux란 Spring 진영의 비동기 프레임 워크 입니다.Reactive Streams 의 Publiser 인터페이스의 구현체인 Mono 와 Flux를 사용하여 구현을 하게 됩니다.여기서 Mono란 0 ~ 1의 데이터를 처리 할 수 있고, Flux는 0 ~ N 개의 데이터를 처리 할 수 있습니다. 의존성 추가implementation "com.github.jasync-sql:jasync-r2dbc-mysql:2.2.4"implementation 'org.springframework.boot:spring-boot-starter-data-r2dbc'implementation 'org.spri..
Spring Cloud Gateway 기본적인 사용 방법 Spring Cloud 는 기본적으로 Netty를 사용하는 비동기 방식의 웹서버를 지원합니다. Spring Cloud는 기본적으로 yml을 통한 설정과 자바 코드를 통해 설정하는 두 가지 방식을 지원합니다.이번에 알아볼 것은 yml을 통해 사용하는 방법입니다. application.ymlspring: application: name: apigateway-service cloud: gateway: default-filters: - name: AuthFilter args: preLogger: true postLogger: true routes: - id: test-server uri: http:..
MySQL 데이터 복구기 프로젝트를 가오픈 후 테스트 진행 중에 사수가 table을 truncate 해 버렸다.데이터 베이스는 현재 운영중인 데이터 베이스이고 분당 약 2000회 이상의 업데이트가 진행 중 이었습니다.select 쿼리인줄 알고 truncate 문을 작동 시킨게 화근이었다. 나도 안해본 실수 인데 사수분이 실수하여 처음으로 심장 떨리는 일이 생겼다. https://hudi.blog/mysql-pit-recover/ 실수로 MySQL 데이터를 삭제했을 때 바이너리 로그를 통해 복구하기 😱 (PIT 복구)MySQL 바이너리 로그 MySQL에는 바이너리 로그라는 것이 존재한다. 바이너리 로그에는 MySQL에서 데이터베이스에서 테이블 생성, 변경 작업, 데이터 추가, 삭제, 변경 등의 ‘이벤트’가 저장되어 있hudi.b..
자바 프로세스 메모리 증가 스프링 프로젝트를 진행하는데 서버 사양이 넉넉한 편이 아니었다. 그래서 메모리가 소중한 상황이었는데, 서버를 가동 시킨 후 메모리 사용량이 점점 늘어나는 상황이었다. 최초 실행시에는 약 150mb의 메모리를 점유 하고 있었는데 점점 시간이 지나면서 300mb이상 메모리를 점유하기 시작했던 것이다. 1. 메모리 사용량 분석 방법heapdump 파일 받는 방법확장자는 hprof를 사용합니다../jmap -dump:format=b,file={파일 명} {pid} PID같은 경우에는 ps -ef | grep java를 사용하면 쉽게 가져올 수 있습니다. 메모리 분석 툴 Eclipse Memory Analyzer를 활용하여 누수를 확인 해 보았습니다.설치 링크https://eclipse.dev/mat/downlo..