This is an automated email from the ASF dual-hosted git repository. liuyu pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/pulsar-site.git
The following commit(s) were added to refs/heads/main by this push: new c6e20d6bed4 Add client memory limits docs. (#571) c6e20d6bed4 is described below commit c6e20d6bed4b53907cbe2028d94bdec362486fd1 Author: Baodi Shi <wudixiaolong...@icloud.com> AuthorDate: Mon May 15 08:51:12 2023 +0800 Add client memory limits docs. (#571) --- docs/client-libraries-clients.md | 32 ++++++++++++++++++++++ .../version-3.0.x/client-libraries-clients.md | 32 ++++++++++++++++++++++ 2 files changed, 64 insertions(+) diff --git a/docs/client-libraries-clients.md b/docs/client-libraries-clients.md index c898b13ff42..cdb3be05a6c 100644 --- a/docs/client-libraries-clients.md +++ b/docs/client-libraries-clients.md @@ -51,4 +51,36 @@ The following example creates a Python client using multiple advertised listener </TabItem> </Tabs> +```` + +## Set memory limits + +You can use memory limits parameters to control the total client memory usage, +the producers and consumers under this client will compete for the memory assigned. For implementation details, see [PIP 74: Pulsar client memory limits](https://github.com/apache/pulsar/wiki/PIP-74%3A-Pulsar-client-memory-limits). + +````mdx-code-block +<Tabs groupId="lang-choice" +defaultValue="Java" +values={[{"label":"Java","value":"Java"},{"label":"Go","value":"Go"}]}> +<TabItem value="Java"> + + ```java + PulsarClient client = PulsarClient.builder() + .serviceUrl("pulsar://xxxx:6650") + .memoryLimit(64, SizeUnit.MEGA_BYTES) + .build(); + ``` + +</TabItem> +<TabItem value="Go"> + + ```go + client, err := pulsar.NewClient(pulsar.ClientOptions{ + URL: "pulsar://xxxx:6650", + MemoryLimitBytes: 64 * 1024 * 1024, // Unit: byte + }) + ``` + +</TabItem> +</Tabs> ```` \ No newline at end of file diff --git a/versioned_docs/version-3.0.x/client-libraries-clients.md b/versioned_docs/version-3.0.x/client-libraries-clients.md index c898b13ff42..83a95290f19 100644 --- a/versioned_docs/version-3.0.x/client-libraries-clients.md +++ b/versioned_docs/version-3.0.x/client-libraries-clients.md @@ -51,4 +51,36 @@ The following example creates a Python client using multiple advertised listener </TabItem> </Tabs> +```` + +## Set memory limits + +You can uses memory limits param to control client overall memory usage, +the producers and consumers under this client will compete for the memory assigned. See [PIP 74: Pulsar client memory limits](https://github.com/apache/pulsar/wiki/PIP-74%3A-Pulsar-client-memory-limits) + +````mdx-code-block +<Tabs groupId="lang-choice" +defaultValue="Java" +values={[{"label":"Java","value":"Java"},{"label":"Go","value":"Go"}]}> +<TabItem value="Java"> + + ```java + PulsarClient client = PulsarClient.builder() + .serviceUrl("pulsar://xxxx:6650") + .memoryLimit(64, SizeUnit.MEGA_BYTES) + .build(); + ``` + +</TabItem> +<TabItem value="Go"> + + ```go + client, err := pulsar.NewClient(pulsar.ClientOptions{ + URL: "pulsar://xxxx:6650", + MemoryLimitBytes: 64 * 1024 * 1024, // Unit: byte + }) + ``` + +</TabItem> +</Tabs> ```` \ No newline at end of file