ouvtam created JAMES-4200:
-----------------------------
Summary: ActiveMQ: prevent auto-adjusting usage limits for broker
Key: JAMES-4200
URL: https://issues.apache.org/jira/browse/JAMES-4200
Project: James Server
Issue Type: Bug
Components: Queue
Reporter: ouvtam
h1. Problem
While investigating JAMES-4192 I noticed the broker setting
{{adjustUsageLimits}} that defaults to true. When running an embedded
BrokerService in James the BrokerService might increase its memory limit up to
70% of the JVM heap, causing memory drain for James (see code excerpt below).
It would lead to fewer surprises setting {{adjustUsageLimits}} to false.
h1. Details
System usage defaults (org.apache.activemq.broker.BrokerService):
{code:java}
public SystemUsage getSystemUsage() {
try {
if (systemUsage == null) {
systemUsage = new SystemUsage("Main", getPersistenceAdapter(),
getTempDataStore(), getJobSchedulerStore());
systemUsage.setExecutor(getExecutor());
systemUsage.getMemoryUsage().setLimit(1024L * 1024 * 1024 * 1); //
1 GB
systemUsage.getTempUsage().setLimit(1024L * 1024 * 1024 * 50); //
50 GB
systemUsage.getStoreUsage().setLimit(1024L * 1024 * 1024 * 100); //
100 GB
systemUsage.getJobSchedulerUsage().setLimit(1024L * 1024 * 1024 *
50); // 50 GB
addService(this.systemUsage);
}
return systemUsage;
} catch (IOException e) {
LOG.error("Cannot create SystemUsage", e);
throw new RuntimeException("Fatally failed to create SystemUsage" +
e.getMessage(), e);
}
}
...
protected void checkMemorySystemUsageLimits() throws Exception {
final SystemUsage usage = getSystemUsage();
long memLimit = usage.getMemoryUsage().getLimit();
long jvmLimit = Runtime.getRuntime().maxMemory();
if (memLimit > jvmLimit) {
final String message = "Memory Usage for the Broker (" + memLimit /
(1024 * 1024)
+ "mb) is more than the maximum available for the JVM: " +
jvmLimit / (1024 * 1024);
if (adjustUsageLimits) {
usage.getMemoryUsage().setPercentOfJvmHeap(70);
LOG.warn("{} mb - resetting to 70% of maximum available: {}",
message, (usage.getMemoryUsage().getLimit() / (1024 *
1024)));
} else {
LOG.error(message);
throw new ConfigurationException(message);
}
}
} {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]