Revision 7f39ce17
Added by Andreas Kohlbecker over 12 years ago
src/main/java/eu/etaxonomy/cdm/server/Bootloader.java | ||
---|---|---|
175 | 175 |
|
176 | 176 |
|
177 | 177 |
// memory requirements |
178 |
private static final long MB = 1024 * 1024; |
|
179 |
private static final long PERM_GEN_SPACE_PER_INSTANCE = 64 * MB; |
|
180 |
private static final long HEAP_PER_INSTANCE = 150 * MB; |
|
181 |
|
|
182 | 178 |
private static final int KB = 1024; |
179 |
private static final long MB = 1024 * KB; |
|
180 |
public static final long PERM_GEN_SPACE_PER_INSTANCE = 55 * MB; |
|
181 |
public static final long HEAP_PER_INSTANCE = 130 * MB; |
|
182 |
public static final long PERM_GEN_SPACE_CDMSERVER = 19 * MB; |
|
183 |
public static final long HEAP_CDMSERVER = 15 * MB; |
|
184 |
|
|
183 | 185 |
|
184 | 186 |
|
185 | 187 |
private Set<CdmInstanceProperties> configAndStatusSet = null; |
... | ... | |
557 | 559 |
*/ |
558 | 560 |
private void verifyMemoryRequirements() { |
559 | 561 |
|
560 |
verifyMemoryRequirement("PermGenSpace", PERM_GEN_SPACE_PER_INSTANCE, JvmManager.getPermGenSpaceUsage().getMax()); |
|
561 |
verifyMemoryRequirement("HeapSpace", HEAP_PER_INSTANCE, JvmManager.getHeapMemoryUsage().getMax()); |
|
562 |
verifyMemoryRequirement("PermGenSpace", PERM_GEN_SPACE_CDMSERVER, PERM_GEN_SPACE_PER_INSTANCE, JvmManager.getPermGenSpaceUsage().getMax());
|
|
563 |
verifyMemoryRequirement("HeapSpace", HEAP_CDMSERVER, HEAP_PER_INSTANCE, JvmManager.getHeapMemoryUsage().getMax());
|
|
562 | 564 |
|
563 | 565 |
} |
564 | 566 |
|
565 |
private void verifyMemoryRequirement(String memoryName, long requiredSpacePerIntance, long availableSpace) {
|
|
567 |
private void verifyMemoryRequirement(String memoryName, long requiredSpaceServer, long requiredSpacePerInstance, long availableSpace) {
|
|
566 | 568 |
|
567 | 569 |
|
568 |
long requiredSpace = configAndStatusSet.size() * requiredSpacePerIntance;
|
|
570 |
long recommendedMinimumSpace = calculateRecommendedMinimumSpace(requiredSpaceServer, requiredSpacePerInstance);
|
|
569 | 571 |
|
570 |
if(requiredSpace > availableSpace){
|
|
572 |
if(recommendedMinimumSpace > availableSpace){
|
|
571 | 573 |
|
572 | 574 |
String message = memoryName + " (" |
573 | 575 |
+ (availableSpace / MB) |
574 | 576 |
+ "MB) insufficient for " |
575 | 577 |
+ configAndStatusSet.size() |
576 | 578 |
+ " instances. Increase " + memoryName + " to " |
577 |
+ (requiredSpace / MB)
|
|
579 |
+ (recommendedMinimumSpace / MB)
|
|
578 | 580 |
+ "MB"; |
579 | 581 |
; |
580 | 582 |
logger.error(message + " => disabling some instances!!!"); |
... | ... | |
583 | 585 |
int i=0; |
584 | 586 |
for(CdmInstanceProperties instanceProps : configAndStatusSet){ |
585 | 587 |
i++; |
586 |
if(i * requiredSpacePerIntance > availableSpace){ |
|
588 |
if(i * requiredSpacePerInstance > availableSpace){
|
|
587 | 589 |
instanceProps.setStatus(Status.disabled); |
588 |
instanceProps.getProblems().add("Disbled due to: " + message); |
|
590 |
instanceProps.getProblems().add("Disabled due to: " + message);
|
|
589 | 591 |
} |
590 | 592 |
} |
591 | 593 |
} |
592 | 594 |
} |
593 | 595 |
|
596 |
/** |
|
597 |
* @param requiredServerSpace |
|
598 |
* @param requiredSpacePerIntance |
|
599 |
* @return |
|
600 |
*/ |
|
601 |
public long calculateRecommendedMinimumSpace(long requiredServerSpace, long requiredSpacePerIntance) { |
|
602 |
return (configAndStatusSet.size() * requiredSpacePerIntance) + requiredServerSpace; |
|
603 |
} |
|
604 |
|
|
594 | 605 |
/** |
595 | 606 |
* Configures and adds a {@link RollingFileAppender} to the root logger |
596 | 607 |
* |
Also available in: Unified diff
updating system requirements