-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
ZooKeeper - new membership provider #382
Comments
@shayhatsor, I think you had a typo. |
Have you read this: http://dotnet.github.io/orleans/Runtime-Implementation-Details/Cluster-Management.html? It should answer a lot of questions and explain why we went with Azure table and not ZK. There are a bunch of really good technical reasons. |
I have read the Cluster Management article. I understand the reasons you chose Azure table over ZK as its support for the protocol is complete out of the box. While looking for an open-source solution for the membership table persistence, I found ZK to be an option using a readers writer lock recipe. |
OK, I think we are in a full agreement on usefulness of allowing to use ZK as yet another membership provider. And I am very excited that you are willing to contribute towards that effort. The question now is how exactly we are going to integrate with ZK.
Now to more low level technical details. Under Zookeeper Recipes they mention they provide membership out of the box almost. This sounds great at the first look. But reading deeper about ephemeral nodes, my understanding is that the way it works is the following: every client (Orleans silo in our case) connects to the ZK service (master or one of the seed nodes among the ZK cluster) and is represented by an ephemeral node. The client runs I am alive heartbeats between himself and this ZK node. If heartbeats stop, ZK removes this ephemeral node, thus declaring the client disconnected/dead. Now, if my understating is correct, what follows is the unfortunate property of this implementation in which if a silo temporarily disconnects from the ZK service, it will result in its disconnecting from other silos, and they will consider it dead. This is undesirable, since the silo may in fact be completely healthy and have a perfect connectivity to other silos, just not to ZK nodes. In our description here Property 7 under "Properties of the Basic Membership Protocol and FAQ" we explicitly discuss this sutuation and describe how our Azure table based membership is resilient to those kinds of failures. Perhaps you had in mind a different way to integrate with ZK? I would be very interested to hear. You mentioned "Shared Reentrant Read Write Lock". I am not sure how those could be used, but would be very interested to learn. I am not familiar with how locks work in ZK. As for your question about client consistency: "ZooKeeper does not guarantee that at every instance in time, two different clients will have identical views of ZooKeeper data"
Gabi Kliot |
Thanks a lot for the quick response, I'm also very excited to be able to contribute.
Now the low level technical details:
I believe your understanding of ZK ephemeral nodes is correct.
I have one. My goal is to mimic Azure and follow Orleans current membership protocols to the letter. Today, I learned that using a ZK recipe for implementing locks is an overkill, there's native support for transactions.
For example, updating a membership table entry requires the transaction to check the table version and entry version, and commit the update only if both are as expected. This can be done with multi. This method is supported since version 3.4 ,unfortunately the C# client doesn't have support for that yet, I'll have to add it. About the guarantee requirements:
Looking at ZK Guarantees it provides all of them: |
@shayhatsor , this is great! You will also need to implement There will be a later question about Reminders table. I believe it can also be implemented over ZK. The only challenge there would be to support range query efficiently. But we can leave that question on the side for now. If one does not need Reminders, Orleans can be configured to use one implementation for Membership and another (or none) for Reminders. So one can mix and match and maybe others will implement Reminders over ZK in the future. So I would not worry about it now. Please let me know how I can help. |
@shayhatsor A ZK-based implementation of membership would be a great addition to the list of configuration options. Membership storage is already pluggable in the sources, as Gabi described. We could make it into a real plugin design with dynamically loaded implementations, but I think that's a low priority part at this point, as we don't expect too many of such implementations. I'm less sure about the value of using ZK for reminders, but if it works, why not. |
@sergeybykov I agree with you about the real plugin design being low priority. I pointed it out because I started learning Orleans three weeks ago and Azure is mentioned throughout the code. I had to read the entire Orleans documentation to figure out that Azure is optional, even then I missed the part about reminders. |
@shayhatsor You are right, we started initially with Azure in mind, and it's still not obvious that we do not have a strong dependency on Azure. Any PRs you can submit against https://github.com/dotnet/orleans/tree/gh-pages would be greatly appreciated. |
@shayhatsor, you are right: all those methods may throw due to network problems or table unavailability or in general due to any other system problem, such as out of memory for example. On the other hand, those methods are not expected to throw in order to express application semantics. For example, all update/insert methods are supposed to return false if update failed due to a legitimate concurrency control failure (etag mismatch) and not throw "Storage etag mismatch" exception instead.
Of course, there are also other less clear cases of errors, such as what to do if the table is suddenly not there. It can in theory happen if someone by mistake deleted it. What should all those operations do? This is considered a system error (since this scenario is not part of the allowed semantics of this protocol), so they should throw. |
Update: I was trying to make the current ZooKeeper C# Client have the same capabilities of the java counterpart. After several days of work, I've found out that it's more outdated than i originally thought. Consequently, I've converted the entire java client codebase of the latest stable version of the ZooKeeper 3.4.6 to C#. and made async versions of all methods. currently it's almost finished, all tests I could convert from the java version are passing consistently (currently 81 test). I'll organize it a bit more and perform a pull request on ZooKeeper main branch. the current ZooKeeper C# Client isn't merged with the main branch, it's a fork. I hope my version will be adopted as part of the official version. Meanwhile, I'm starting to work on integrating ZooKeeper with Orleans. |
@shayhatsor Sounds like a good progress despite more work than you anticipated. :-) Thanks for the update! |
@rgs1, with ewhauser/zookeeper#29, can we have C# implementation in official ZK repository, targeting CoreCLR / CoreFX surface area for cross-platform .NET support? |
just made a pull request : #493. @jasonwilliams200OK, @ewhauser's version is outdated. ewhauser/zookeeper#29 is my PR... but it's an "old" one. |
#69 says:
I think that membership providers configuration should be consistent with storage providers. This would make Orleans cleaner and alleviate dragging dependencies to various DBs.
While adding this extensibility, It seems natural to remove the GatewayProviderType and LivenessProviderType enums. This will ease the removal of dependencies on Azure. (#136).
Going back to the main issue of Zookeeper.
ZooKeeper Programmer's Guide states that:
Consequently, Do we need to use a Zookeeper Recipe like Shared Reentrant Read Write Lock?
If we only use a Shared Lock for writing, a silo might get a stale value of the membership table. I'm not sure how Orleans deals with this scenario as the current implementations (Azure,Sql Server) guarantee fresh values.
The text was updated successfully, but these errors were encountered: