keycloak-aplcache

Details

diff --git a/testsuite/performance/pom.xml b/testsuite/performance/pom.xml
index 7a174db..59e5aa6 100755
--- a/testsuite/performance/pom.xml
+++ b/testsuite/performance/pom.xml
@@ -36,6 +36,16 @@
             <version>${project.version}</version>
         </dependency>
         <dependency>
+            <groupId>org.keycloak</groupId>
+            <artifactId>keycloak-model-jpa</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.keycloak</groupId>
+            <artifactId>keycloak-model-mongo</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
             <groupId>org.jboss.resteasy</groupId>
             <artifactId>resteasy-jaxrs</artifactId>
             <scope>provided</scope>
@@ -60,6 +70,10 @@
             <scope>provided</scope>
         </dependency>
         <dependency>
+            <groupId>net.iharder</groupId>
+            <artifactId>base64</artifactId>
+        </dependency>
+        <dependency>
             <groupId>org.apache.jmeter</groupId>
             <artifactId>ApacheJMeter_java</artifactId>
         </dependency>
@@ -116,7 +130,7 @@
                         <dependencies>
                             <dependency>
                                 <groupId>org.keycloak</groupId>
-                                <artifactId>keycloak-testsuite</artifactId>
+                                <artifactId>keycloak-testsuite-performance</artifactId>
                                 <version>${project.version}</version>
                                 <type>test-jar</type>
                             </dependency>
diff --git a/testsuite/performance/README.md b/testsuite/performance/README.md
new file mode 100644
index 0000000..4e6a842
--- /dev/null
+++ b/testsuite/performance/README.md
@@ -0,0 +1,39 @@
+Configuration of performance test
+=================================
+- At this moment it's src/test/jmeter/keycloak_perf_test.jmx where you can configure among other things:
+-- "ThreadGroup.num_threads" -- number of worker threads
+-- "LoopController.loops" -- Number of loops per each thread.
+
+
+- src/test/jmeter/system.properties -- System properties including configuration of providers. Allow to specify:
+-- which model to use
+-- which test to run
+-- configuration of individual tests. Properties for each test documented in the file
+
+Running performance tests
+=========================
+cd KEYCLOAK_HOME/testsuite
+mvn clean install -DskipTests=true -Pperformance-tests
+
+Results:
+- Log is in: testsuite/performance/target/jmeter/logs/keycloak_perf_test.jmx.log
+- More charts and reports are inside: testsuite/performance/target/jmeter/results/
+
+
+Example for running test
+========================
+Run:
+mvn clean install -DskipTests=true -Pperformance-tests
+with OOTB configuration (Assumption is mongo running on 27017 as it's using mongo by default). This will create 10 new realms.
+
+Then change keycloak_perf_test.jmx to have
+ "ThreadGroup.num_threads" to 10 and
+ "LoopController.loops" to 100
+And change "keycloak.perf.workerClass" to "org.keycloak.testsuite.performance.CreateUsersWorker" in system.properties
+
+Then run again:
+mvn clean install -DskipTests=true -Pperformance-tests
+This will create 1000 new users (10 worker threads and each worker doing 100 iterations. Each worker is creating users in separate realm)
+
+TODO: Easier configuration without need to edit config files, more user friendly, easier to configure and run test
+
diff --git a/testsuite/performance/src/test/jmeter/system.properties b/testsuite/performance/src/test/jmeter/system.properties
index c1cdda4..cbe7be8 100644
--- a/testsuite/performance/src/test/jmeter/system.properties
+++ b/testsuite/performance/src/test/jmeter/system.properties
@@ -1,6 +1,6 @@
 ## Choose implementation of KeycloakSessionFactory
-# keycloak.sessionFactory=picketlink
-keycloak.sessionFactory=mongo
+# keycloak.model.provider=jpa
+keycloak.model.provider=mongo
 
 ## Configure JPA (just hbm2ddl schema configurable here. Rest of the stuff in META-INF/persistence.xml)
 keycloak.jpa.hbm2ddl.auto=create
@@ -10,9 +10,9 @@ keycloak.jpa.hbm2ddl.auto=create
 ## Configure MongoDB (Useful just when keycloak.sessionFactory=mongo)
 keycloak.model.mongo.host=localhost
 keycloak.model.mongo.port=27017
-keycloak.model.mongo.databaseName=keycloakPerfTest
+keycloak.model.mongo.db=keycloakPerfTest
 # Should be DB dropped at startup of the test?
-keycloak.model.mongo.dropDatabaseOnStartup=true
+keycloak.model.mongo.clearOnStartup=false
 
 
 ## Specify Keycloak worker class