Module ngx_http_slice_module

Module ngx_http_slice_module The ngx_http_slice_module module (1.9.8) is a filter that splits a request into subrequests, each returning a certain range of response. The filter provides more effective caching of big responses. This module is not built by d

nginx.org

 

  • ngx_http_slice_module 모듈(1.9.8)은 요청을 하위 요청으로 분할하고 각각의 응답 범위를 반환
    대용량 응답의 더 효과적인 캐싱을 제공
  • --with-http_slice_module 구성 매개변수로 활성화

 

 

slice 지시자

  • slice 지시자를 통해 응답 조각의 크기를 설정
  • slice 0 값은 응답을 조각으로 나누지 않음
  • 너무 낮은 값은 과도한 메모리 사용 및 대량 파일 열기로 이어질 수 있음
  • Range 요청 헤더 필드로 $slice_range 변수를 프록시 서버로 전달
  • 캐싱이 활성화되어 있으면 $slice_range를 캐시 키에 추가하고 206 상태 코드를 가진 응답의 캐싱을 활성화

  • 문맥 : http, server, location
  • 사용 문법
    ## 문법
    slice size;
  • 사용 예시
    ## 기본 설정
    slice 0;

 

 

slice 예제 구성

  • 응답은 1MB 캐시 가능한 조각으로 설정
    location / {
        slice             1m;
        proxy_cache       cache;
        proxy_cache_key   $uri$is_args$args$slice_range;
        proxy_set_header  Range $slice_range;
        proxy_cache_valid 200 206 1h;
        proxy_pass        http://localhost:8000;
    }

 

 

ngx_http_slice_module 모듈의 내장 변수 → $slice_range

  • HTTP 바이트 범위 형식의 현재 조각 범위
  • 예시 : bytes=0-1048575.

 

 

'Nginx > Nginx 모듈 학습' 카테고리의 다른 글

ngx_http_secure_link_module 모듈  (0) 2023.09.23
ngx_http_realip_module 모듈  (0) 2023.09.23
ngx_http_split_clients_module 모듈  (0) 2023.09.22
ngx_http_sub_module 모듈  (0) 2023.09.22
ngx_upstream_jdomain 모듈  (0) 2023.09.21

+ Recent posts