Skip to content

Conversation

@Pallavi-Janardhan
Copy link
Contributor

@Pallavi-Janardhan Pallavi-Janardhan commented Dec 29, 2025

DOC-13422

Created and added a new document for Eventing Memory Quota and linked it from the Sizing Guidelines document. Also modified the Sizing Guidelines doc.

Docs preview for Sizing Guidelines
and
Docs preview for Eventing Memory Quota

Preview credentials

@@ -0,0 +1,168 @@
= Eventing Memory Quota

:description: The Eventing Service memory quota does not enforce a hard memory limit on the Eventing subsystem, including producer and worker processes.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

including producer and worker processes

End-user / customer doesn't know what is the "producer" process.
Please go through this entire docs page and remove all mentions of "producer" processes.

Let's only keep using the term "worker processes" (or simply "workers") as the customer / end user is only aware about that.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


== Overview

The Couchbase Eventing Service memory quota does not enforce a hard memory limit on the entire Eventing subsystem, including producer and worker processes.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

including producer and worker processes

Same comment as above on the use of "producer" process.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


The memory quota serves 2 primary purposes:

* **Producer-to-worker queue sizing**: controls the maximum size of each worker's input queue.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Producer-to-worker queue sizing

Same comment as above on the use of "producer" process.

Just use "Worker queue sizing"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


The per-worker quota directly influences 2 key aspects of Eventing runtime behavior.

=== Producer-to-Worker Queue Sizing

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Producer-to-Worker Queue Sizing

Same comment as above on the use of "producer" process.

Just use "Worker queue sizing"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


=== Producer-to-Worker Queue Sizing

Each worker has a bounded input queue that receives changes to documents from the Database Change Protocol (DCP) stream.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Each worker has a bounded input queue" -> "Each worker maintains a bounded input queue"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


=== Producer-to-Worker Queue Sizing

Each worker has a bounded input queue that receives changes to documents from the Database Change Protocol (DCP) stream.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Database Change Protocol (DCP) stream.

Let's not use the term "Database Change Protocol (DCP)". I don't see it mentioned anywhere in our official documentation.

Instead use a generic term like "Document Mutation stream".

Copy link
Contributor Author

@Pallavi-Janardhan Pallavi-Janardhan Dec 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do have a detailed section about DCP in our docs. So, as discussed, will provide reference links to that section, xref:server:learn:clusters-and-availability/intra-cluster-replication.adoc#database-change-protocol[DCP], from here.

Each worker has a bounded input queue that receives changes to documents from the Database Change Protocol (DCP) stream.

* The per-worker quota determines the maximum size of this queue.
* When the queue exceeds this size, Eventing throttles the DCP stream to prevent unbounded memory growth.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventing throttles the DCP

Same as above for "DCP".

Copy link
Contributor Author

@Pallavi-Janardhan Pallavi-Janardhan Dec 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have provided a link to DCP from this section.


* GC frees memory occupied by unreachable objects that are no longer in use.
* GC reclaims memory only from objects that are no longer in use.
Memory held by live objects in the JSE heap remains allocated, so total usage may exceed the per-worker quota.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"JSE" -> "Javascript runtime" * all occurrences

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed it to JavaScript runtime

Copy link
Contributor

@sarahlwelton sarahlwelton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @Pallavi-Janardhan , can you please confirm that you're making the changes you want to be making in this PR? I can do a more thorough review once you're sure you're committing the right changes.

Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we committing an empty file? What is the point of this? I think you've made a mistake on the folder structure in this PR, because this file should be in a pages folder if it's meant to be documentation.

Copy link
Contributor Author

@Pallavi-Janardhan Pallavi-Janardhan Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, guess it was by mistake! Have removed the empty file and fixed the issue.

Copy link
Contributor Author

@Pallavi-Janardhan Pallavi-Janardhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have placed the newly created "eventing-memory-quota.adoc" doc under the "modules/learn/pages/buckets-memory-and-storage" directory and updated the cross-ref from sizing guidelines doc to this. Also have updated the nav.adoc (navigation doc).

Kindly review and let me know your comments or approve.

@Pallavi-Janardhan
Copy link
Contributor Author

@sarahlwelton and @simon-dew can you please have a look at this and let me know if it is ok? If yes, kindly approve so that I can merge it.

Thanks

Copy link
Contributor

@sarahlwelton sarahlwelton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a lot of work. Did you go through writing a doc plan for this work? I'm not sure that you're on the right track with how you chose to approach this, and we might have been able to guide you with a doc plan ahead of time.

{description}

When you plan to deploy a Couchbase Server cluster, the most common and important question that comes up is: how many nodes do I need and what size do they need to be?
The most common and important question that comes up when you plan to deploy a Couchbase Server cluster is: how many nodes do I need and what size do they need to be?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The most common and important question that comes up when you plan to deploy a Couchbase Server cluster is: how many nodes do I need and what size do they need to be?
The most common and important questions you need to ask when deploying a new Couchbase Server cluster are how many nodes you need, and what size they need to be.

Comment on lines +27 to +29
Couchbase Services are what allow you to use and maintain your data.
Deploy, maintain, and provision these services independently of each other.
This independent service model allows you to take advantage of `Multi-Dimensional Scaling`, whereby a cluster can be fine-tuned for optimal handling of emergent workload-requirements, on a service-by-service basis.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Couchbase Services are what allow you to use and maintain your data.
Deploy, maintain, and provision these services independently of each other.
This independent service model allows you to take advantage of `Multi-Dimensional Scaling`, whereby a cluster can be fine-tuned for optimal handling of emergent workload-requirements, on a service-by-service basis.
Couchbase Services allow you to access and maintain your data.
You can deploy, maintain, and provision these services independently of each other.
This independent service model allows you to take advantage of Multi-Dimensional Scaling.
Multi-Dimensional scaling lets you fine-tune your cluster for optimal handling of changing workload requirements for each individual Couchbase Service.

Comment on lines +31 to +33
Every service has different demands on hardware resources.
Multi-Dimensional Scaling plays an important role when sizing your Couchbase cluster, both pre and post-deployment.
For example, core Data Service operations can often benefit greatly from the `scale out` of smaller commodity nodes, whereas low latency operations with the Query Service may see a greater benefit from the `scale up` of hardware resources on a given node.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Every service has different demands on hardware resources.
Multi-Dimensional Scaling plays an important role when sizing your Couchbase cluster, both pre and post-deployment.
For example, core Data Service operations can often benefit greatly from the `scale out` of smaller commodity nodes, whereas low latency operations with the Query Service may see a greater benefit from the `scale up` of hardware resources on a given node.
Every Service has different demands on hardware resources.
Multi-Dimensional Scaling plays an important role when sizing your Couchbase cluster, both pre and post-deployment.
For example, core Data Service operations can often benefit from scaling out smaller commodity nodes.
Low latency operations with the Query Service might see a greater benefit from scaling up hardware resources on a given node.


CPU::
CPU refers to the number of cores and clock speed that are required to run your workload.
CPU specifies the number of cores and clock speed required to run your workload.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
CPU specifies the number of cores and clock speed required to run your workload.
CPU controls the number of cores and the clock speed required to run your workload.

Comment on lines +45 to +46
RAM is often the most crucial areas to size accurately.
Cached documents provide low-latency reads and consistently high throughput.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
RAM is often the most crucial areas to size accurately.
Cached documents provide low-latency reads and consistently high throughput.
RAM is often the most crucial area to size.
Cached documents provide low-latency reads and consistently high throughput.


As a result, setting a memory quota does not guarantee that Eventing functions remain within that limit.

=== No OS-Level Enforcement Outside cgroups
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
=== No OS-Level Enforcement Outside cgroups
[#no-enforce-c-groups]
=== No OS-Level Enforcement Outside cgroups


=== No OS-Level Enforcement Outside cgroups

In non-containerized environments, the operating system does not enforce the memory quota.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The operating system? Or Couchbase Server/the Eventing Service?

Comment on lines +108 to +111
* Users must monitor Eventing memory usage using system tools.
* Configuring an excessive number of workers can lead to memory exhaustion.
* High-memory-consuming functions can affect overall system stability.
* Eventing does not automatically stop or throttle execution when total memory exceeds the quota.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* Users must monitor Eventing memory usage using system tools.
* Configuring an excessive number of workers can lead to memory exhaustion.
* High-memory-consuming functions can affect overall system stability.
* Eventing does not automatically stop or throttle execution when total memory exceeds the quota.
You must monitor the Eventing Service's memory usage using system tools.
If you configure too many workers for your Eventing Functions, you can cause memory exhaustion in your cluster.
High memory-consuming Eventing Functions can affect your overall system stability.
Again, the Eventing Service does not automatically stop or throttle execution when total memory exceeds the quota.

Comment on lines +113 to +134
=== Memory Isolation

The memory quota does not isolate memory usage between Eventing functions.

* All workers draw from the same total memory quota.
* A memory-intensive function can reduce the memory available to other functions.
* Eventing does not support per-function memory limits or reservations.

== Best Practices
Follow these recommendations to effectively manage Eventing memory usage effectively and avoid operational issues.

=== Monitor Memory Usage

* Use system-level monitoring tools to track actual memory consumption.
* Monitor memory usage for the Eventing process and individual workers.
* Configure alerts for memory thresholds well below system limits.

=== Configure Worker Count Appropriately

* Consider the per-worker quota when determining the number of workers.
* Avoid over-provisioning workers when Eventing functions require substantial memory.
* Balance the worker count against available system memory.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
=== Memory Isolation
The memory quota does not isolate memory usage between Eventing functions.
* All workers draw from the same total memory quota.
* A memory-intensive function can reduce the memory available to other functions.
* Eventing does not support per-function memory limits or reservations.
== Best Practices
Follow these recommendations to effectively manage Eventing memory usage effectively and avoid operational issues.
=== Monitor Memory Usage
* Use system-level monitoring tools to track actual memory consumption.
* Monitor memory usage for the Eventing process and individual workers.
* Configure alerts for memory thresholds well below system limits.
=== Configure Worker Count Appropriately
* Consider the per-worker quota when determining the number of workers.
* Avoid over-provisioning workers when Eventing functions require substantial memory.
* Balance the worker count against available system memory.
[#worker-sizing-memory]
=== Worker Sizing Impacts Memory
When configuring the memory quota for the Eventing Service, consider the per-worker quota when determining the number of workers.
Avoid over-provisioning workers when Eventing Functions require substantial memory.
For best results, try to balance your worker count against your available memory.
[#quota-per-worker]
=== Quota Applies Per Worker
The memory quota does not isolate memory usage between Eventing Functions.
All workers draw from the same total memory quota.
A memory-intensive function can reduce the memory available to other Eventing Functions.
Eventing does not support per-function memory limits or reservations.
== Best Practices
Follow these recommendations to effectively manage Eventing memory usage:
* <<monitor,>>
* <<test,>>
* <<use-cgroups,>>
* <<size,>>
* <<review,>>
[#monitor]
=== Monitor Memory Usage
* Use system-level monitoring tools to track actual memory consumption.
* Monitor memory usage for the Eventing process and individual workers.
* Configure alerts for memory thresholds well below system limits.

Comment on lines +136 to +160
=== Test in Representative Environments

* Test Eventing functions under production-like load conditions.
* Measure actual memory consumption during peak processing.
* Validate that memory usage remains within acceptable limits.

=== Use cgroups for Enforcement

* Consider containerized deployments or cgroup-based memory limits in production environments.
* Container platforms such as Docker and Kubernetes provide hard memory limits.
* cgroups enforce OS-level memory restrictions.
* This approach adds a safety layer beyond the Eventing Service memory quota.

=== Size the Memory Quota Appropriately

* Set the Eventing memory quota based on expected worker count and function complexity.
* Allow additional headroom on top of the 256 MB default for production workloads.
* Account for peak processing scenarios, not just average load.

=== Review Function Memory Efficiency

* Optimize JavaScript code to minimize memory allocation.
* Avoid accumulating large data structures in function scope.
* Release object references when data is no longer needed.
* Profile functions to identify memory-intensive operations.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
=== Test in Representative Environments
* Test Eventing functions under production-like load conditions.
* Measure actual memory consumption during peak processing.
* Validate that memory usage remains within acceptable limits.
=== Use cgroups for Enforcement
* Consider containerized deployments or cgroup-based memory limits in production environments.
* Container platforms such as Docker and Kubernetes provide hard memory limits.
* cgroups enforce OS-level memory restrictions.
* This approach adds a safety layer beyond the Eventing Service memory quota.
=== Size the Memory Quota Appropriately
* Set the Eventing memory quota based on expected worker count and function complexity.
* Allow additional headroom on top of the 256 MB default for production workloads.
* Account for peak processing scenarios, not just average load.
=== Review Function Memory Efficiency
* Optimize JavaScript code to minimize memory allocation.
* Avoid accumulating large data structures in function scope.
* Release object references when data is no longer needed.
* Profile functions to identify memory-intensive operations.
[#test]
=== Test in Representative Environments
* Test Eventing Functions under production-like load conditions.
* Measure actual memory consumption during peak processing.
* Validate that memory usage remains within acceptable limits.
[#use-cgroups]
=== Use cgroups for Enforcement
* Consider containerized deployments or cgroup-based memory limits in production environments.
* Container platforms such as Docker and Kubernetes provide hard memory limits.
* cgroups enforce OS-level memory restrictions.
This approach adds a safety layer beyond the Eventing Service memory quota.
[#size]
=== Size the Memory Quota Appropriately
* Set the Eventing Service memory quota based on expected worker count and Eventing Function complexity.
* Allow additional headroom on top of the 256{nbsp}MB default for production workloads.
* Account for peak processing scenarios, not just average load.
[#review]
=== Review Function Memory Efficiency
* Optimize JavaScript code to minimize memory allocation.
* Avoid accumulating large data structures in the function scope.
* Release object references when data is no longer needed.
* Profile Eventing Functions to identify memory-intensive operations.

Copy link
Contributor

@sarahlwelton sarahlwelton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This needs a lot of work. Did you go through writing a doc plan for this work? I'm not sure that you're on the right track with how you chose to approach this, and we might have been able to guide you with a doc plan ahead of time.

@abhijpes
Copy link

abhijpes commented Jan 8, 2026

Hi @Pallavi-Janardhan Following up on the prior discussion, after further review I believe the following location is appropriate for a dedicated Eventing Memory Quota documentation page:

Screenshot 2026-01-08 at 2 04 16 PM

Copy link
Contributor

@simon-dew simon-dew left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed with @Pallavi-Janardhan today, my comments are:

  1. Remove eventing-memory-quota.adoc from this PR and revert the changes to the navigation. In the Sizing Guidelines document, keep a link to xref:eventing:eventing-memory-quota.adoc (see below) and any style changes, following Sarah's comments.
  2. Create a new PR in the docs-devex repo to add eventing-memory-quota.adoc to the eventing module, as suggested by @abhijpes.

=== RAM

In general, the Eventing memory quota of 256 MB is sufficient for almost all workloads.
The xref:learn:buckets-memory-and-storage/eventing-memory-quota.adoc[Eventing Memory Quota] doc discusses the Eventing Service memory quota in detail.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The xref:learn:buckets-memory-and-storage/eventing-memory-quota.adoc[Eventing Memory Quota] doc discusses the Eventing Service memory quota in detail.
For more information about the Eventing Service memory quota, see xref:eventing:eventing-memory-quota.adoc[].

Comment on lines +620 to +628
Refer to this document to learn more about:

--
* Eventing Service memory quota
* How Eventing Service memory quota works
* The distribution of the total memory quota across workers
* The limitations and considerations
* Best practices and recommendations
--
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if you need this bullet list? It's just a summary ofeventing-memory-quota.adoc. I would delete this.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants