-
이코에코(Eco) ext-authz 추가 테스트: Redis 병렬 연결 활성화 (vCPU 2, io-threads 2)이코에코(Eco²)/Auth Offloading (ext-authz) 2025. 12. 17. 04:32
추가 테스트: Redis io-threads 활성화
Client 1 ──┐ Client 2 ──┼──→ [ Command Queue ] ──→ [ Main Thread ] ──→ 순차 실행 Client 3 ──┘ (FIFO) (싱글 스레드)
앞서 ext-authz 성능 튜닝에서 Redis 싱글 스레드의 한계를 언급했다.
Redis 6.0+부터 io-threads를 지원하므로, I/O 병렬화로 성능 개선이 가능한지 테스트했다.
그렇다고 Command Queue가 병렬로 쌓이진 않는다. 명령 실행은 단일 스레드에서 순차실행이 되는 걸 유의하고 진행하자.
io-threads가 CPU 경합없이 동작하더라도 네트워크/직렬화 병목까지만 완화가 가능하다.
테스트 환경
Redis 노드 t3.medium (2 vCPU, 4GB RAM) Redis 버전 7.4.1 (Bitnami Helm Chart) io-threads 2 (vCPU 수와 동일) io-threads-do-reads yes Memory 4 GB Architecture Sentinel (1 Master + 2 Replica) 변경 설정
commonConfiguration: |- maxclients 50000 tcp-keepalive 20 # 300 → 20 timeout 40 # 0 → 40 io-threads 2 # NEW io-threads-do-reads yes # NEW
결과: p99 Latency 급증

p99 Latency 0.2-0.4s 0.92-1.47s +365% 증가
실측 데이터 분석
1. Redis 공식 권장 요건 미충족
Redis 공식
redis.conf에는 다음과 같이 명시되어 있다:By default threading is disabled, we suggest enabling it only in machines that have at least 4 or more cores, leaving at least one spare core.
Using more than 8 threads is unlikely to help much.So for instance if you have a four cores boxes, try to use 2 or 3 I/O threads, if you have a 8 cores, try to use 6 threads.
최소 CPU 4코어 이상 2 vCPU ❌ Spare Core 1개 이상 0개 ❌ io-threads 수 (4코어 기준) 2~3개 2개 (2 vCPU에서) ❌ 2 vCPU 환경은 io-threads 최소 요건(4코어)을 충족하지 못한다.
2. io-threads 처리 비율 저조
$ kubectl exec -n redis dev-redis-node-0 -c redis -- redis-cli INFO statstotal_reads_processed:1120822 total_writes_processed:1107636 io_threaded_reads_processed:146975 io_threaded_writes_processed:243342 instantaneous_ops_per_sec:1289Read 병렬화율 146,975 / 1,120,822 13.1% ⚠️ 낮음 Write 병렬화율 243,342 / 1,107,636 22.0% ⚠️ 낮음 처리량 1,289 ops/sec - - 전체 I/O의 13-22%만 io-threads가 처리: 병렬화 효과 미미, 오버헤드만 발생
3. CPU 오버헤드 (컨텍스트 스위칭)
$ kubectl exec -n redis dev-redis-node-0 -c redis -- redis-cli INFO cpuused_cpu_sys:36.814051 used_cpu_user:97.827366 used_cpu_sys_main_thread:32.615280 used_cpu_user_main_thread:41.064764메인 스레드 CPU 32.62 + 41.06 73.68 CPU초 전체 CPU 36.81 + 97.83 134.64 CPU초 io-threads 오버헤드 134.64 - 73.68 60.96 CPU초 (+45.2%) 2 vCPU에서 3개 스레드(메인 + io-thread × 2)가 경쟁하며 컨텍스트 스위칭 폭증
4. Slowlog 증거
$ kubectl exec -n redis dev-redis-node-0 -c redis -- redis-cli SLOWLOG GET 20# 명령어 실행 시간 클라이언트 정상 기대값 3 hello17.1ms 127.0.0.6:51771 <1ms 2 hello34.3ms 127.0.0.6:57513 <1ms 1 exists blacklist:6e0abda9-...11.3ms 127.0.0.6:58923 <1ms 0 INFO53.2ms sentinel-ddb60715-cmd <1ms
단순 명령들이 10-53ms 지연 → io-threads 스케줄링 병목으로 메인 스레드 대기 시간 증가5. 연결 상태
$ kubectl exec -n redis dev-redis-node-0 -c redis -- redis-cli INFO clientsconnected_clients:773 maxclients:50000 blocked_clients:0연결된 클라이언트 773 최대 클라이언트 50,000 차단된 클라이언트 0
6. 추가 통계
keyspace_misses:1021798 total_connections_received:55473 rejected_connections:0Keyspace Miss 1,021,798 Blacklist 조회 (대부분 miss = 정상 토큰) 총 연결 수신 55,473 - 거부된 연결 0 연결 제한 없음 io-threads 활성화 조건
최소 4 vCPU Redis 공식 권장 Spare Core 1개 이상 메인 스레드 전용 코어 확보 권장 io-threads 수
4 2~3 8 6 8+ 최대 8
2 vCPU 환경에서는 io-threads 비활성화(default)를 유지하기로 결정했다.
싱글 스레드 Redis가 오히려 컨텍스트 스위칭 없이 안정적인 성능을 제공한다.Reference
'이코에코(Eco²) > Auth Offloading (ext-authz)' 카테고리의 다른 글
이코에코(Eco²) ext-authz 성능 튜닝: Redis PoolSize, HPA (0) 2025.12.15 이코에코(Eco²) ext-authz: AuthN/AuthZ 검증 엔진 Stress Test (0) 2025.12.14 이코에코(Eco²) Auth Offloading: 도메인 공통 모듈 제거 (0) 2025.12.13