Working
-
Apache HttpClient5Working 2021. 7. 20. 19:11
1. 소개 - Http/2.0 지원, Async기반으로 재탄생 - 기존 구현체와 호환X - 여러가지 비동기 방식 - Future - FutureCallback 2. 구현 - HttpCore - 실질적 HTTP 요청과 응답 처리 - 필수 기능만 포함 - 핵심 구현체 IOReactor - NIO Socket & Selector Wrapper - 기본 worker 쓰레드 수 : cpu core 수 - Worker들에 순차적으로 IO처리 할당 - HttpClient - 클라이언트 부가 기능(쿠키, 인증, 캐싱) - 요청과 응답 처리는 Core에 위임 https://hc.apache.org/httpcomponents-client-5.1.x/index.html
-
Armeria, gRPC, Zipkin, ELK 조합 굿Working 2021. 7. 15. 15:19
MSA - Front-Service - Aggregation-Service - Backend-Micro-Service 특정 - 비동기 지원(Courutine) - 분산 Tracing(pinpoint, Zipkin) - 요청이 가볍고 빠름(gRPC + Protobuf) 빠른 개발 속도 - Armeria + gRPc - 보일러 플레이팅 -> 팀내 규격확 gRPC 약점 - 제한된 브라우저 지원 - 사람이 읽을 수 없음 - 아메리아와 함께 사용함으로서 다양한 MimeType지원, 자동 문서화 가능 - 자동으로 Protobuf기반 문서화 및 Swagger처럼 테스트 가능(DocService) graphQL Backend Service Aggregation - 각 Client가 직접 gQL을 호출 - 어떤 클라이언..
-
[우아콘2020] 수십억건에서 QUERYDSL 사용하기Working 2021. 3. 8. 14:13
www.youtube.com/watch?v=zMAX7g6rO_Y 1. 워밍업 - extends, implements 사용하지 않기 -> 대신 QueryDslRepositorySupport 상속, JPAQueryFactory 빈 등록 -> JpaQueryFactory만 있으면 QueryDsl은 사용할 수 있다! - 동적 쿼리 -> 어떤 쿼리인지 예상하기 어렵다 -> BooleanExpression - null 반환시 자동으로 조건에서 제거된다. 2. 성능개선 - SELECT - querydsl exist 금지 - exist는 조건에 부합하는 row 1개만 찾으면 바로 쿼리 종료 하지만 count는 끝까지 찾는다 - querydsl의 exist는 내부적으로 count를 사용 - 실제로 구현해보자! - lim..
-
컬렉션 조회 최적화(oneToMany)Working/jpa 성능 최적화 2021. 3. 2. 19:01
- v1 : Entity 직접 노출 Order -> List -> item별 name (lazy loading 초기화) - v2 : DTO로 변환 리턴 DTO 안에 Entity가 Wrapping 되어있다. OrderItem 도 DTO로 바꿔야 됨 결과 List 안에 또 List가 있으면 N^2으로 쿼리가 늘어남 컬렉션 경우에도 Fetch Join으로 최적화 가능 - v3 : Fetch Join 원하지 않게 join이 많이 됨 distinct o 추가로 사용하면 유니크하게 나옴 sql 쿼리는 1번만 요청한다. 단점 - 페이징 불가능 - v3.1 : 컬렉션을 페치조인 하면 페이징 불가 1:N 조인 -> 데이터가 N개가 된다, 데이터는 N을 기준으로 페이징이 됨 -> 1을 기준으로 하고싶다. 1. xToOne..
-
지연 로딩과 조회 성능 최적화Working/jpa 성능 최적화 2021. 3. 2. 18:08
xToOne(ManyToOne, OneToOne) Order Order -> Member Order -> Delivery 양방향 연관관계가 걸리는 컬럼들 -> @JsonIgnore 옵션을 한곳에 주어야 한다. @ManyToOne(fetch=LAZY) -> ByteBuddyInterceptor() 가짜 프록시 객체를 넣어둠 -> 접근 할때 db 실제 조회 Jackson DataType Hibernate5 - 지연 로딩 -> null(옵션 조절 해서 조회 하게도 가능) - 불필요 엔티티 외부 노출 X - 이 모듈을 따로 사용하기 보다는 DTO로 변경해서 반환하는게 best Lazy-Loading - 너무 많은 테이블을 조회 해야 하는 경우 중요한 성능 문제 ORDER -> SQL 1번 -> 결과 row 2개..
-
emptyDir, PV/PVCWorking/k8s 2021. 2. 26. 17:54
- emptyDir - 컨테이너들 간에 공유할수 있는 공간 - 일시적 사용 목적의 데이터 - hostPath - pod들이 올라가있는 Node의 Volume을 공통으로 사용하는 것 - 팟들이 죽어도 볼륨은 사라지지 않음 - 팟이 뜨는 Node가 달라지면 노드 볼륨을 새로 만들어줘야 해서 비추천 - PVC/PV - pod 에 영속성 있는 볼륨을 제공하기 위한 개념 - Persistent Volume - Pod은 pvc를 통해서 pv에 연결함 - pvc 까지 유저 영역 / pv는 admin 영역
-
ConceptsWorking/istoi 2021. 2. 24. 11:33
1. What is Istio? - 클라우드 플랫폼은 DevOps팀에 부담을 준다. - MSA 추세 - 서비스를 연결, 보안, 제어, 관찰 하게 해준다. 2. What is a service mesh? - 마이크로 서비스 어플리캐이션 간의 상호 작용 솔루션 - 검색, 로드밸런싱, 장애 복구, 메트릭, 모니터링, A/B 테스트, canary 롤아웃, 속도 제한, 접근 제어, 인증 - 서비스 메쉬 전체에 대한 행동적 통찰력과 운영적 통제력 제공 3. Why use istio? - 서비스 코드 변경이 거의 없이 서비스의 네트워크 구축을 SW 레벨에서 쉽게 제어할수 있게 한다. - 마이크로 서비스간 모든 네트워크 통신을 가로채는 특수 사이드카 프록시를 환경 전체에 배포하여 서비스에 istio지원을 추가한다음, ..