- Added configuration parameters for search coordinator thread pool sizes
- Added database connection pool size configuration parameter (spring.datasource.hikari.maximum-pool-size) - Fixed a bug in parsing elastic rest_url for all FHIR versions except for R4, which was correct.
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -15,7 +15,7 @@
|
|||||||
<groupId>ca.uhn.hapi.fhir</groupId>
|
<groupId>ca.uhn.hapi.fhir</groupId>
|
||||||
<artifactId>hapi-fhir</artifactId>
|
<artifactId>hapi-fhir</artifactId>
|
||||||
<!-- FIMXME KBD Change this to 5.3.0 BEFORE merging this code to master ! -->
|
<!-- FIMXME KBD Change this to 5.3.0 BEFORE merging this code to master ! -->
|
||||||
<version>5.3.0</version>
|
<version>5.4.0-PRE1-SNAPSHOT</version>
|
||||||
</parent>
|
</parent>
|
||||||
|
|
||||||
<artifactId>hapi-fhir-jpaserver-starter</artifactId>
|
<artifactId>hapi-fhir-jpaserver-starter</artifactId>
|
||||||
|
|||||||
@@ -67,6 +67,10 @@ public class AppProperties {
|
|||||||
private Boolean lastn_enabled = false;
|
private Boolean lastn_enabled = false;
|
||||||
private NormalizedQuantitySearchLevel normalized_quantity_search_level = NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED;
|
private NormalizedQuantitySearchLevel normalized_quantity_search_level = NormalizedQuantitySearchLevel.NORMALIZED_QUANTITY_SEARCH_NOT_SUPPORTED;
|
||||||
|
|
||||||
|
private Integer search_coord_core_pool_size = 20;
|
||||||
|
private Integer search_coord_max_pool_size = 100;
|
||||||
|
private Integer search_coord_queue_capacity = 200;
|
||||||
|
|
||||||
public Integer getDefer_indexing_for_codesystems_of_size() {
|
public Integer getDefer_indexing_for_codesystems_of_size() {
|
||||||
return defer_indexing_for_codesystems_of_size;
|
return defer_indexing_for_codesystems_of_size;
|
||||||
}
|
}
|
||||||
@@ -422,6 +426,23 @@ public class AppProperties {
|
|||||||
this.normalized_quantity_search_level = normalized_quantity_search_level;
|
this.normalized_quantity_search_level = normalized_quantity_search_level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Integer getSearch_coord_core_pool_size() { return search_coord_core_pool_size; }
|
||||||
|
|
||||||
|
public void setSearch_coord_core_pool_size(Integer search_coord_core_pool_size) {
|
||||||
|
this.search_coord_core_pool_size = search_coord_core_pool_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getSearch_coord_max_pool_size() { return search_coord_max_pool_size; }
|
||||||
|
|
||||||
|
public void setSearch_coord_max_pool_size(Integer search_coord_max_pool_size) {
|
||||||
|
this.search_coord_max_pool_size = search_coord_max_pool_size;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Integer getSearch_coord_queue_capacity() { return search_coord_queue_capacity; }
|
||||||
|
|
||||||
|
public void setSearch_coord_queue_capacity(Integer search_coord_queue_capacity) {
|
||||||
|
this.search_coord_queue_capacity = search_coord_queue_capacity;
|
||||||
|
}
|
||||||
|
|
||||||
public static class Cors {
|
public static class Cors {
|
||||||
private Boolean allow_Credentials = true;
|
private Boolean allow_Credentials = true;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ import org.springframework.core.env.ConfigurableEnvironment;
|
|||||||
import org.springframework.orm.jpa.JpaTransactionManager;
|
import org.springframework.orm.jpa.JpaTransactionManager;
|
||||||
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.persistence.EntityManagerFactory;
|
import javax.persistence.EntityManagerFactory;
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
@@ -31,6 +32,19 @@ public class FhirServerConfigDstu2 extends BaseJavaConfigDstu2 {
|
|||||||
@Autowired
|
@Autowired
|
||||||
AppProperties appProperties;
|
AppProperties appProperties;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void initSettings() {
|
||||||
|
if(appProperties.getSearch_coord_core_pool_size() != null) {
|
||||||
|
setSearchCoordCorePoolSize(appProperties.getSearch_coord_core_pool_size());
|
||||||
|
}
|
||||||
|
if(appProperties.getSearch_coord_max_pool_size() != null) {
|
||||||
|
setSearchCoordMaxPoolSize(appProperties.getSearch_coord_max_pool_size());
|
||||||
|
}
|
||||||
|
if(appProperties.getSearch_coord_queue_capacity() != null) {
|
||||||
|
setSearchCoordQueueCapacity(appProperties.getSearch_coord_queue_capacity());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DatabaseBackedPagingProvider databaseBackedPagingProvider() {
|
public DatabaseBackedPagingProvider databaseBackedPagingProvider() {
|
||||||
DatabaseBackedPagingProvider pagingProvider = super.databaseBackedPagingProvider();
|
DatabaseBackedPagingProvider pagingProvider = super.databaseBackedPagingProvider();
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import org.springframework.core.env.ConfigurableEnvironment;
|
|||||||
import org.springframework.orm.jpa.JpaTransactionManager;
|
import org.springframework.orm.jpa.JpaTransactionManager;
|
||||||
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.persistence.EntityManagerFactory;
|
import javax.persistence.EntityManagerFactory;
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
@@ -29,6 +30,20 @@ public class FhirServerConfigDstu3 extends BaseJavaConfigDstu3 {
|
|||||||
@Autowired
|
@Autowired
|
||||||
AppProperties appProperties;
|
AppProperties appProperties;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void initSettings() {
|
||||||
|
if(appProperties.getSearch_coord_core_pool_size() != null) {
|
||||||
|
setSearchCoordCorePoolSize(appProperties.getSearch_coord_core_pool_size());
|
||||||
|
}
|
||||||
|
if(appProperties.getSearch_coord_max_pool_size() != null) {
|
||||||
|
setSearchCoordMaxPoolSize(appProperties.getSearch_coord_max_pool_size());
|
||||||
|
}
|
||||||
|
if(appProperties.getSearch_coord_queue_capacity() != null) {
|
||||||
|
setSearchCoordQueueCapacity(appProperties.getSearch_coord_queue_capacity());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DatabaseBackedPagingProvider databaseBackedPagingProvider() {
|
public DatabaseBackedPagingProvider databaseBackedPagingProvider() {
|
||||||
DatabaseBackedPagingProvider pagingProvider = super.databaseBackedPagingProvider();
|
DatabaseBackedPagingProvider pagingProvider = super.databaseBackedPagingProvider();
|
||||||
@@ -68,7 +83,12 @@ public class FhirServerConfigDstu3 extends BaseJavaConfigDstu3 {
|
|||||||
public ElasticsearchSvcImpl elasticsearchSvc() {
|
public ElasticsearchSvcImpl elasticsearchSvc() {
|
||||||
if (EnvironmentHelper.isElasticsearchEnabled(configurableEnvironment)) {
|
if (EnvironmentHelper.isElasticsearchEnabled(configurableEnvironment)) {
|
||||||
String elasticsearchUrl = EnvironmentHelper.getElasticsearchServerUrl(configurableEnvironment);
|
String elasticsearchUrl = EnvironmentHelper.getElasticsearchServerUrl(configurableEnvironment);
|
||||||
String elasticsearchHost = elasticsearchUrl.substring(elasticsearchUrl.indexOf("://")+3, elasticsearchUrl.lastIndexOf(":"));
|
String elasticsearchHost;
|
||||||
|
if (elasticsearchUrl.startsWith("http")) {
|
||||||
|
elasticsearchHost = elasticsearchUrl.substring(elasticsearchUrl.indexOf("://") + 3, elasticsearchUrl.lastIndexOf(":"));
|
||||||
|
} else {
|
||||||
|
elasticsearchHost = elasticsearchUrl.substring(0, elasticsearchUrl.indexOf(":"));
|
||||||
|
}
|
||||||
String elasticsearchUsername = EnvironmentHelper.getElasticsearchServerUsername(configurableEnvironment);
|
String elasticsearchUsername = EnvironmentHelper.getElasticsearchServerUsername(configurableEnvironment);
|
||||||
String elasticsearchPassword = EnvironmentHelper.getElasticsearchServerPassword(configurableEnvironment);
|
String elasticsearchPassword = EnvironmentHelper.getElasticsearchServerPassword(configurableEnvironment);
|
||||||
int elasticsearchPort = Integer.parseInt(elasticsearchUrl.substring(elasticsearchUrl.lastIndexOf(":")+1));
|
int elasticsearchPort = Integer.parseInt(elasticsearchUrl.substring(elasticsearchUrl.lastIndexOf(":")+1));
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import org.springframework.core.env.ConfigurableEnvironment;
|
|||||||
import org.springframework.orm.jpa.JpaTransactionManager;
|
import org.springframework.orm.jpa.JpaTransactionManager;
|
||||||
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.persistence.EntityManagerFactory;
|
import javax.persistence.EntityManagerFactory;
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
@@ -31,6 +32,19 @@ public class FhirServerConfigR4 extends BaseJavaConfigR4 {
|
|||||||
@Autowired
|
@Autowired
|
||||||
AppProperties appProperties;
|
AppProperties appProperties;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void initSettings() {
|
||||||
|
if(appProperties.getSearch_coord_core_pool_size() != null) {
|
||||||
|
setSearchCoordCorePoolSize(appProperties.getSearch_coord_core_pool_size());
|
||||||
|
}
|
||||||
|
if(appProperties.getSearch_coord_max_pool_size() != null) {
|
||||||
|
setSearchCoordMaxPoolSize(appProperties.getSearch_coord_max_pool_size());
|
||||||
|
}
|
||||||
|
if(appProperties.getSearch_coord_queue_capacity() != null) {
|
||||||
|
setSearchCoordQueueCapacity(appProperties.getSearch_coord_queue_capacity());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DatabaseBackedPagingProvider databaseBackedPagingProvider() {
|
public DatabaseBackedPagingProvider databaseBackedPagingProvider() {
|
||||||
DatabaseBackedPagingProvider pagingProvider = super.databaseBackedPagingProvider();
|
DatabaseBackedPagingProvider pagingProvider = super.databaseBackedPagingProvider();
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import org.springframework.core.env.ConfigurableEnvironment;
|
|||||||
import org.springframework.orm.jpa.JpaTransactionManager;
|
import org.springframework.orm.jpa.JpaTransactionManager;
|
||||||
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
import javax.persistence.EntityManagerFactory;
|
import javax.persistence.EntityManagerFactory;
|
||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
@@ -32,6 +33,19 @@ public class FhirServerConfigR5 extends BaseJavaConfigR5 {
|
|||||||
@Autowired
|
@Autowired
|
||||||
AppProperties appProperties;
|
AppProperties appProperties;
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void initSettings() {
|
||||||
|
if(appProperties.getSearch_coord_core_pool_size() != null) {
|
||||||
|
setSearchCoordCorePoolSize(appProperties.getSearch_coord_core_pool_size());
|
||||||
|
}
|
||||||
|
if(appProperties.getSearch_coord_max_pool_size() != null) {
|
||||||
|
setSearchCoordMaxPoolSize(appProperties.getSearch_coord_max_pool_size());
|
||||||
|
}
|
||||||
|
if(appProperties.getSearch_coord_queue_capacity() != null) {
|
||||||
|
setSearchCoordQueueCapacity(appProperties.getSearch_coord_queue_capacity());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DatabaseBackedPagingProvider databaseBackedPagingProvider() {
|
public DatabaseBackedPagingProvider databaseBackedPagingProvider() {
|
||||||
DatabaseBackedPagingProvider pagingProvider = super.databaseBackedPagingProvider();
|
DatabaseBackedPagingProvider pagingProvider = super.databaseBackedPagingProvider();
|
||||||
@@ -71,7 +85,12 @@ public class FhirServerConfigR5 extends BaseJavaConfigR5 {
|
|||||||
public ElasticsearchSvcImpl elasticsearchSvc() {
|
public ElasticsearchSvcImpl elasticsearchSvc() {
|
||||||
if (EnvironmentHelper.isElasticsearchEnabled(configurableEnvironment)) {
|
if (EnvironmentHelper.isElasticsearchEnabled(configurableEnvironment)) {
|
||||||
String elasticsearchUrl = EnvironmentHelper.getElasticsearchServerUrl(configurableEnvironment);
|
String elasticsearchUrl = EnvironmentHelper.getElasticsearchServerUrl(configurableEnvironment);
|
||||||
String elasticsearchHost = elasticsearchUrl.substring(elasticsearchUrl.indexOf("://")+3, elasticsearchUrl.lastIndexOf(":"));
|
String elasticsearchHost;
|
||||||
|
if (elasticsearchUrl.startsWith("http")) {
|
||||||
|
elasticsearchHost = elasticsearchUrl.substring(elasticsearchUrl.indexOf("://") + 3, elasticsearchUrl.lastIndexOf(":"));
|
||||||
|
} else {
|
||||||
|
elasticsearchHost = elasticsearchUrl.substring(0, elasticsearchUrl.indexOf(":"));
|
||||||
|
}
|
||||||
String elasticsearchUsername = EnvironmentHelper.getElasticsearchServerUsername(configurableEnvironment);
|
String elasticsearchUsername = EnvironmentHelper.getElasticsearchServerUsername(configurableEnvironment);
|
||||||
String elasticsearchPassword = EnvironmentHelper.getElasticsearchServerPassword(configurableEnvironment);
|
String elasticsearchPassword = EnvironmentHelper.getElasticsearchServerPassword(configurableEnvironment);
|
||||||
int elasticsearchPort = Integer.parseInt(elasticsearchUrl.substring(elasticsearchUrl.lastIndexOf(":")+1));
|
int elasticsearchPort = Integer.parseInt(elasticsearchUrl.substring(elasticsearchUrl.lastIndexOf(":")+1));
|
||||||
|
|||||||
@@ -6,6 +6,10 @@ spring:
|
|||||||
password: null
|
password: null
|
||||||
driverClassName: org.h2.Driver
|
driverClassName: org.h2.Driver
|
||||||
max-active: 15
|
max-active: 15
|
||||||
|
|
||||||
|
# database connection pool size
|
||||||
|
hikari:
|
||||||
|
maximum-pool-size: 10
|
||||||
jpa:
|
jpa:
|
||||||
properties:
|
properties:
|
||||||
hibernate.format_sql: false
|
hibernate.format_sql: false
|
||||||
@@ -83,6 +87,11 @@ hapi:
|
|||||||
# allowed_origin:
|
# allowed_origin:
|
||||||
# - '*'
|
# - '*'
|
||||||
|
|
||||||
|
# Search coordinator thread pool sizes
|
||||||
|
search-coord-core-pool-size: 20
|
||||||
|
search-coord-max-pool-size: 100
|
||||||
|
search-coord-queue-capacity: 200
|
||||||
|
|
||||||
# logger:
|
# logger:
|
||||||
# error_format: 'ERROR - ${requestVerb} ${requestUrl}'
|
# error_format: 'ERROR - ${requestVerb} ${requestUrl}'
|
||||||
# format: >-
|
# format: >-
|
||||||
|
|||||||
Reference in New Issue
Block a user