Browse Source

OfficeFloor - fix db dead lock (#4190)

* Plain text test implemented

* Providing a test class per Tech Empower test

* Providing abstract class for generic testing

* Adding JSON serialise test

* Initial work on Single Database Query test

* Single Database Query test written.

* Multiple Database Queries Test

* Added Fortunes test

* All tests 1-6 written

* Json Serialisation requires JsonResponseWriter to specify the
Content-Type header.

* Single Query passing tests

* Multiple database queries passing

* Initial work on Fortunes test

* Fortunes test passing

* Passing unit tests

* Providing connection pooling and not logging.

* Providing threading configuration for database interaction

* Fixing issues with Database Update Test

* Tests are passing

* Setup of OfficeFloor to run in TechEmpire environment.

* Including production data source file

* Tests passing

* Tests now running in Vagrant VM

* Cleaning up start now that working.

* Should not have empty directory

* Plain text test implemented

* Providing a test class per Tech Empower test

* Providing abstract class for generic testing

* Adding JSON serialise test

* Initial work on Single Database Query test

* Single Database Query test written.

* Multiple Database Queries Test

* Added Fortunes test

* All tests 1-6 written

* Json Serialisation requires JsonResponseWriter to specify the
Content-Type header.

* Single Query passing tests

* Multiple database queries passing

* Initial work on Fortunes test

* Fortunes test passing

* Passing unit tests

* Providing connection pooling and not logging.

* Providing threading configuration for database interaction

* Fixing issues with Database Update Test

* Tests are passing

* Setup of OfficeFloor to run in TechEmpire environment.

* Including production data source file

* Tests passing

* Tests now running in Vagrant VM

* Cleaning up start now that working.

* Should not have empty directory

* Passing latest rebase of FrameworkBenchmarks.

* Migrating to version 3.0.0

* Run own comparison with just top level frameworks

* Fix file name spelling

* Providing readme placeholder for OfficeFloor

* Fixing for TTY not available in Jenkins

* Removing OfficeFloor to run setup script

* Initial setup

* Initial project setup

* OfficeFloor implementation passing tests

* Building OfficeFloor

* Fixing path

* Raw OfficeFloor

* Specifying SourceForge repository for sourcing

* Passing build - new SQL fix

* Able to be called for verify for officefloor-raw

* Adding Server / Date headers

* Configuring Postgresql

* Threading access to multiple queries on database

* Running all tests

* Fixing tests to pass verification

* re-useable tests for different implementations

* Pooling Connections

* Adding micro tests

* Providing micro, netty and rapidoid implementations

* Providing throttle active request count value

* Fixing spelling causing failed run

* Initial work to attempt to cache for local runs

* Fixing to start postgres for micro

* Improving Updates and Fortunes performance

* Reducing possible contention in database for updates

* Providing raw with DB functionality

* Including additional raw tests

* Including database for raw

* Fixing logic

* Ready for submission

* Ready for submission

* Cleaning up based on Tech Empower feedback:

 - Removing tests
 - Removing source_files
 - Also bumping up to use Java 10

* Removing test resources

* Fixing netty / rapidoid builds

Simplified build process to only build the project.  However, netty and
rapidoid depend on the benchmark default project for the implementation
(and just change the HTTP server).  Therefore, installing benchmark
first to allow the dependency to be resolved.

* Fixing for not finding parent pom

* Reverting back to Java 8

Issue with running with Java 10.  Will run in Java 8 for time being and
work on resolving this issue when more time.

* Increasing time for checking server up

Travis seems to run many builds at the same time, and concerned that may
be starving for thread to check causing timeout...  and subsequently
causing false positives.

* Working with Java 10

* Allowing to run on different port

CI server running on 8080 (so unable to start in unit tests)

* Updating to 3.1.0

Also, avoiding memory resizing issues reducing performance.

* Register Afterburner

* Configuring for entity manager to use connection

* thread-per-request example

* Run in quiet mode so can see errors in travis logs

This should avoid filling build logs with download progress

* Using batch to show build

* Fix connection string

* quiet build

* Reducing connection pool sizes for improved performance

* Raw able to use async from pgsql2

* officefloor-raw passing fortunes test

* Raw using ADBA for PostgreSql

* Fixing to handle bounds check

* Providing error handling to not hold up query

* Providing Thread Affinity for Raw

* Specifying the team sizes

* Providing Thread Affinity server for comparison

* Upgrading driver version for PostgreSQL

Also, tidying up Java params for optimising

* Fixing docker build of thread affinity

* Updating to OfficeFloor 3.2.0

* Tidy up of team sizes

* Removing throttle

* Fixing for OfficeFloor 3.3.0

[ci fw-only officefloor]

* [ci fw-only Java/officefloor]

* 10000 to 10001 for nextInt() exclusive upper bound

[cd fw-only Java/officefloor]

* Fixing dead lock in database

[ci fw-only Java/officefloor]

* Fixing for OfficeFloor cancel management

[ci fw-only Java/officefloor]
Daniel 6 years ago
parent
commit
b0f8066d4f

+ 7 - 1
frameworks/Java/officefloor/src/woof_benchmark/src/main/java/net/officefloor/benchmark/Logic.java

@@ -1,5 +1,6 @@
 package net.officefloor.benchmark;
 
+import java.util.Arrays;
 import java.util.concurrent.ThreadLocalRandom;
 
 import javax.persistence.EntityManager;
@@ -49,9 +50,14 @@ public class Logic {
 			ObjectResponse<World[]> response) {
 		ThreadLocalRandom random = ThreadLocalRandom.current();
 		int count = getQueryCount(queries);
+		int[] ids = new int[count];
+		for (int i = 0; i < ids.length; i++) {
+			ids[i] = random.nextInt(1, 10001);
+		}
+		Arrays.sort(ids);
 		World[] worlds = new World[count];
 		for (int i = 0; i < worlds.length; i++) {
-			worlds[i] = entityManager.find(World.class, random.nextInt(1, 10001));
+			worlds[i] = entityManager.find(World.class, ids[i]);
 			worlds[i].setRandomNumber(random.nextInt(1, 10001));
 		}
 		response.send(worlds);

+ 5 - 1
frameworks/Java/officefloor/src/woof_raw/src/main/java/net/officefloor/benchmark/RawOfficeFloorMain.java

@@ -32,6 +32,7 @@ import com.fasterxml.jackson.module.afterburner.AfterburnerModule;
 import lombok.Data;
 import net.officefloor.frame.api.executive.Executive;
 import net.officefloor.frame.api.manage.OfficeFloor;
+import net.officefloor.frame.api.manage.ProcessManager;
 import net.officefloor.frame.api.managedobject.ProcessAwareContext;
 import net.officefloor.frame.api.managedobject.ProcessSafeOperation;
 import net.officefloor.frame.util.ExecutiveSourceStandAlone;
@@ -187,7 +188,7 @@ public class RawOfficeFloorMain {
 		 */
 
 		@Override
-		protected void service(ProcessAwareServerHttpConnectionManagedObject<ByteBuffer> connection)
+		protected ProcessManager service(ProcessAwareServerHttpConnectionManagedObject<ByteBuffer> connection)
 				throws IOException {
 
 			// Configure process awareness
@@ -224,6 +225,9 @@ public class RawOfficeFloorMain {
 				this.send(connection);
 				break;
 			}
+
+			// No process management
+			return null;
 		}
 	}