# Canton domain reaching size limit

**URL:** <https://forum.canton.network/t/canton-domain-reaching-size-limit/3453>\
**Category:** App Development\
**Tags:** ledger-api, canton\
**Created:** [November 15, 2021, 12:23pm UTC](https://forum.canton.network/t/canton-domain-reaching-size-limit/3453 "2021-11-15T12:23:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dorrit\_Du](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/dorrit_du/32/2417_2.png) [@Dorrit\_Du](https://forum.canton.network/u/Dorrit_Du)\
**Post date:** [November 15, 2021, 12:23pm UTC](https://forum.canton.network/t/canton-domain-reaching-size-limit/3453/1 "2021-11-15T12:23:24Z")

</div>

Hello team,

We have setup a canton network and are trying to do some performance test with 1.) creating 1000+ users and 2.) The daml trigger service is exercising a choice with creating 700+ contracts but giving us the size limit error as below

 ![image](https://canada1.discourse-cdn.com/flex028/uploads/daml/original/2X/2/2d9a77221ec2898e1d53ebbad37e8788e367d1ab.png)

Can you please advise if there is any way to config the domain size or any other walkaround?

thanks,  
Dorrit Du

---

<div class="post-metadata">

**Author:** ![Ratko\_Veprek](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/ratko_veprek/32/206_2.png) [@Ratko\_Veprek](https://forum.canton.network/u/Ratko_Veprek)\
**Post date:** [November 15, 2021, 12:40pm UTC](https://forum.canton.network/t/canton-domain-reaching-size-limit/3453/2 "2021-11-15T12:40:54Z")

</div>

Hi Dorrit!

This is a GRPC rejection by the domain, when the inbound message size is too big. You can increase this by increasing `maxInboundMessageSize`: [https://www.canton.io/docs/dev/scaladoc/com/digitalasset/canton/domain/config/DomainParametersConfig.html](https://www.canton.io/docs/dev/scaladoc/com/digitalasset/canton/domain/config/DomainParametersConfig.html)

So, the domain config should be changed using

```haskell
canton.domains.mydomain.domain-parameters.max-inbound-message-size = 

```

However, note that the participant needs to be configured accordingly:

```haskell
canton.participants.myparticipant.ledger-api.max-inbound-message-size = 

```

Note that the participant setting always must be larger than the one on the domain, as otherwise, the participant will refuse to connect to the domain.

I hope that helps.

Cheers,  
Ratko

---

<div class="post-metadata">

**Author:** ![Dorrit\_Du](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/dorrit_du/32/2417_2.png) [@Dorrit\_Du](https://forum.canton.network/u/Dorrit_Du)\
**Post date:** [November 18, 2021, 7:31am UTC](https://forum.canton.network/t/canton-domain-reaching-size-limit/3453/3 "2021-11-18T07:31:46Z")

</div>

Hi Ratko,

After resolving the inbound message size, we only another heap size issue now message as below.  
Is there a way to increase the heap size canton (i.e. Java) uses via config?

WARN c.d.c.c.ExecutionContextMonitor - Execution context canton-env-execution-context is just slow. Future got executed in the meantime.  
WARN c.d.c.c.ExecutionContextMonitor - Execution context canton-env-execution-context is stuck or slow. My scheduled future has not been processed for at least 3 seconds (queue-size=43).  
ForkJoinIdlenessExecutorService-canton-env-execution-context: [java.util.concurrent.ForkJoinPool@5c8e45a0[Running](mailto:java.util.concurrent.ForkJoinPool@5c8e45a0%5BRunning), parallelism = 2, size = 4, active = 2, running = 2, steals = 1404, tasks = 873, submissions = 43]  
Aborting due to java.lang.OutOfMemoryError: Java heap space

# 

# A fatal error has been detected by the Java Runtime Environment:

# 

# Internal Error (debug.cpp:338), pid=1, tid=34

# fatal error: OutOfMemory encountered: Java heap space

# 

# JRE version: OpenJDK Runtime Environment Zulu11.48+21-CA (11.0.11+9) (build 11.0.11+9-LTS)

# Java VM: OpenJDK 64-Bit Server VM Zulu11.48+21-CA (11.0.11+9-LTS, mixed mode, tiered, compressed oops, g1 gc, linux-amd64)

# Core dump will be written. Default location: Core dumps may be processed with “/usr/share/apport/apport %p %s %c %d %P %E” (or dumping to /canton/core.1)

# 

# An error report file with more information is saved as:

# /tmp/hs\_err\_pid1.log

# 

# If you would like to submit a bug report, please visit:

# [http://www.azulsystems.com/support/](https://protect-us.mimecast.com/s/UE0wCOYGkoiPjYZhE2uk5?domain=azulsystems.com/)

# 

many thanks,  
Dorrit

---

<div class="post-metadata">

**Author:** ![Ratko\_Veprek](https://yyz2.discourse-cdn.com/flex034/user_avatar/forum.canton.network/ratko_veprek/32/206_2.png) [@Ratko\_Veprek](https://forum.canton.network/u/Ratko_Veprek)\
**Post date:** [November 18, 2021, 8:28am UTC](https://forum.canton.network/t/canton-domain-reaching-size-limit/3453/4 "2021-11-18T08:28:12Z")

</div>

Hi @Dorrit_Du

Canton is using the JVM, so you just need to control this using the standard JVM configuration mechanisms:

[https://www.oracle.com/java/technologies/javase/vmoptions-jsp.html](https://www.oracle.com/java/technologies/javase/vmoptions-jsp.html)

You can pass these argument directly to `bin/canton`, i.e. write

```haskell
./bin/canton -Xmx4G 

```

Or you can pass them via the `JAVA_OPTS` environment variable:

```haskell
JAVA_OPTS="-Xmx4G

```

The canton startup script is a very tiny wrapper that invokes `java`, and we just pass through the arguments you define.

I hope this helps.

Cheers,  
Ratko
