.. _phk_backends:
===============================
What do you mean by 'backend' ?
===============================
Given that we are approaching Varnish 3.0, you would think I had this
question answered conclusively long time ago, but once you try to
be efficient, things get hairy fast.
One of the features of Varnish we are very fundamental about, is the
ability to have multiple VCLs loaded at the same time, and to switch
between them instantly and seamlessly.
So imagine you have 1000 backends in your VCL, not an unreasonable
number, each configured with health-polling.
Now you fiddle your vcl_recv{} a bit and load the VCL again, but
since you are not sure which is the best way to do it, you keep
both VCL's loaded so you can switch forth and back seamlessly.
To switch seamlessly, the health status of each backend needs to
be up to date the instant we switch to the other VCL.
This basically means that either all VCLs poll all their backends,
or they must share, somehow.
We can dismiss the all VCLs poll all their backends scenario,
because it scales truly horribly, and would pummel backends with
probes if people forget to vcl.discard their old dusty VCLs.
Share And Enjoy
===============
In addition to health-status (including the saint-list), we also
want to share cached open connections and stats counters.
It would be truly stupid to close 100 ready and usable connections to
a backend, and open 100 other, just because we switch to a different
VCL that has an identical backend definition.
But what is an identical backend definition in this context?
It is important to remember that we are not talking physical
backends: For instance, there is nothing preventing a VCL for
having the same physical backend declared as 4 different VCL
backends.
The most obvious thing to do, is to use the VCL name of the backend
as identifier, but that is not enough. We can have two different
VCLs where backend "b1" points at two different physical machines,
for instance when we migrate or upgrade the backend.
The identity of the state than can be shared is therefore the triplet:
{VCL-name, IPv4+port, IPv6+port}
No Information without Representation
=====================================
Since the health-status will be for each of these triplets, we will
need to find a way to represent them in CLI and statistics contexts.
As long as we just print them out, that is not a big deal, but what
if you just want the health status for one of your 1000 backends,
how do you tell which one ?
The syntax-nazi way of doing that, is forcing people to type it all
every time::
backend.health b1(127.0.0.1:8080,[::1]:8080)
That will surely not be a hit with people who have just one backend.
I think, but until I implement I will not commit to, that the solution
is a wildcard-ish scheme, where you can write things like::
b1 # The one and only backend b1 or error
b1() # All backends named b1
b1(127.0.0.1) # All b1s on IPv4 lookback
b1(:8080) # All b1s on port 8080, (IPv4 or IPv6)
b1(192.168.60.1,192.168.60.2) # All b1s on one of those addresses.
(Input very much welcome)
The final question is if we use shortcut notation for output from
:ref:`varnishd(1)`, and the answer is no, because we do not want the
stats-counters to change name because we load another VCL and suddenly
need disabiguation.
Sharing Health Status
=====================
To avoid the over-polling, we define that maximum one VCL polls at
backend at any time, and the active VCL gets preference. It is not
important which particular VCL polls the backends not in the active
VCL, as long as one of them do.
Implementation
==============
The poll-policy can be implemented by updating a back-pointer to
the poll-specification for all backends on vcl.use execution.
On vcl.discard, if this vcl was the active poller, it needs to walk
the list of vcls and substitute another. If the list is empty
the backend gets retired anyway.
We should either park a thread on each backend, or have a poller thread
which throws jobs into the work-pool as the backends needs polled.
The pattern matching is confined to CLI and possibly libvarnishapi
I think this will work,
Until next time,
Poul-Henning, 2010-08-09
Henceforth, whatever our philosopher says about Matter will apply to extension and to extension alone. It cannot be apprehended by sight, nor by hearing, nor by smell, nor by taste, for it is neither colour, nor sound, nor odour, nor juice. Neither can it be touched, for it is not a body, but it becomes corporeal on being blended with sensible qualities. And, in a later essay, he describes it as receiving all things and letting them depart again without retaining the slightest trace of their presence.483 Why then, it may be asked, if Plotinus meant extension, could he not say so at once, and save us all this trouble in hunting out his meaning? There were very good reasons why he should not. In the first place, he wished to express himself, so far as possible, in Aristotelian phraseology, and this was incompatible with the reduction of Matter to extension. In the next place, the idea of an infinite void had been already appropriated by the Epicureans, to whose system he was bitterly opposed. And, finally, the extension of ordinary327 experience had not the absolute generality which was needed in order to bring Matter into relation with that ultimate abstraction whence, like everything else, it has now to be derived. That the millionaire was genuine, ¡°in person and not a caricature,¡± as Dick put it, was evident. Both the nurse, his relative, and his wife, were chatting with him as Jeff delivered the heavy packed ball made up of the gum. 233 "I guess not," said Landor, tolerantly, as he turned[Pg 106] his horse over to his orderly; "but, anyway," he added to Ellton, "we had a picnic¡ªof a sort." Si, unable to think of anything better, went with him. The train had stopped on a switch, and seemed likely to rust fast to the rails, from the way other trains were going by in both directions. The bridge gang, under charge of a burly, red-faced young Englishman, was in the rear car, with their tools, equipments, bedding and cooking utensils. THE DEACON HAS SOME EXPERIENCES WITH THE QUADRUPED. "You are not within a mile of the truth. I know it. Look here: I believe that is Gen. Rosecrans's own cow. She's gone, and I got an order to look around for her. I've never seen her, but from the description given me I believe that's she. Who brought her here?" "Deacon, these brothers and sisters who have come here with me to-night are, like myself, deeply interested in the moral condition of the army, where we all have sons or kinsmen. Now, can't you sit right there and tell us of your observations and experiences, as a Christian man and father, from day to day, of every day that you were down there? Tell us everything, just as it happened each day, that we may be able to judge for ourselves." HAS AN ENCOUNTER WITH THE PROVOST-MARSHAL. "Wonder which one o' them is the 200th Injianny's?" said Si to Shorty. "And your mother, and Harry?" The daughter must be the girl who was talking to him now. She sat on a little stool by the fire, and had brought out some sewing. "Over at Grandturzel¡ªcan't see wot's burning from here. Git buckets and come!" These things, however, gave little concern to the worthy who commanded the Kentish division. Tyler, though an excellent blacksmith, possessed few of the qualities requisite for forming a good general. Provided there was no very sensible diminution in the number of his followers, he cared not a straw for the score or two who, after quarrelling, or perhaps fighting, withdrew in such disgust that they vowed rather to pay the full tax for ever than submit to the insolence of the rebels. One man could fight as well as another, reasoned he; and, provided he was obeyed, what mattered it by whom. Dick went and Tom came¡ªit was sure to be all one in the end. But this burst of indignation soon passed away, and upon the suggestion of the prudent Sir Robert Hailes, he sent an evasive answer, with a command that the Commons should attend him at Windsor on the Sunday following. That it was a stratagem to gain entrance to the Tower, was the opinion of several, but, after much discussion, it was decided that the man should be admitted, and that the monk should be exhibited merely to intimidate the rebels, until the result of this promised communication should be known. HoMEŮͬÐÔÁµcbcb
ENTER NUMBET 0017
lolla.com.cn
www.yizu3.net.cn
www.yuffkk.com.cn
huoxi6.com.cn
www.fubei7.com.cn
bieni4.net.cn
www.jiaba4.net.cn
qunya2.com.cn
www.3xf75.com.cn
www.59rx5.net.cn