On 5/16/19 10:41, Hardik wrote: > > Does I have to take care something while using this vmod ? Because first > time going to use and also not getting any information about this.
That's a very generic question. Do you have something specific in mind? objvar is actually a bundle of four VMODs, and they each have documentation as .rst files in the src/ directory. These get converted and installed as man pages on installation. So you might want to start there. To take a guess at possible answers to the generic question, the main thing to decide is the scope and mutability of the variables you want to use. That's what distinguishes the four VMODs: - constant: global constants (immutable) - globalvar: global variables (mutable) - taskvar: variables with task scope - scoped to the client or backend context of a single request/response transaction - topvar: ESI top-level scope - these are variables accessible in client context for an ESI include and all of its sub-includes You should be aware that the global variables use locking and memory barriers to prevent simultaneous updates. So if you have a lot of threads accessing a variable at the same time, you could run into lock contention. Conceivably you might want to think about how memory is allocated for the different scopes. If you only need a couple of variables in VCL, you won't notice the difference. But if you're using a lot of them, if you're trying to minimize RAM usage, trying to minimize workspace size configurations to reduce Varnish's footprint, if you're using a lot of workspace for other purposes (large ESI trees, other VMODs that consume workspace ...) ... then it could matter. The global constants and variables are allocated from the system heap, for the lifetime of the VCL instance. Task scoped variables are allocated from the workspace of the client or backend task. ESI top-level variables are allocated from client workspace, which is re-used for the entire ESI include tree. Workspaces are reset and re-used for new request/response transactions. > what is difference between below this ? > > https://github.com/varnish/varnish-modules/blob/master/src/vmod_var.c > > and > https://code.uplex.de/uplex-varnish/varnish-objvar.git > > I am familiar with first link flow wise. Generation of *.vcc file in second > link is totally different then previous one which I am not familiar with. > Someone please clarify confusion that which one should use for global > variable vmod ? VMOD var supports global variables for the STRING, INT and REAL types, and task-scoped variables for STRING, INT, REAL, DURATION, IP and BACKEND. The objvar VMODs cover all of the VCL data types, and have the different options for scope and mutability described above. They also have methods to undefine or protect a variable (a protected variable may not be changed), and check if a variable is defined or protected. See the .rst files for documentation, or the manpage if you install any of the VMODs. HTH, Geoff -- ** * * UPLEX - Nils Goroll Systemoptimierung Scheffelstraße 32 22301 Hamburg Tel +49 40 2880 5731 Mob +49 176 636 90917 Fax +49 40 42949753 http://uplex.de
signature.asc
Description: OpenPGP digital signature
_______________________________________________ varnish-misc mailing list [email protected] https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
