mirror of
				https://github.com/samply/bridgehead.git
				synced 2025-11-04 06:00:18 +01:00 
			
		
		
		
	refactor: optimize memory usage of blaze
This commit is contained in:
		@@ -8,8 +8,8 @@ services:
 | 
				
			|||||||
    container_name: bridgehead-bbmri-blaze
 | 
					    container_name: bridgehead-bbmri-blaze
 | 
				
			||||||
    environment:
 | 
					    environment:
 | 
				
			||||||
      BASE_URL: "http://bridgehead-bbmri-blaze:8080"
 | 
					      BASE_URL: "http://bridgehead-bbmri-blaze:8080"
 | 
				
			||||||
      JAVA_TOOL_OPTIONS: "-Xmx4g"
 | 
					      JAVA_TOOL_OPTIONS: "-Xmx${BLAZE_MEMORY_CAP}m"
 | 
				
			||||||
      LOG_LEVEL: "debug"
 | 
					      DB_BLOCK_CACHE_SIZE: $BLAZE_MEMORY_CAP
 | 
				
			||||||
      ENFORCE_REFERENTIAL_INTEGRITY: "false"
 | 
					      ENFORCE_REFERENTIAL_INTEGRITY: "false"
 | 
				
			||||||
    volumes:
 | 
					    volumes:
 | 
				
			||||||
      - "blaze-data:/app/data"
 | 
					      - "blaze-data:/app/data"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -50,6 +50,7 @@ loadVars() {
 | 
				
			|||||||
		source /etc/bridgehead/$PROJECT.local.conf || fail_and_report 1 "Found /etc/bridgehead/$PROJECT.local.conf but failed to import"
 | 
							source /etc/bridgehead/$PROJECT.local.conf || fail_and_report 1 "Found /etc/bridgehead/$PROJECT.local.conf but failed to import"
 | 
				
			||||||
	fi
 | 
						fi
 | 
				
			||||||
	fetchVarsFromVaultByFile /etc/bridgehead/$PROJECT.conf || fail_and_report 1 "Unable to fetchVarsFromVaultByFile"
 | 
						fetchVarsFromVaultByFile /etc/bridgehead/$PROJECT.conf || fail_and_report 1 "Unable to fetchVarsFromVaultByFile"
 | 
				
			||||||
 | 
						setBlazeMemoryCap
 | 
				
			||||||
	[ -e ./$PROJECT/vars ] && source ./$PROJECT/vars
 | 
						[ -e ./$PROJECT/vars ] && source ./$PROJECT/vars
 | 
				
			||||||
	set +a
 | 
						set +a
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,7 +6,8 @@ services:
 | 
				
			|||||||
    container_name: bridgehead-ccp-blaze
 | 
					    container_name: bridgehead-ccp-blaze
 | 
				
			||||||
    environment:
 | 
					    environment:
 | 
				
			||||||
      BASE_URL: "http://bridgehead-ccp-blaze:8080"
 | 
					      BASE_URL: "http://bridgehead-ccp-blaze:8080"
 | 
				
			||||||
      JAVA_TOOL_OPTIONS: "-Xmx4g"
 | 
					      JAVA_TOOL_OPTIONS: "-Xmx${BLAZE_MEMORY_CAP}m"
 | 
				
			||||||
 | 
					      DB_BLOCK_CACHE_SIZE: $BLAZE_MEMORY_CAP
 | 
				
			||||||
      ENFORCE_REFERENTIAL_INTEGRITY: "false"
 | 
					      ENFORCE_REFERENTIAL_INTEGRITY: "false"
 | 
				
			||||||
    volumes:
 | 
					    volumes:
 | 
				
			||||||
      - "blaze-data:/app/data"
 | 
					      - "blaze-data:/app/data"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -155,6 +155,16 @@ setHostname() {
 | 
				
			|||||||
	fi
 | 
						fi
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					# blaze memory cap should be approximately a quarter of the system memory
 | 
				
			||||||
 | 
					# the memory cap will be applied to both the java heap size and db clock cache
 | 
				
			||||||
 | 
					setBlazeMemoryCap() {
 | 
				
			||||||
 | 
						if [ -z "$BLAZE_MEMORY_CAP" ]; then
 | 
				
			||||||
 | 
						   system_memory=$(grep MemTotal /proc/meminfo | grep -Po '\d+');
 | 
				
			||||||
 | 
						   system_memory_in_mb=$(("$system_memory"/1024));
 | 
				
			||||||
 | 
						   export BLAZE_MEMORY_CAP=$(("$system_memory_in_mb"/4));
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Takes 1) The Backup Directory Path 2) The name of the Service to be backuped
 | 
					# Takes 1) The Backup Directory Path 2) The name of the Service to be backuped
 | 
				
			||||||
# Creates 3 Backups: 1) For the past seven days 2) For the current month and 3) for each calendar week
 | 
					# Creates 3 Backups: 1) For the past seven days 2) For the current month and 3) for each calendar week
 | 
				
			||||||
createEncryptedPostgresBackup(){
 | 
					createEncryptedPostgresBackup(){
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user