How to iterate VMOD objects on VCL_EVENT_COLD?

Carlos Abalde carlos.abalde at gmail.com
Tue Dec 15 18:06:19 CET 2015


Hi all,

I'm working in a VMOD that allows creating some objects, each one wrapping the access logic to a database. It looks like,

    vcl_init {
        new db1 = redis.db(...);
        new db2 = redis.db(...);
        ...
    }

Each object implements a connection pool maintaining multiple opened connections in its internal state. I would like to be able to release those connections when the VCL using the VMOD is not active:

    - I think that's not doable in 4.0. The only alternative is waiting for the VCL to be discarded and then close connections when the __fini() callback is executed for each instance.

    - In 4.1 we have the VMOD event function. The VMOD could listen for VCL_EVENT_COLD events and then close established connections. In order to do that the full list of instances would be required. Is it possible to get access to that list somehow? Should it be manually implemented by the VMOD? Is there any plans to propagate VCL temperature events also to object instantiated by a VMOD?

Thanks,

--
Carlos Abalde




More information about the varnish-misc mailing list