class Solution { public int[] sortedSquares(int[] nums) { int[] result = new int[nums.length]; int resultIndex = 0; int smallestIndex = 0; int smallestNumber = 0; int leftIndex = 0; int rightIndex = 0; for (int i = 0; i = nums.length) { //right 먼저 소진 result[resultIndex] = nums[leftIndex]; leftIndex--..
class LFUCache { private final int capacity; // Map cache = new HashMap(); // Map frequencyMap = new HashMap(); // > Map> accessSequenceMap = new HashMap(); // : 현존하는 frequency 를 저장 Set frequencySet = new HashSet(); public void expireCache() { Integer smallestFrequency = null; for (Integer frequency : frequencySet) { if (smallestFrequency..

DynamoDB Stream 은 Item 의 변경이 생겼을때 변경에 대한 Record 가 Stream 으로 전달되고, AWS Lambda , Kinesis Client 등으로 Record 를 전달 받아 Process 할 수 있는 기능이다. kinesis client version => com.amazonaws:amazon-kinesis-client:1.14.4 Kinesis Client 를 사용하여 Stream Record 를 전달받는 경우, 아래와 같이 CheckPointer 를 사용하여 전달받은 Record 처리를 완료했다는 것을 알리게 된다. @Override public void processRecords(List list, IRecordProcessorCheckpointer iRec..
Spring MVC (Kotlin) + Undertow 를 사용한 운영 서버에서 아래와 같이 500 응답을 받았지만 서버에는 관련된 로그가 남아있지 않음.{ "timestamp" : 1727658994786, "status": 500, "error": "Internal Server Error", "message": "Internal Server Error", "path": "/search"} 예외가 발생한 부분은 Kotlin 에서 Non Null 로 정의된 필드에 DB 에서 불러온 데이터를 맵핑할때 null 값이 할당되어 MissingKotlinParameterException 이 발생한 것으로 추정됨. 해당 예외가 아닌 다른 예외들은 로컬에서 로그가 남고 있어서 어느 부분에서 차이..

운영중인 서버에서 CurrentThreadBusy 메트릭이 튀기 시작하였다. 특징은 순간적으로 Spike 를 쳤다가 다시 정상 범위로 돌아가고 간헐적으로 여러 서버에서 튄다는 것이다.tomcat thread 들이 어느 stack trace 에서 busy 상태로 남아있는지 확인하기 위하여 0.5초 마다 currentThreadbusy 값을 확인하면서 임계치를 초과한경우 thread dump 를 생성하도록 스크립트를 작성하여 배포하였다. #!/bin/bashCRITICAL_VALUE=20while [true]do sleep 0.5 CURRENT_THREAD_BUSY=`curl -s http://127.0.0.1:9403 | grep'catalina_threadpool_currentthreadbusy' | a..

작은 파란색 원 : Oracle 문서에서는 regular young-only collection 이라고 표현, Young 영역에 대한 GC 발생 (STW) 작은 분홍색 원 : Oracle 문서에서는 multiple mixed colletions 이라고 표현, Young 과 Old 영역 모두에 대한 GC 발생 (STW) 원의 크기는 STW 의 소요 시간과 비례한다. G1GC 는 regular young-only collection 만 주기적으로 진행 GC 로그 상 Eden 영역이 가득 찼을때 regular young-only collection 이 트리거되는것으로 보임 regular young-only collection 만 진행하다가 Old 영역의 사용량이 임계치에 도달하면 Initial Mark 단계를..
운영 중인 서버에서 ConcurrentModificationException 가 발생하여 원인 파악을 시작하였다. 예외가 발생한 코드 재현 Map reduce = IntStream.range(0, 100) .parallel() .mapToObj((num) -> { Map map = new HashMap(); map.put(num, num); return map; }) .reduce(new HashMap(), (a, b) -> { a.putAll(b); return a; }); 에러가 발생한 로직을 간단하게 요약하면 위와 같이 정리가 되는데 운영 코드에서는 mapToObj 부분에서 I/O 를 실행하고 있다. I/O 를 Parallel 하게 실행하기 위하여 Stream 의 Parallel 을 사용하고 있다...

ExecutorService executorService = Executors.newFixedThreadPool(3); Stream.of(3, 2, 1) .map((i) -> CompletableFuture.supplyAsync(() -> { try { System.out.println(Thread.currentThread().getName() + " : start"); Thread.sleep(i * 1000L); System.out.println(Thread.currentThread().getName() + " : end"); } catch (InterruptedException e) { throw new RuntimeException(e); } return i; }, executorService)) ..
현상 Docker 이미지로 만들어져있는 Zookeeper 를 구성할때 아래와 같은 에러가 발생하고 zookeeper cli 로 /get 를 해보아도 timed out 이 발생 2023-07-27 09:18:07,435 [myid:3] - WARN [QuorumPeer[myid=3]/0:0:0:0:0:0:0:0:2181:QuorumCnxManager@584] - Cannot open channel to 2 at election address /10.0.0.1:3888 원인 Zookeeper 는 아래와 같이 3개의 포트를 사용한다. 2181 : Client 가 zookeeper 에 접근하기 위한 포트 2888 : Node 간의 통신에 사용. Follower 커넥션에 사용됨. (설정 파일에 따라 달라질 수 있..
- Total
- Today
- Yesterday
- GlobalFilter
- custom config data convertion
- reative
- circurit breaker
- reactor
- mariadb-connector-j
- Lazy
- RouteDefinition
- wait()
- notifyAll()
- DyanomoDB
- Flux
- HashMap
- RoutePredication
- aurora
- dynamodb
- notify()
- N+1
- rate limit
- getBoolean
- ResultSet
- msyql-connector-java
- AbstractMethodError
- MariaDB
- mariada-connector
- router
- spring cloud gateway
- referencedColumnName
- ConcurrentHashMap
- Seperate Chaining
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |