Hello!
Over the last few months, we (a small team of developers including me
and Jan Prachař, both from CDN77) developed a missing feature for the
proxy caching in Nginx. We are happy to share this feature with the
community in the following patch series.
We serve a large number of files to an im
# HG changeset patch
# User Jiří Setnička
# Date 1643385660 -3600
# Fri Jan 28 17:01:00 2022 +0100
# Node ID ca39d3040e2a9c37eb0940c5880fead78d5d137c
# Parent c0a432c0301b89816ec379a7e5a754a4777008b2
ngx core - obtain number appended to the temp file name
diff --git a/src/core/ngx_file.c b
# HG changeset patch
# User Jiří Setnička
# Date 1643385660 -3600
# Fri Jan 28 17:01:00 2022 +0100
# Node ID 64ff9068a0bd89712a0ae6fc589a881869663642
# Parent ca39d3040e2a9c37eb0940c5880fead78d5d137c
ngx core - ensure that tempfile number never be 0
To be able to use 0 as special value mean
# HG changeset patch
# User Jiří Setnička
# Date 1643385660 -3600
# Fri Jan 28 17:01:00 2022 +0100
# Node ID 535e503156cf141bf9471895468423e82f68c8bb
# Parent 64ff9068a0bd89712a0ae6fc589a881869663642
Cache: Shared memory for tempfile nodes
New option for `proxy_cache_path`: `tf_zone=name:si
# HG changeset patch
# User Jiří Setnička
# Date 1643385660 -3600
# Fri Jan 28 17:01:00 2022 +0100
# Node ID 2488cf77a1cc6c7f48696816f085c71e49355b72
# Parent 535e503156cf141bf9471895468423e82f68c8bb
Cache: tf_node for tracking opened tempfile
Lookup and cleanup.
diff --git a/src/http/ngx_
# HG changeset patch
# User Jiří Setnička
# Date 1643385660 -3600
# Fri Jan 28 17:01:00 2022 +0100
# Node ID 76c1a836b1de47cb16b636b585526e25574e0f58
# Parent 2488cf77a1cc6c7f48696816f085c71e49355b72
http upstream & file_cache: store temp file number and length in tf_node
Number could be us
# HG changeset patch
# User Jiří Setnička
# Date 1643385660 -3600
# Fri Jan 28 17:01:00 2022 +0100
# Node ID 10e917f6ddb56c338f9597b76a68cdbf21d8f8e8
# Parent 5e3013a56643a9f8d26ea0e5882a1aa986c51903
Tempfiles: Wait handlers
First commit in sequence of commits which adds ability to serve mu
# HG changeset patch
# User Jiří Setnička
# Date 1643385660 -3600
# Fri Jan 28 17:01:00 2022 +0100
# Node ID 5e3013a56643a9f8d26ea0e5882a1aa986c51903
# Parent 76c1a836b1de47cb16b636b585526e25574e0f58
Configuration for tempfiles serving
New directives:
* proxy_cache_tempfile on/off -- a
# HG changeset patch
# User Jiří Setnička
# Date 1643385660 -3600
# Fri Jan 28 17:01:00 2022 +0100
# Node ID 24453fd1ce204f361748c32e3c271d9e6fc7c9eb
# Parent 101a15e01c313f1327937c84fbf143f875d868de
Tempfiles: Sending data from tempfile
This commit adds mechanism for sending only a part of
# HG changeset patch
# User Jiří Setnička
# Date 1643385660 -3600
# Fri Jan 28 17:01:00 2022 +0100
# Node ID 101a15e01c313f1327937c84fbf143f875d868de
# Parent 10e917f6ddb56c338f9597b76a68cdbf21d8f8e8
Tempfiles: Mechanism of opening tempfiles used for serving paralell requests
This commit ad
# HG changeset patch
# User Jiří Setnička
# Date 1643385660 -3600
# Fri Jan 28 17:01:00 2022 +0100
# Node ID bd12e8ba1af2005260e68a410e3c8927a88dac1a
# Parent 24453fd1ce204f361748c32e3c271d9e6fc7c9eb
Tempfiles: Setup event handlers in ngx_http_upstream.c
Introduced in the previous commits t
# HG changeset patch
# User Jiří Setnička
# Date 1643385660 -3600
# Fri Jan 28 17:01:00 2022 +0100
# Node ID 64a2e216aeeeb847eb0b9a83ed6e6082ade4ac9e
# Parent bd12e8ba1af2005260e68a410e3c8927a88dac1a
Tempfiles: reset c->body_start when updating a tempfile
Previously when there was an old ca
# HG changeset patch
# User Jiří Setnička
# Date 1643385660 -3600
# Fri Jan 28 17:01:00 2022 +0100
# Node ID 0e00ffe7fab3dcf3d3167851237327e5fb9e10b6
# Parent 64a2e216aeeeb847eb0b9a83ed6e6082ade4ac9e
Tempfiles: Expired tempfiles
When tempfile expires before it is downloaded we try to fire o
# HG changeset patch
# User Jiří Setnička
# Date 1643385660 -3600
# Fri Jan 28 17:01:00 2022 +0100
# Node ID 5e64af4c94860cd5cf4b9af5a265d3a087e7b735
# Parent 0e00ffe7fab3dcf3d3167851237327e5fb9e10b6
Tempfiles: Skip cached file if there is already newer tempfile
diff --git a/src/http/ngx_h
# HG changeset patch
# User Jiří Setnička
# Date 1643385660 -3600
# Fri Jan 28 17:01:00 2022 +0100
# Node ID 3cd1f04d933137153b0628819ccb251d1f57614b
# Parent 5e64af4c94860cd5cf4b9af5a265d3a087e7b735
Tempfiles: Set send_timeout inside ngx_http_cache_send
diff --git a/src/http/ngx_http_file
# HG changeset patch
# User Jiří Setnička
# Date 1643385660 -3600
# Fri Jan 28 17:01:00 2022 +0100
# Node ID 6745b619f44ea7debddfe04d9af37d1deffe89dd
# Parent 3cd1f04d933137153b0628819ccb251d1f57614b
Use cache status UPDATING when serving from tempfile
diff --git a/src/http/ngx_http_upstre
Hello!
We developed the proxy_cache_tempfile mechanism, which acts similarly to
the proxy_cache_lock, but instead of locking other requests waiting for
the file completion, we open the tempfile used by the primary request
and periodically serve parts of it to the waiting requests.
[...]
We tes
Hello!
Thanks for sharing patches. It's interesting for me and I'm going to
test it soon.
Did you already had some time to test it? I am interested in you
thoughts and results :)
For this particular patch I would suggest to reduce the scope of mutex
locking
and remove it when "serve_tempfi
Hello,
Thanks for sharing your work. Indeed, nginx currently lacks a good solution
for serving a file that's being downloaded from upstream. We tried to address
this issue a few years ago. Our solution was similar to yours, but instead
of sharing the temp file between workers, we moved the te
Hello,
I came across a situation when using X-Accel-Redirect could lead to a
segfault (tested on the latest version - hg changeset 9207:73eb75bee30f
but I believe this has been there for a long time).
It occurs only if the response with the X-Accel-Redirect header is
firstly cached (when usi
Hello,
I noticed that in some situations not all queued HTTP/2 frames may be
sent before closing the HTTP/2 connection.
This could happen when the ngx_http_v2_finalize_connection is called
with some frames in the h2c->last_out queue and with the c->write not
ready. In such situation, the GOAW
21 matches
Mail list logo