전체 글
-
Kotlin과 Java의 컴파일 순서Kotlin/Kotlin 2023. 11. 11. 00:01
개요 문득 나는 Kotlin의 컴파일과정을 잘 이해하고 있는가?라는 생각이 떠올라서 코틀린이 컴파일 되는 과정에 대해 이해해보려고 합니다. "누군가 나에게 묻는다면 이해하기 쉽게 대답할 수 있는가.." Kotlin과 JVM Kotlin은 JVM위에서 동작하기 때문에 Java의 컴파일 과정과 유사합니다. *.kt 파일, *.java 파일을 코틀린 컴파일러가 *.class 파일로 변환한다. 하지만 Java와 Kotlin 코드가 동시에 활용되는 경우에는 어떻게 될까? 코틀린 파일이 코틀린 컴파일러에 의해 .class로 변환된다. (코틀린 코드가 참조하는 Java 코드가 함께 로딩된다) Java 컴파일러가 Java 코드를 컴파일하여 .class 파일을 생성하고, Kotlin이 이미 컴파일한 .class 파일의 ..
-
Spring Boot proxy-target-class 속성Spring Framework 2023. 11. 10. 00:01
개요 관례적으로 클래스를 인터페이스로 구현하는 이유에 대해 찾아보게 되었고 이후 proxy-target-class라는 것을 알게 되었습니다. 따라서 해당 설정을 실험해보고자 합니다. application.yml spring: aop: proxy-target-class: false 기본값이 true입니다. 해당값을 false로 바꾸면 어떤 일이 일어날까요? false - Jdk Dynamic Proxy를 사용한다는 의미로 인터페이스로 구현되어 있지 않다면 AOP가 적용되지 않음! true - CGLIB가 대상 클래스를 상속받아 프락시를 구현해서 인터페이스가 없어도 된다, 클래스가 final인 경우 프락시 생성이 불가능하다. proxy-target-class 속성이란? "description": "Wheth..
-
CQRS 패턴이란?CS/데이터베이스 2023. 11. 9. 00:01
개요 CQRS 패턴이란? 왜 CQRS를 사용하는가? CQRS의 구현방법 CQRS와 Event Driven Architecture CQRS 고려사항 CQRS패턴이란? 명령(Command)과 질의(Query)의 책임(Responsebilitiy)을 분리(Segregation)한다 라는 뜻의 약자입니다. 쓰기를 위한 데이터 모델(Write Model)과 읽기를 위한 데이터 모델(Read Model)을 분리하는 패턴입니다. 보통 쓰기 모델에는 높은 데이터 정합성이 요구되며 정규화된 테이블을 설계하게 되는 경우가 많습니다. Command와 Query를 간단하게 설명할 수 있습니다. Command = 시스템의 상태를 변경하는 작업 Query = 시스템의 상태를 조회하는 작업 왜 CQRS를 사용하는가? 데이터를 쓰는..
-
[Spring Boot + Kotlin] Redis Luascript 적용프로젝트/redis 2023. 11. 8. 00:01
개요 luascript에 대한 간단한 개념을 학습 Kotlin + Spring Boot Application 환경에서 LuaScript 적용 동시성제어를 테스트코드를 통해 확인 luascript 실행 중 예외가 발생하면 어떻게 처리되는지 확인 Redis Luascript란? LuaScript란 Lua 프로그래밍 언어로 작성된 사용자 지정 스크립트를 Redis 서버 내에서 직접 실행할 수 있는 기능입니다. Atomic 한 작업으로 Redis 데이터에 대한 복잡한 작업을 수행할 수 있는 강력한 방법입니다. Transaction, Pipeline 과는 다르게 중간 결과를 조작할 수 있습니다. 예를 들어 Transaction 내부에서는 데이터를 GET해오면 null이 반환됩니다. 중간 결과인 데이터를 통해 조건..
-
[Spring Boot + Kotlin] Redis Transaction 실습프로젝트/redis 2023. 11. 7. 00:01
개요 공식문서로 알아보는 Redis Transaction에 이어 Spring Boot+ Kotlin을 활용하여 Redis Transaction 실습을 진행해보려 합니다. 테스트를 위한 데이터 세팅 @Component class LocalRedisDateSetter( private val stringRedisTemplate: StringRedisTemplate, ) { @PostConstruct fun localDataSet() { stringRedisTemplate.opsForHash().put("productItem", "104", "30") val valueOperation = stringRedisTemplate.opsForValue() valueOperation.set("test","test") }..
-
Redis Pipeline, Transaction, Lua script 차이프로젝트/redis 2023. 11. 6. 00:01
Redis Transaction이란? 여러 가지 명령어들을 처리하는 하나의 단위로 multi로 트랜잭션을 시작하고 exec를 통해 명령어들을 수행시켜 결괏값을 반환받습니다. 기존 RDB의 트랜잭션과는 조금 다른 의미를 가지고 있습니다. Redis pipeline이란? 명령어들을 모아서 한번에 서버로 전송시켜 네트워크 오버헤드를 줄이는 방안입니다. Transaction과 Pipeline 두 방법 모두 서버에 명령을 한 번만 보내는데 차이에 대해 조금 불확실하게 느껴집니다. transaction을 활용하면 모든 명령은 pipelining 되고 EXEC가 실행되면 모든 명령이 함께 실행되므로 항상 여러 명령의 원자성을 유지합니다. transaction과 pipelining은 어떻게 다를까요? Pipeline을..
-
공식문서로 알아보는 Redis pipeline프로젝트/redis 2023. 11. 5. 00:01
Redis pipeline이란? redis의 명령어들을 일괄로 처리하여 RTT(rount-trip-time)를 최적화하는 방법입니다. 개별 명령에 대해 응답을 기다리지 않고 한 번에 여러 명령을 실행하여 성능을 개선할 수 있습니다. RTT란? redis는 client-server 구조를 사용하는 TCP 서버입니다. 한마디로 클라이언트와 서버는 네트워크로 연결되고 네트워크는 매우 빠를 수도 느릴 수도 있습니다. 네트워크 지연 시간에 상관없이 패킷이 클라이언트에서 서버로 이동하고 서버에서 클라이언트로 다시 돌아와 응답을 전달하는 데는 시간이 걸립니다. 이런 시간을 RTT라고 부릅니다 만약 RTT 시간이 250ms인 경우 서버가 초당 10만개의 요청을 처리할 수 있더라도 초당 최대 4개의 요청만 처리할 수 있..
-
kafka auto commit의 위험성프로젝트/kafka 2023. 11. 4. 00:01
개요kafka auto commit에 대해 명확히 이해하고 kafka auto commit을 활용했을 때 위험성에 대해 알아보고자 합니다. auto commit이란?kafka poll()을 통해 가져온 레코드를 어디까지 읽었는지 자동으로 commit 할 수 있는 옵션인 auto.commit을 제공합니다.enable.auto.commit = trueenable.auto.commit = trueauto.commit.interval.ms = 100ms 위의 설정은 100ms 시간의 간격마다 auto commit을 수행한다는 것을 의미 합니다. 뭔가 자동으로 해준다? 편리하게 사용할 수 있을 것 같은 느낌듭니다. 예를 들어 poll()을 통해 500개의 레코드를 가져옵니다. 100ms가 지났을 때는 100개..