Eventing Metadata Bucket Cleanup

Hi,

I am using Couchbase Server 6.6.2 EE on Windows 2016 Server in production.
I plan to use eventing with timers on one bucket. The context object for eventing handlers is less than 2048 bytes. I use a normal (bucket type = couchbase) bucket for the eventing metadata.

I will size the metadata bucket generously, nevertheless I would like to keep its size constant.
How are the obsolete documents in the metadata bucket get deleted?
Are there getting deleted? I didn’t find any setting for that?
Do I have to delete them myself? if yes how? based on which fields?

Regards,
Faris

Hi @FarisAhmed,

The metadata (or Eventing scratchpad) is “self cleaning” you need not worry about that. In a nutshell you should see 1024 docs if you deploy a function that has no timers capability, 1280 docs (or 2048 for older versions) if you have deploy a function that supports timers. Any created timer that is not canceled or has not fired will take about 800 bytes + the context size.

There is a scanner that runs every 7 seconds to find timers ready to fire (or timers that should have fired but your Function was paused for a lengthy period). An active timer takes at least two (2) documents and also one (1) document for each 7 second period - your context is stored in these documents. When the timer tiggers all documents are cleaned up.

Now for sizing lets do a quick rule of thumb you say you have a 2048 bytes for your context , add the 800 bytes and you need about 2.8K (so lets say 3K bytes total for each active timer). If your system sets 100,000 timers for tomorrow you will need 3K * 100K or 300 MB in your Eventing metadata or scratch pad.

Note you can share the same metadata bucket (or collection in 7.X) across multiple Eventing functions. I would recommend seriously considering an upgrade to 6.6.5 the latest Couchbase Server GA release in that train.

Best

Jon Strabala
Principal Product Manager - Server‌

1 Like

Hi @jon.strabala ,

Thanks explaining this!

Regards,
Faris Ahmed