-
-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is it possible: self-routing sharded Varnish Cache cluster with libvmod-dynamic ? #63
Comments
In general, for clustering, I would recommend to have a look at https://code.uplex.de/uplex-varnish/libvmod-cluster and in particular https://code.uplex.de/uplex-varnish/libvmod-cluster/blob/master/vcl/vshard.inc.vcl . I would conisder the clustering howto by varnish-software suboptimal, in particular because it uses the hash director (rather than shard). That said, you try to layer shard/round-robin over dynamic. Being able to do so is a long standing request, but I do not think we currently have a safe way of achieving this. You could try to use Also, let me remind you to call The basic idea for a correct solution to this problem would, in my mind, be an API for directors to explicitly support layering, that is, for example, allowing one director to dynamically use backends created by another director. This is even more in the future than director reference counting. |
Hello @nigoroll , Thank you for your answer, I wasn't aware that dynamic will not be able remove backends without reloading the VLC. Should we close the issue ? Regards, |
@nigoroll thank you for providing libvmod-dynamic. It is great. This issue is now 4 years old. Is there any update in combining a cluster and libvmod-dynamic? |
@pnbecker Yes, there is news, we do fully support layering now (you will find some mentions of layering/layered in CHANGES.rst). But besides this, to get a proper sharded configuration, we would ideally need a way for one director to add all the backends of another director, and then also update its configuration periodically. Or, as a bit of a hack-ish, the dynamic director could directly integrate the shard director logic, but that would really not be good from a design perspective. I have dropped an RFC... |
@nigoroll that is awesome, thank you! If anyone stumble on this, I was able to solve it with the following data (following the information from CHANGES.rst):
|
Hello,
I usually (without libvmod-dynamic) use cache sharding on varnish, based on what is described here : https://info.varnish-software.com/blog/creating-self-routing-varnish-cluster
With libvmod-dynamic I'm not able to determine the varnish backend identity from which the traffic is coming from because
req.backend_hint
doesn't return the name of a specific backend, but instead the general name of the dynamic backend.Here are some vcl configuration to try to make myself clear:
Without dynamic
In the above code, there is no problem, req.backend_hint will be set to either node1.example.com or node2.example.com
With dynamic
Let's imagine node.example.com is a multi A DNS record with 2 varnish servers,
node.example.com 300 IN CNAME varnish1
node.example.com 300 IN CNAME varnish2
The above code doesn't work because
req.backend_hint = v_cluster.backend()
will be set tov_cluster(node.example.com:80)
and not to the actual varnish backend hosts.I mean
req.http.X-shard
will be set to eithervarnish2
orvarnish1
whereasreq.backend_hint
wil always be set tov_cluster(node.example.com:80)
Is there any way to put hostname of the varnish wich actually catched the orign request in
req.backend_hint
?I'm sorry if my explanation is confused, let me know if you need me to add more information to clarify.
Regards,
The text was updated successfully, but these errors were encountered: