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

Stale subscriptions data cleanup for operational stability #1

Open
Envek opened this issue Aug 27, 2018 · 0 comments
Open

Stale subscriptions data cleanup for operational stability #1

Envek opened this issue Aug 27, 2018 · 0 comments

Comments

@Envek
Copy link
Member

Envek commented Aug 27, 2018

As this gem actually stores runtime data in Anycable's Redis instance it is comparatively easy to use all available space by stale data about subscriptions (if for some reason it weren't deleted on client unsubscription).

One possible variant is:

  1. Set expiration with some configurable timeout (with default with 1 day) for subscriptions (SUBSCRIPTION_PREFIX + subscription.id keys). Let it die. But events keys can't be expired as it will lead to broken subscriptions.
  2. On application (anycable RPC server) start subscribe to all expire events in Redis via Keyspace notifications (but in that case subscription_id → event_id mapping should be stored separately from subscription itself as it is impossible to retrieve contents of an expired key)
  3. On key expired event fired subscription_id should be removed from all events. Event keys from which the last element was removed will be deleted automatically by Redis.
  4. Additionally, it is possible to run some rake task every day or week and check every SUBSCRIPTION_PREFIX keys and check their staleness via OBJECT IDLETIME, remove their ids from every event and remove them altogether.

The problem of this approach is in Redis configuration that should be altered to let it work: Keyspace notifications are disabled by default and OBJECT command may be disabled by security concerns (as it is considered to be a service command for debug purposes). And there may be no privileges to change these settings.

Any other ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant