전체 글
-
Coroutines이란?Kotlin/코루틴 2023. 6. 20. 00:01
개요 Kotlin을 사용하며 Coroutines를 사용하여 여러 동시처리를 하기 위해 공부해보고자 합니다. Coroutine이란? 코투린은 루틴의 일종이며, Co는 with 또는 together를 뜻합니다. Routine이란 하나의 task 또는 함수로 생각하면 됩니다. 이름만 보았을때는 코틀린에서 만들어진 개념같지만 코틀린의 것만이 아니며 여러 언어에서 지원하고 있는 개념입니다. 예를 들어 javascript의 async await를 사용한 경험이 있다면 이미 코루틴을 사용해 본 경험이 있는 것입니다. 코루틴은 실행을 일시 중단했다가 다시 시작할 수 있는 컴퓨터 프로그램 구성 요소로, 협력적 멀티태스킹을 위한 서브루틴을 일반화합니다. 코루틴은 협동 작업, 예외, 이벤트 루프, 반복자, 무한 목록 및 파..
-
Redis는 싱글스레드인가?프로젝트/선착순 쿠폰 발급 시스템 2023. 6. 19. 00:01
개요 대부분 Redis는 Single Thread라고 알고 있으며, 저 또한 그렇게 이해하고 있습니다. 이런 배경지식으로 병렬 프로그래밍 환경에서 원자성(Atomic)을 보장하기 위해 사용하기도 하였습니다. 하지만 종종 다음과 같은글들을 만날 수 있습니다. https://medium.com/javarevisited/go-crazy-is-redis-single-threaded-or-multi-threaded-96fe8ff99ab9 Go crazy, is Redis single-threaded or multi-threaded? For early programmers, Redis is single-threaded, no doubt about it. So why do many friends have doubts..
-
선착순 쿠폰 발급 시스템 성능테스트프로젝트/선착순 쿠폰 발급 시스템 2023. 6. 18. 00:01
개요 모든 구현이 끝났고 성능테스트만 남게 되었습니다. 성능테스트는 nGrinder로 진행할 예정입니다. nGrinder Script import static net.grinder.script.Grinder.grinder import static org.junit.Assert.* import static org.hamcrest.Matchers.* import net.grinder.script.GTest import net.grinder.script.Grinder import net.grinder.scriptengine.groovy.junit.GrinderRunner import net.grinder.scriptengine.groovy.junit.annotation.BeforeProcess import n..
-
[AWS] Amazon API Gateway란?AWS 2023. 6. 17. 00:01
Amazon API Gateway란? Gateway는 컴퓨터 네트워크에서 서로 다른 통신망을 사용하는 장치들의 입구 역할을 하는 네트워크 포인트를 뜻합니다. 즉, API로 도달하기 위한 통로(정문/대문)입니다. 클라이언트에서 서버를 호출할때 프록시의 역할을 수행하며 이를 통해 하나의 endpoint(예를들어 https://my-example-gateway/)를 바라보게 해줍니다. AWS에서 제공하는 완전 관리형 서비스이며, 애플리케이션의 정문 역할을 하여 백엔드 서비스 및 리소스와 안전하고 효율적으로 연결할 수 있도록 합니다. 또한 트래픽관리를 해주기 때문에 수십만 개의 동시 API 호출을 처리할 수 있습니다. 왜 Amazon API Gateway를 사용할까? 클라이언트에서는 다양한 도메인(상품/결제/회..
-
Throwable 클래스란?Java 2023. 6. 16. 00:01
개요 Exception에 대해 알아보던 중 CheckedException, UnCheckedException으로만 구분 짓곤 했었는데, Throwable이란 클래스가 종종 보이게 되어 확실하게 정리하고자 합니다. Throwable 클래스란? Throwable은 Java 언어의 모든 오류(Error Class) 및 예외(Exception Class)의 최상위(root) 클래스입니다. Error는 프로그램의 회복을 기대하지 않는 치명적인 예외입니다. 예를 들어 IOError, OutOfMemoryError 등이 있습니다. Exception은 프로그램 회복을 기대하는 예외입니다. IOException, RuntimeException 등이 있습니다. 참고자료 https://docs.oracle.com/javas..
-
Java Executors - ScheduledExecutorServiceJava/Executor Service 2023. 6. 15. 00:01
개요 Socket을 Connect 하고 5분 후 timeout을 발생시키기 위해 ScheduledExecutorService를 활용하게 되었고, 이에 대해 자세하게 알아보고자 합니다. Executor 인터페이스 동시에 여러 요청을 처리해야 하는 경우 매번 새로운 쓰레드를 만드는 것은 비효율적입니다. 따라서 쓰레드를 미리 만들어두고 재사용하는 Thread Pool이라는 개념이 등장하게 되었고 Executor는 쓰레드 풀의 구현을 위한 인터페이스입니다. public interface Executor { void execute(Runnable command); } 쓰레드는 크게 작업의 등록과 실행으로 나누어집니다. 이때 Executor는 등록된 작업(Runnable)을 실행하기 위한 인터페이스이며, 작업의 실..
-
2장 - 단위 테스트란 무엇인가?테스트코드(Test Code)/단위테스트 - 생산성과품질을위한 단위테스트원칙과패턴 2023. 6. 14. 00:01
2장에서 다루는 내용 단위 테스트란? 공유 의존성, 비공개 의존성, 휘발성 의존성 간의 차이점 단위 테스트의 두 분파: 고전파와 런던파 단위 테스트, 통합 테스트, 엔드 투 엔드 테스트의 차이점 단위 테스트의 정의 작은 코드 조각을 검증하고, 빠르게 수행하고, 격리되고 자동화된 테스트 이때 격리 문제는 단위 테스트의 고전파와 런던파를 나누는 차이입니다. 격리는 테스트를 위해 하나의 클래스가 다른 클래스와 협력해야 하는 경우 이를 Mock으로 대체할지 실제 객체를 활용할지에 대한 이야기입니다. 런던파에서는 하나의 클래스가 다른 클래스 또는 여러 클래스에 의존하면 이 모든 의존성을 테스트 대역으로 대체해야 합니다. 즉, 외부 영향과 분리하여 테스트 대상 클래스에만 집중할 수 있어야 합니다. 이 방법은 장점으..
-
[AWS] SQS DLQ 설정하기AWS 2023. 6. 13. 00:01
DLQ란 무엇인가? DLQ(Dead Letter Queue)는 소프트웨어 시스템에서 오류로 인해 처리할 수 없는 메시지를 임시로 저장하는 특수한 유형의 메시지 대기열입니다. DLQ는 왜 사용할까요? 전송된 메시지가 잘못된 경우 메시지는 DLQ로 이동합니다. 하드웨어, 소프트웨어 및 네트워크 상태로 인해 전송된 데이터가 손상될 수 있습니다. 예를 들어, 하드웨어 간섭으로 인해 전송 중에 일부 정보가 약간 변경됩니다. 예상치 못하게 데이터가 손상되면 수신자가 메시지를 거부하거나 무시할 수 있습니다. 수신 소프트웨어에서 발신자가 인식하지 못하는 변경 사항이 발생한 경우에도 메시지가 DLQ로 이동될 수 있습니다. 예를 들어 수신 소프트웨어에서 message_name이라는 필드가 message_names로 변경되..