Skip to content

arch: Enforce Non-Blocking I/O by Strict Offloading to Virtual Threads #6

@ori0o0p

Description

@ori0o0p
  1. SPiCa 아키텍처의 핵심은 Netty의 EventLoop가 단 1ms도 멈추지 않는 것입니다.
  2. 현재 구조에서 비즈니스 로직이 복잡해질 경우(예: 범위 검색, 스냅샷 저장), I/O 스레드가 블로킹될 위험이 있습니다.
  3. 이를 원천 차단하기 위한 아키텍처적 제약 사항을 코드로 강제해야 합니다.

Specification

  • Architecture Flow:[Netty EventLoop] $\xrightarrow{\text{submit}}$ [Virtual Thread Executor] $\xrightarrow{\text{process}}$ [Biz Logic]
  • Constraint: ChannelInboundHandler의 channelRead 메서드는 오직 executor.submit() 호출만을 수행하고 즉시 리턴해야 함.

Guidelines

  • Handler Design: RedisCommandServerHandler는 로직을 수행하지 않고 Dispatcher 역할만 수행.
  • Context Propagation: 비동기 실행 시 ChannelHandlerContext가 스레드 세이프하게 전달되는지 검증.
  • Exception Handling: 가상 스레드 내부에서 발생한 예외가 Netty 파이프라인으로 적절히 전파되어 클라이언트에게 에러 응답(-ERR ...)을 보낼 수 있도록 CompletableFuture 또는 콜백 구조 적용.

Acceptance Criteria

  • 로직 처리(가상 스레드)에서 Thread.sleep(1000)을 강제로 주입해도, 다른 클라이언트의 연결 및 요청 수신(I/O 스레드)이 지연되지 않아야 함.
  • 수만 개의 동시 접속 상황에서도 Netty I/O 스레드의 CPU 점유율이 안정적으로 유지됨.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Difficulty: AdvancedComplex issue for experienced contributors.Priority: LowMinor issue that can be addressed later.Status: Openissue openType: EnhancementProposes a new feature or improvement.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions