JVM heap size specifies the maximum amount of memory that can be consumed by the running java application.
FioranoMQ's memory consumption is mainly dependent on the following objects which are stored in its in-memory data structures:

  • Connections/Sessions/Producers/Consumers objects
  • Destinations (queues/topics) Objects
    • In-memory queue to store non-persistent messages
    • In-memory queue to buffer persistent messages
  • Durable/Non-Durable Subscribers
    • In-memory buffer queue

The minimum JVM heap size can be calculated by adding the memory consumed by each of the above mentioned objects.
Minimum JVM size = (Memory consumed by Connection/Sessions/Producers/Consumers Objects) + (Memory Consumed by in-memory queues of the destination objects) + (Memory consumed by in-memory queues of the durable/non-durable subscribers)
+ (Other miscellaneous resources)
Consider a scenario in which 500 active connections (250 topic connections and 250 queue connections) are active at any point of time. Each Connection contains one session object, which is either associated with a producer or a consumer. There are 10 topics and 10 queues on which all the producers/consumers are evenly distributed.
The sizes of the various buffers are as follows:

Pubsub

  • In memory topic buffer size: 0.5 MB
  • In memory subscriber buffer size: 1 MB

PTP

  • In memory NP message queue size: 1 MB
  • In memory message buffer size: 1 MB
  • Memory Consumption by various Connections/Sessions/Producers/Consumers objects: ~18 MB
  • Memory Consumption by various Destinations:
    • In memory queues to store non-persistent/persistent messages:
      • Topics: 5 MB
      • Queues: 10 MB
    • In -memory subscriber queues: 150 MB (60% of the buffer size is used at most times)
  • Total maximum memory consumption: ~183 MB

So a JVM heap size of 256 MB would be optimum for running the above mentioned high load scenario.
Note: This consumption of memory does not include the memory consumed by other resources like various internal threads started in the server, various file descriptors/data base connections, and so on.

Adaptavist ThemeBuilder EngineAtlassian Confluence