Mailing List Archive

Limits in xkey module usage ?
Hello,

I'm in the process of testing xkey module, and I didn't find any "limits"
in the documentation.

Is there a limit of setting the same key on a very large number of objects ?
Is there a limit on the number of key an object can be linked to ?

I think, it is mainly a memory / pointer size issue, are those limits
tunable ?

Regards

Olivier
Re: Limits in xkey module usage ? [ In reply to ]
Hi Oliver,

I'll let the creators of the VMOD talk here, but I think the only limit is the space needed in order to keep the in-memory data structure indexing the cached contents.

If you link an object to a lot of keys you might hit varnishd limits like max number of headers or the max length of a header. On the other hand, if you link a huge number of objects to the same key, that's not a problem at all, but you might experience some thread contention during invalidations of that key due to the associated locking required by the VMOD.

Best,

--
Carlos Abalde

> On 24 Sep 2018, at 18:00, Olivier Hanesse <olivier.hanesse@gmail.com> wrote:
>
> Hello,
>
> I'm in the process of testing xkey module, and I didn't find any "limits" in the documentation.
>
> Is there a limit of setting the same key on a very large number of objects ?
> Is there a limit on the number of key an object can be linked to ?
>
> I think, it is mainly a memory / pointer size issue, are those limits tunable ?
>
> Regards
>
> Olivier
> _______________________________________________
> varnish-misc mailing list
> varnish-misc@varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc


_______________________________________________
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
Re: Limits in xkey module usage ? [ In reply to ]
Hello Carlos,

Thanks for your answer. About thread contention during invalidation, can
you be more specific ?
At what scale can we encounter such contentions ?
Hundreds of objects linked to a key ? or Thousand ? ten thousand ?

Regards

Olivier


Le lun. 24 sept. 2018 à 18:11, Carlos Abalde <carlos.abalde@gmail.com> a
écrit :

> Hi Oliver,
>
> I'll let the creators of the VMOD talk here, but I think the only limit is
> the space needed in order to keep the in-memory data structure indexing the
> cached contents.
>
> If you link an object to a lot of keys you might hit varnishd limits like
> max number of headers or the max length of a header. On the other hand, if
> you link a huge number of objects to the same key, that's not a problem at
> all, but you might experience some thread contention during invalidations
> of that key due to the associated locking required by the VMOD.
>
> Best,
>
> --
> Carlos Abalde
>
> > On 24 Sep 2018, at 18:00, Olivier Hanesse <olivier.hanesse@gmail.com>
> wrote:
> >
> > Hello,
> >
> > I'm in the process of testing xkey module, and I didn't find any
> "limits" in the documentation.
> >
> > Is there a limit of setting the same key on a very large number of
> objects ?
> > Is there a limit on the number of key an object can be linked to ?
> >
> > I think, it is mainly a memory / pointer size issue, are those limits
> tunable ?
> >
> > Regards
> >
> > Olivier
> > _______________________________________________
> > varnish-misc mailing list
> > varnish-misc@varnish-cache.org
> > https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
>
>
Re: Limits in xkey module usage ? [ In reply to ]
> On 25 Sep 2018, at 11:27, Olivier Hanesse <olivier.hanesse@gmail.com> wrote:
>
> Hello Carlos,
>
> Thanks for your answer. About thread contention during invalidation, can you be more specific ?
> At what scale can we encounter such contentions ?
> Hundreds of objects linked to a key ? or Thousand ? ten thousand ?

Hi Olivier,

Basically I'm talking about thread contention generated by this loop [1]: when a key is purged, if that key is linked to a huge amount of objects, the lock is going to be held during a noticeable amount of time. That will block other threads executing callbacks [2] in order to to add / remove object to / from the xkey state.

What would be too many objects linked to a single key? To be honest, I don't know. For an answer we'll need to invoke the VMOD authors :)

[1] https://github.com/varnish/varnish-modules/blob/0.15.0/src/vmod_xkey.c#L531-L579 <https://github.com/varnish/varnish-modules/blob/0.15.0/src/vmod_xkey.c#L531-L579>
[2] https://github.com/varnish/varnish-modules/blob/0.15.0/src/vmod_xkey.c#L423-L465 <https://github.com/varnish/varnish-modules/blob/0.15.0/src/vmod_xkey.c#L423-L465>

Best,

--
Carlos Abalde
Re: Limits in xkey module usage ? [ In reply to ]
> What would be too many objects linked to a single key? To be honest, I don't know. For an answer we'll need to invoke the VMOD authors :)

Keys are just tags, so you could really tag responses in many ways.

For example, on a server delivering contents for multiple hosts, you
could use the normalized host name as a key and decide that any
release on the backend side should invalidate the cache of the
associated host.

Another common example is tagging responses by type, for example add
an "article" key. Once you change your articles template, you have a
way to soft-purge all the cached articles.

No, there are no implicit limits in vmod-xkey. Yes, there are related
limits as pointed out by Carlos, namely number and size of response
headers. vmod-xkey allows criteria-based invalidation like bans (but
not as versatile) at a purge-like scale, and besides the additional
memory footprint it can exhibit contention when the set of purged keys
invalidate too many objects.

I'm afraid I don't have any numbers to share regarding when things go
out of hand. Varnish has a "cutoff" parameter for bans but vmod-xkey
has nothing of the sort to keep everything under tight control.

Dridi

PS. not the vmod-xkey author
_______________________________________________
varnish-misc mailing list
varnish-misc@varnish-cache.org
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc