This is an automated email from the ASF dual-hosted git repository. fschumacher pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/jmeter.git
commit cca089de696f1e8d1a51207dbe8a24def35c94a6 Author: David Pecollet <david.pecol...@gmail.com> AuthorDate: Fri Jan 8 11:22:16 2021 +0000 Connection Pool Max Size parameter added to Bolt Connection Config Allows to specify a pool size larger than the default 100, which can become a bottleneck with large number of threads using a single Neo4j driver. Also improve Bolt URI description to describe neo4j:// format. --- .../protocol/bolt/config/BoltConnectionElement.java | 16 +++++++++++++++- .../bolt/config/BoltConnectionElementBeanInfo.java | 5 ++++- .../config/BoltConnectionElementResources.properties | 4 +++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/config/BoltConnectionElement.java b/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/config/BoltConnectionElement.java index c3211dc..8b1a41f 100644 --- a/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/config/BoltConnectionElement.java +++ b/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/config/BoltConnectionElement.java @@ -26,11 +26,13 @@ import org.apache.jmeter.testelement.TestStateListener; import org.apache.jmeter.threads.JMeterContextService; import org.apache.jmeter.threads.JMeterVariables; import org.neo4j.driver.AuthTokens; +import org.neo4j.driver.Config; import org.neo4j.driver.Driver; import org.neo4j.driver.GraphDatabase; import org.slf4j.Logger; import org.slf4j.LoggerFactory; + @TestElementMetadata(labelResource = "displayName") public class BoltConnectionElement extends AbstractTestElement implements ConfigElement, TestStateListener, TestBean { @@ -39,6 +41,7 @@ public class BoltConnectionElement extends AbstractTestElement private String boltUri; private String username; private String password; + private int maxConnectionPoolSize; private Driver driver; public static final String BOLT_CONNECTION = "boltConnection"; @@ -65,7 +68,10 @@ public class BoltConnectionElement extends AbstractTestElement log.error("Bolt connection already exists"); } else { synchronized (this) { - driver = GraphDatabase.driver(getBoltUri(), AuthTokens.basic(getUsername(), getPassword())); + Config config = Config.builder() + .withMaxConnectionPoolSize( getMaxConnectionPoolSize() ) + .build(); + driver = GraphDatabase.driver(getBoltUri(), AuthTokens.basic(getUsername(), getPassword()), config); variables.putObject(BOLT_CONNECTION, driver); } } @@ -100,6 +106,14 @@ public class BoltConnectionElement extends AbstractTestElement this.boltUri = boltUri; } + public int getMaxConnectionPoolSize() { + return maxConnectionPoolSize; + } + + public void setMaxConnectionPoolSize(int maxConnectionPoolSize) { + this.maxConnectionPoolSize = maxConnectionPoolSize; + } + public String getUsername() { return username; } diff --git a/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/config/BoltConnectionElementBeanInfo.java b/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/config/BoltConnectionElementBeanInfo.java index 9a8b75f..40711d4 100644 --- a/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/config/BoltConnectionElementBeanInfo.java +++ b/src/protocol/bolt/src/main/java/org/apache/jmeter/protocol/bolt/config/BoltConnectionElementBeanInfo.java @@ -33,7 +33,7 @@ public class BoltConnectionElementBeanInfo extends BeanInfoSupport { public BoltConnectionElementBeanInfo() { super(BoltConnectionElement.class); - createPropertyGroup("connection", new String[] { "boltUri", "username", "password" }); + createPropertyGroup("connection", new String[] { "boltUri", "username", "password", "maxConnectionPoolSize" }); PropertyDescriptor propertyDescriptor = property("boltUri"); propertyDescriptor.setValue(NOT_UNDEFINED, Boolean.TRUE); @@ -44,6 +44,9 @@ public class BoltConnectionElementBeanInfo extends BeanInfoSupport { propertyDescriptor = property("password", TypeEditor.PasswordEditor); propertyDescriptor.setValue(NOT_UNDEFINED, Boolean.TRUE); propertyDescriptor.setValue(DEFAULT, ""); + propertyDescriptor = property("maxConnectionPoolSize"); + propertyDescriptor.setValue(NOT_UNDEFINED, Boolean.TRUE); + propertyDescriptor.setValue(DEFAULT, 100); if(log.isDebugEnabled()) { String descriptorsAsString = Arrays.stream(getPropertyDescriptors()) diff --git a/src/protocol/bolt/src/main/resources/org/apache/jmeter/protocol/bolt/config/BoltConnectionElementResources.properties b/src/protocol/bolt/src/main/resources/org/apache/jmeter/protocol/bolt/config/BoltConnectionElementResources.properties index 98d2cc6..85d922d 100644 --- a/src/protocol/bolt/src/main/resources/org/apache/jmeter/protocol/bolt/config/BoltConnectionElementResources.properties +++ b/src/protocol/bolt/src/main/resources/org/apache/jmeter/protocol/bolt/config/BoltConnectionElementResources.properties @@ -18,8 +18,10 @@ displayName=Bolt Connection Configuration connection.displayName=Bolt Configuration boltUri.displayName=Bolt URI -boltUri.shortDescription=Bolt URI +boltUri.shortDescription=Bolt URI<br>for a direct connection: bolt://<HOST>:<PORT><br>for a cluster: neo4j://<HOST>:<PORT>[?<ROUTING_CONTEXT>]) username.displayName=Username username.shortDescription=Username password.displayName=Password password.shortDescription=Password +maxConnectionPoolSize.displayName=Connection Pool Max Size +maxConnectionPoolSize.shortDescription=Size limit for the pool of Bolt connections