Skip to content
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

Closed
robertmircea opened this issue May 25, 2014 · 13 comments
Closed

Support keys with TTL #172

robertmircea opened this issue May 25, 2014 · 13 comments
Labels
thinking More time is needed to research by the Consul Contributors

Comments

@robertmircea
Copy link

  1. Please add ability to set TTL on keys for the k/v store subsystem. After expiration, the keys should not be available any more.
  2. Allow to unset TTL for a key in order to prevent expiration using HTTP API
  3. Allow touching the key in order to reset TTL period to its initial value
  4. Allow changing TTL for a key to an another value before expiration.
@Telmo
Copy link

Telmo commented Jul 23, 2014

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.

@awheeler
Copy link
Contributor

awheeler commented Sep 4, 2014

The lack of this feature is the only thing giving me pause about replacing etcd.
If this is inconsistent with the thinking behind consul, can someone educate us on the correct methodology?
If not, I may take a stab at it.

@armon
Copy link
Member

armon commented Sep 4, 2014

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...

@awheeler
Copy link
Contributor

awheeler commented Sep 4, 2014

Excellent news! Is this likely to be part of the 0.4 release?

@armon
Copy link
Member

armon commented Sep 4, 2014

We've locked down the 0.4RC, so likely in 0.5.

@rboyer
Copy link
Member

rboyer commented Oct 6, 2014

If you add TTL support to Sessions would it work similarly to "session leases" as outlined in the Google Chubby paper (section 2.8)?

@armon
Copy link
Member

armon commented Oct 6, 2014

@naelyn Yes exactly.

@armon armon added the thinking More time is needed to research by the Consul Contributors label Oct 14, 2014
@rboyer
Copy link
Member

rboyer commented Oct 15, 2014

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.

@armon
Copy link
Member

armon commented Oct 15, 2014

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.

@armon
Copy link
Member

armon commented Nov 21, 2014

@JeanMertz
Copy link

👍 to this feature. Looking forward to the implementation.

@amalaviy
Copy link
Contributor

Merged 29afa88

@armon
Copy link
Member

armon commented Dec 13, 2014

Closed by @amalaviy via #524

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
thinking More time is needed to research by the Consul Contributors
Projects
None yet
Development

No branches or pull requests

7 participants