Welcome! Log In Create A New Profile

Advanced

MP4 + proxy_cache/proxy_store

Alexander Moskalenko
October 24, 2011 05:00AM
Добрый день.

Есть схема 2 origin + 10 edge.
С origin все хорошо, отдает быстро.

Проблема возникает с edge.
На них довольно мало места и весь контент там держать не получится.
Хотелось сделать схему с кешированием либо дотягиванием и удалением по
atime.

Насколько я понял с кешированием не будет стримминга. Верно?

С proxy_store есть проблема с отдачей клиенту до того как файл полностью
скачался.
Файлы где-то в среднем по 15МБ.

location / {
internal;
aio on;
directio 512;
output_buffers 1 128k;

location ~* \.mp4$ {
mp4;
try_files $uri @origin;
limit_rate_after 1m;
limit_rate 200k;
}

location ~* \.flv$ {
flv;
try_files $uri @origin;
limit_rate_after 1m;
limit_rate 200k;
}
}

location /dl/ {
return 503;
location ~ ^/dl/(?P<secure_hash>[\w\-=]+,\d+)(?P<file>/.+)$ {
secure_link $secure_hash;
secure_link_md5 $secure_link_expires.$file.<passphrase>;
if ($secure_link = "") {
return 404;
}
if ($secure_link = 0) {
return 404;
}
rewrite ^ /$file last;
}
}

location @origin {
proxy_pass http://origin;
#proxy_buffering off;
proxy_ignore_client_abort on;
proxy_store on;
proxy_store_access user:rw group:r all:r;
}

Вот так все работает, но клиенту ничего не отдается пока файл полностью не
скачался (в принципе ожидаемо), но если раскоментировать proxy_buffering то
proxy_store перестает складывать файл.
# nginx -V
nginx: nginx version: nginx/1.0.8
nginx: built by gcc 4.1.2 20080704 (Red Hat 4.1.2-50)
nginx: TLS SNI support disabled
nginx: configure arguments: --prefix=/etc/nginx/ --sbin-path=/usr/sbin/nginx
--conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log
--http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid
--lock-path=/var/run/nginx.lock
--http-client-body-temp-path=/var/cache/nginx/client_temp
--http-proxy-temp-path=/var/cache/nginx/proxy_temp
--http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp
--http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp
--http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx
--with-http_ssl_module --with-http_realip_module --with-http_addition_module
--with-http_sub_module --with-http_dav_module --with-http_flv_module
--with-http_mp4_module --with-http_gzip_static_module
--with-http_random_index_module --with-http_secure_link_module
--with-http_stub_status_module --with-mail --with-mail_ssl_module
--with-file-aio --with-ipv6 --with-cc-opt='-O2 -g -m64 -mtune=generic'


Вопрос собственно как правильно реализовать схему?
_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru
Subject Author Posted

MP4 + proxy_cache/proxy_store

Alexander Moskalenko October 24, 2011 05:00AM

Re: MP4 + proxy_cache/proxy_store

Igor Sysoev October 24, 2011 05:46AM

Re: MP4 + proxy_cache/proxy_store

Maxim Dounin October 24, 2011 05:54AM

Re: MP4 + proxy_cache/proxy_store

Alexander Moskalenko October 24, 2011 06:18AM

Re: MP4 + proxy_cache/proxy_store

Kruglov Eugenie October 24, 2011 05:58AM

Re: MP4 + proxy_cache/proxy_store

Alexander Moskalenko October 24, 2011 06:20AM

Re: MP4 + proxy_cache/proxy_store

Kruglov Eugenie October 24, 2011 07:32AM

Re: MP4 + proxy_cache/proxy_store

Alexander Moskalenko October 25, 2011 10:10AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 303
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready