• Nils Goroll's avatar
    Optimize 304 template object copying · 98b6b954
    Nils Goroll authored
    When copying a stale object after a 304 revalidation, we iterated over
    it and allocated new storage for each storage segment.
    
    So, at best, we kept the fragmentation of the existing object, or made
    it even worse. This is particularly relevant when the existing object
    was created from a chunked response, in which case the original
    segments might have been particularly small and, consequently, many in
    number.
    
    Because we wait for the stale object to complete, we know the total
    length (OA_LEN) upfront, and can ask the storage serving the copy for
    exactly the right length. This is much more efficient, as
    fragmentation is lowered and the storage engine might make a much
    better allocation decision when it knows the full length rather than
    getting piecemeal requests.
    
    We implement the improved allocation scheme through additional state
    kept for the duration of the template object copy: struct
    vbf_objiter_priv holds the pointer to the newly created busy object,
    the total yet unallocated length (initialized to OA_LEN of the existing
    object) and pointer/length to the unused portion of the currently open
    segment, if any.
    98b6b954
Name
Last commit
Last update
.circleci Loading commit data...
.github Loading commit data...
bin Loading commit data...
contrib Loading commit data...
doc Loading commit data...
etc Loading commit data...
include Loading commit data...
lib Loading commit data...
m4 Loading commit data...
man Loading commit data...
tools Loading commit data...
vmod Loading commit data...
.dir-locals.el Loading commit data...
.editorconfig Loading commit data...
.gitignore Loading commit data...
.lgtm.yml Loading commit data...
.syntastic_c_config Loading commit data...
.travis.yml Loading commit data...
CONTRIBUTING Loading commit data...
ChangeLog Loading commit data...
INSTALL Loading commit data...
LICENSE Loading commit data...
Makefile.am Loading commit data...
README.Packaging Loading commit data...
README.rst Loading commit data...
autogen.des Loading commit data...
autogen.sh Loading commit data...
configure.ac Loading commit data...
flint.lnt Loading commit data...
varnish-legacy.m4 Loading commit data...
varnish.m4 Loading commit data...
varnishapi-uninstalled.pc.in Loading commit data...
varnishapi.pc.in Loading commit data...
vsc.am Loading commit data...
vtc.am Loading commit data...
wflags.py Loading commit data...