-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Support keys with TTL #172
Comments
This addition would be very welcome in a situation where you have a number of containers coming up and registering their IPs to consul so there is some smart routing done. if they system doesn't re-register its ip by the time that the TTL hits the ip is out of the routing logic. |
The lack of this feature is the only thing giving me pause about replacing etcd. |
This is something we want to add. So far, my current thinking is actually to add TTL support to Sessions, not Keys directly. This enables a single TTL to apply to many keys, and has a broader set of uses. Additionally, Session behavior can be modified to support ephemeral keys. Stay tuned... |
Excellent news! Is this likely to be part of the 0.4 release? |
We've locked down the 0.4RC, so likely in 0.5. |
If you add TTL support to Sessions would it work similarly to "session leases" as outlined in the Google Chubby paper (section 2.8)? |
@naelyn Yes exactly. |
I had some free time and started trying to figure out how to modify Consul to implement Session TTLs in the manner of chubby leased sessions. It wasn't clear if it was better to make the agent maintain the session (similar to how Checks appear to be plumbed) or to introduce a priority queue of soon-to-be-expired sessions at the Leader. Doing it at the agents can reuse more of the existing plumbing, but I'm not sure it's semantically correct to defer KeepAlives to the agent in this situation rather than requiring clients to directly issue them. On the other hand doing it with a straight priority queue at the leader requires that all sessions exist directly in main memory (without modifications to MDBIndex for time-indexing), and that's one more thing for the leader to be tracking and adjusting. |
So I think the answer in a way is "both". We already have agent-based TTL checks, which in effect are the same thing. The agent maintains the TTL and updates the check status with the servers. However, with this ticket I really meant support for server side TTLs. This allows a session to be created not associated with any agent. As you mentioned, it does mean all sessions will be tracked in-memory. Luckily, I think we can "compress" the amount of state we maintain to be fairly low, and even with thousands of sessions, it will be in the low kilobytes of memory usage. |
👍 to this feature. Looking forward to the implementation. |
Merged 29afa88 |
fix: proxy's destination service id is not service id
The text was updated successfully, but these errors were encountered: