Files
llm-wiki/raw/official-docs/redis-programmability-max-execution-time.md
T

87 lines
9.9 KiB
Markdown

---
title: "official-doc / Redis Programmability — Maximum Execution Time (busy-reply-threshold, BUSY, SHUTDOWN NOSAVE)"
source_type: official-doc
url: https://redis.io/docs/latest/develop/programmability/
archive_url:
related_branches: [feature-redis-atomic-program-catalog-contract]
related_projects: [ca-skeleton]
tags: [official-doc, ca-skeleton, runtime, redis]
created: 2026-07-28
---
# Redis Programmability — Maximum Execution Time (busy-reply-threshold, BUSY, SHUTDOWN NOSAVE)
> Layer: `raw/official-docs/` — Redis 공식 개요 페이지(`develop/programmability/`, §Maximum execution time) 원문 발췌.
> 자매 문서 `[[raw/official-docs/redis-eval-scripting-atomicity]]` 의 `REDIS-EVAL-C6` `Does not prove` 가 명시한 공백(`busy-reply-threshold`/구 `lua-time-limit` 설정 이름, `BUSY` 에러, 쓰기 스크립트의 `SHUTDOWN NOSAVE` 강제 종료 조건)을 닫기 위한 dispatch.
## Parent / 활용 branch
| Branch | 이 자료가 정당화하는 결정 |
|---|---|
| [[raw/branch-notes/feature-redis-atomic-program-catalog-contract]] | atomic program 에 bounded execution(유한 실행) 규칙을 두고, 실행 시간 초과의 사후 대응(서버 설정 + 런북)을 예방 계층과 분리해 상시 병행한다 |
## 출처
- 원본 URL: https://redis.io/docs/latest/develop/programmability/
- 아카이브 URL: (미수집)
- 저자 / 조직: Redis (Redis Ltd. 공식 문서)
- 발행일: Redis 공식 reference, 최신 버전 anchor (본문에 Redis 7.0/2.6.0/5.0 버전 변경 이력 명시)
- 마지막 확인일: 2026-07-28
## 왜 저장했는지
`feature-redis-atomic-program-catalog-contract` 의 bounded execution 규칙은 "예방"(KEYS 선언·O(1)/유한 루프 설계)과 "사후 대응"(서버가 실제로 시간 초과된 스크립트를 어떻게 처리하는가)이 분리된 계약이다. 자매 문서 `redis-eval-scripting-atomicity.md``SCRIPT KILL` 이 "장시간 실행 스크립트를 중단하는 유일한 방법"이라고만 말하고 임계값 설정 이름·`BUSY` 상태·쓰기 스크립트의 예외를 확인하지 않았다(`REDIS-EVAL-C6` Does not prove). 이 문서는 정확히 그 공백 — 기본 임계값·설정 파라미터명·타임아웃 도달 후 서버 상태 전이(BUSY)·명령별 허용 여부 — 을 원문으로 닫는다.
## 핵심 인용
> [§Maximum execution time] "Scripts are subject to a maximum execution time (set by default to five seconds)."
> [§Maximum execution time] "The configuration parameter affecting max execution time is called busy-reply-threshold."
> [§Maximum execution time] "When a script reaches the timeout threshold, it isn't terminated by Redis automatically."
>
> [§Maximum execution time] "Doing so would violate the contract between Redis and the scripting engine that ensures that scripts are atomic."
> [§Maximum execution time] "It starts accepting commands again from other clients but will reply with a BUSY error to all the clients sending normal commands. The only commands allowed in this state are SCRIPT KILL, FUNCTION KILL, and SHUTDOWN NOSAVE."
> [§Maximum execution time] "If the script had already performed even a single write operation, the only command allowed is SHUTDOWN NOSAVE that stops the server without saving the current data set on disk (basically, the server is aborted)."
## Claims Extracted / 추출된 주장
| Claim ID | Claim (이 자료가 직접 말하는 것) | Evidence quote | Strength | Applies to | Does not prove |
|---|---|---|---|---|---|
| REDIS-PROG-C1 | 스크립트(및 함수)는 기본 5초의 최대 실행 시간 제한을 가지며, 이 값을 제어하는 설정 파라미터 이름은 `busy-reply-threshold`이다(밀리초 단위로 `redis.conf` 또는 `CONFIG SET`으로 변경 가능) | "Scripts are subject to a maximum execution time (set by default to five seconds)." / "The configuration parameter affecting max execution time is called busy-reply-threshold." | `official-vendor-doc` | 모든 EVAL/EVALSHA/FCALL 스크립트·함수 실행의 기본 timeout 설정 | 구 파라미터 이름 `lua-time-limit` 은 본 페이지에 등장하지 않음 — 이름 변경 이력(구명→신명)은 이 자료만으로 증명되지 않음, 별도 changelog/config 문서 확인 필요 |
| REDIS-PROG-C2 | 스크립트가 임계값을 초과해도 Redis 는 자동으로 스크립트를 강제 종료하지 않는다 — 그렇게 하면 스크립트가 원자적이라는 Redis-스크립팅 엔진 간 계약을 위반하게 되기 때문이다 | "When a script reaches the timeout threshold, it isn't terminated by Redis automatically." / "Doing so would violate the contract between Redis and the scripting engine that ensures that scripts are atomic." | `official-vendor-doc` | 시간 초과된 모든 스크립트/함수 실행 일반 | half-written 상태를 실제로 어떤 내부 메커니즘(예: 인터프리터 훅 지점)으로 방지하는지 구현 detail 은 제공하지 않음 |
| REDIS-PROG-C3 | 임계값 초과 후 서버는 다른 클라이언트의 일반 명령에 `BUSY` 에러로 응답하며, 이 상태에서 허용되는 명령은 `SCRIPT KILL`, `FUNCTION KILL`, `SHUTDOWN NOSAVE` 뿐이다. 그중 `SCRIPT KILL`/`FUNCTION KILL` 은 아직 쓰기를 하지 않은(read-only) 스크립트에만 사용 가능하다 | "It starts accepting commands again from other clients but will reply with a BUSY error to all the clients sending normal commands. The only commands allowed in this state are SCRIPT KILL, FUNCTION KILL, and SHUTDOWN NOSAVE." | `official-vendor-doc` | timeout 이후 BUSY 상태의 서버에 대한 클라이언트 명령 허용 목록 | `maxmemory` 초과와 이 BUSY 상태의 상호작용은 본 페이지에서 확인되지 않음(§Usage Boundaries 참조) |
| REDIS-PROG-C4 | 스크립트가 이미 쓰기 연산을 한 번이라도 수행했다면, 그 시점부터 허용되는 명령은 `SHUTDOWN NOSAVE` 뿐이며 이는 현재 데이터셋을 디스크에 저장하지 않고 서버를 정지시킨다(사실상 서버 강제 종료) | "If the script had already performed even a single write operation, the only command allowed is SHUTDOWN NOSAVE that stops the server without saving the current data set on disk (basically, the server is aborted)." | `official-vendor-doc` | 쓰기를 이미 수행한 시간 초과 스크립트/함수에 대한 유일한 복구 경로 | `SHUTDOWN NOSAVE` 이후 재시작 절차, replica/cluster 환경에서의 failover 영향은 본 페이지에 없음 |
## Usage Boundaries / 적용 경계
- **이 자료가 직접 증명하는 것**:
- `REDIS-PROG-C1`: 기본 5초 실행 시간 제한 + 설정 파라미터명 `busy-reply-threshold`
- `REDIS-PROG-C2`: 시간 초과 시 Redis 가 스크립트를 자동 종료하지 않음(원자성 계약 보호 목적)
- `REDIS-PROG-C3`: 시간 초과 후 `BUSY` 에러 상태 + 허용 명령(`SCRIPT KILL`/`FUNCTION KILL`/`SHUTDOWN NOSAVE`) + read-only 스크립트만 `SCRIPT KILL`/`FUNCTION KILL` 로 중단 가능
- `REDIS-PROG-C4`: 쓰기를 수행한 스크립트는 `SHUTDOWN NOSAVE` 만 허용(서버 강제 종료)
- **이 자료가 증명하지 않는 것**:
- **구 파라미터 이름 `lua-time-limit`** — 본 페이지에 전혀 등장하지 않는다(self-grep 부재 확인, fabrication 아님). `busy-reply-threshold` 가 그 후신이라는 이름 변경 이력은 별도 Redis changelog/config 문서 확인 필요.
- **`maxmemory` 와의 상호작용** — "maxmemory 초과 상태에서 추가 메모리를 쓰는 첫 write 명령이 스크립트를 abort 시킨다"는 서술은 본 페이지에 없다(self-grep 부재 확인). `maxmemory-policy` 자체의 일반 의미(예: `noeviction` 이 write 를 에러로 거부)는 `[[raw/official-docs/redis-key-eviction-maxmemory-policy]]` 가 별도로 다루지만, 그 문서 역시 "스크립트 abort" 를 스크립트 맥락에서 명시하지는 않는다 — 두 자료를 합쳐도 "maxmemory 초과 → 스크립트 abort" 인과관계 자체는 증명되지 않는다.
- `SHUTDOWN NOSAVE` 이후의 클러스터/replica 복구 절차, Sentinel/failover 와의 상호작용
- Redis Functions(FUNCTION) 고유의 timeout 규칙 차이 — 이 페이지는 스크립트와 함수를 동일 취급하는 서술("SCRIPT KILL, FUNCTION KILL")만 제공, 세부 차이는 없음
- **내 프로젝트(ca-skeleton)에 적용하려면 추가 확인이 필요한 것**:
- 운영 환경에서 `busy-reply-threshold` 를 기본 5초에서 조정할지 여부와 그 근거(레이턴시 SLO 대비)
- `BUSY` 상태 발생 시 알림/런북 설계 — 이 페이지는 서버 동작만 규정하고 운영 대응 절차는 제공하지 않음
- `maxmemory` 초과와 스크립트 실행의 실제 상호작용은 별도 실험/공식 자료로 검증 필요(현재 미확인 상태로 branch 결정에 반영하지 않을 것)
## 메모
- 이번 dispatch 로 자매 문서 `redis-eval-scripting-atomicity.md``REDIS-EVAL-C6` Does not prove 공백 중 `busy-reply-threshold`/`BUSY`/`SHUTDOWN NOSAVE` 3개는 닫혔다. `lua-time-limit`(구명)과 `maxmemory` 상호작용 2개는 이 페이지에도 없어 여전히 미확인 — 필요하면 별도 config 레퍼런스 또는 릴리스 노트 fetch 후보.
- 추가로 봐야 할 동일 출처 페이지: Redis `redis.conf` 공식 주석(파라미터 changelog), maxmemory 공식 문서의 스크립트 상호작용 여부 재확인.
## Related / 관련
- [[raw/official-docs/redis-eval-scripting-atomicity]] — 이 문서가 닫는 공백을 남긴 자매 문서(`REDIS-EVAL-C6`)
- [[raw/official-docs/redis-key-eviction-maxmemory-policy]] — `maxmemory-policy` 일반 의미(스크립트 맥락은 아님)
- [[raw/official-docs/redis-lua-api-determinism-replication]] — 같은 programmability 문서군, sandbox/replication 세부
- [[raw/official-docs/redis-functions-library-deployment]] — Redis Functions(FUNCTION LOAD 등) 배포 조건
- 이 자료를 인용한 wiki 요약: `[[wiki/concepts/...]]` (생성 시)