Nginx作为缓存服务_分片请求

Nginx作为缓存服务_分片请求

1、大文件分片请求语法

Syntax:

slice size;

Default:

slice 0;

Context:

http, server, location

 

语法解释:

Sets the size of the slice. The zero value disables splitting responses into slices. Note that a too low value may result in excessive memory usage and opening a large number of files.

In order for a subrequest to return the required range, the $slice_range variable should be passed to the proxied server as the Range request header field. If caching is enabled, $slice_range should be added to the cache key and caching of responses with 206 status code should be enabled.

Embedded Variables

The ngx_http_slice_module module supports the following embedded variables:

$slice_range

the current slice range in HTTP byte range format, for example, bytes=0-1048575.

 

2、大文件分片请求模型图

 

3、大文件分片请求优缺点

(1)优点

       每个子请求收到的数据都会形成一个独立的文件,一个请求断了,其他请求不会收到影响。

 

(2)缺点

       当文件很大或者slice设置很小时,可能会导致文件描述符耗尽等情况。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值