Skip to content

Commit 2044892

Browse files
committed
Bumped spring boot to 2.4.0.
Default server port is now 9090. Added data-jdbc-plain. Reduced contention level to zero by default (configurable via cli).
1 parent 8015577 commit 2044892

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+721
-219
lines changed

README.md

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,15 @@ stack composed by Spring Boot, Spring Data and Spring HATEOAS.
77
Data access variants include:
88

99
- [JDBC](roach-data-jdbc/README.md) - using Spring Data JDBC
10+
- [JDBC (plain)](roach-data-jdbc-plain/README.md) - using plain JDBC
1011
- [JPA](roach-data-jpa/README.md) - using Spring Data JPA with Hibernate as ORM provider
1112
- [jOOQ](roach-data-jooq/README.md) - using Spring Boot with jOOQ (not officially supported by spring-data)
1213
- [MyBatis](roach-data-mybatis/README.md) - using Spring Data MyBatis/JDBC
14+
- [JSON](roach-data-json/README.md) - using Spring Data JPA and JSONB types with inverted indexes
1315

14-
All demos are independent and use the same schema and test workload.
16+
Most demos are independent and use the same schema and test workload.
1517

16-
Common Spring Boot features in all demos:
18+
Common Spring Boot features demonstrated:
1719

1820
- Liquibase Schema versioning
1921
- Hikari Connection Pool
@@ -23,8 +25,8 @@ Common Spring Boot features in all demos:
2325
- Hypermedia API via Spring HATEOAS and HAL media type
2426
- Simple HTTP client invoking commands
2527

26-
The most documented demo is the JDBC version. It includes an extra aspect for setting transaction attributes such
27-
as time travel / follower reads.
28+
The most documented demo is the JDBC version. It includes an extra aspect for setting transaction
29+
attributes such timeouts and read-only hints.
2830

2931
## Prerequisites
3032

@@ -40,27 +42,34 @@ See each respective module for more details.
4042

4143
## Running
4244

43-
All demos do the same thing which is to run through a series of concurrent account
44-
transfer requests. The requests are being intentionally submitted in such a way
45-
it will cause lock contention in the database and thereby trigger aborts and retry's.
46-
That's why the demo starts with a wall of warning messages, which is expected.
47-
It ends with the message:
45+
All demos do the same thing, which is to run through a series of concurrent account
46+
transfer requests. The requests are being intentionally submitted in a way that
47+
will cause lock contention in the database and trigger aborts and retry's.
4848

49-
"All client workers finished but server keeps running. Have a nice day!"
49+
By default, the contention level is zero (serial execution) so you won't see any errors.
50+
To observe these errors, pass a number (>1) to the command line representing the thread count.
51+
Then you will see transaction conflicts and retries on the server side until the demo
52+
settles with an end message:
53+
54+
"All client workers finished but server keeps running. Have a nice day!"
5055

5156
The service remains running after the test is complete and can be access via:
5257

53-
- http://localhost:8080
58+
- http://localhost:9090
5459

5560
You could use something like Postman to send requests to the API on your own.
5661

5762
A custom database URL is specified with a config override:
5863

59-
--spring.datasource.url=jdbc:postgresql://192.168.1.99:26257/roach_data?sslmode=disable
64+
--spring.datasource.url=jdbc:postgresql://192.168.1.123:26257/roach_data?sslmode=disable
6065

6166
### JDBC demo
6267

63-
java -jar roach-data-jdbc/target/roach-data-jdbc.jar
68+
java -jar roach-data-jdbc/target/roach-data-jdbc.jar
69+
70+
with contention:
71+
72+
java -jar roach-data-jdbc/target/roach-data-jdbc.jar 8
6473

6574
### JPA demo
6675

pom.xml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.springframework.boot</groupId>
77
<artifactId>spring-boot-starter-parent</artifactId>
8-
<version>2.3.5.RELEASE</version>
8+
<version>2.4.0</version>
99
<relativePath/> <!-- lookup parent from repository -->
1010
</parent>
1111

@@ -20,8 +20,9 @@
2020
</properties>
2121

2222
<modules>
23-
<module>roach-data-jooq</module>
2423
<module>roach-data-jdbc</module>
24+
<module>roach-data-jdbc-plain</module>
25+
<module>roach-data-jooq</module>
2526
<module>roach-data-jpa</module>
2627
<module>roach-data-json</module>
2728
<module>roach-data-mybatis</module>
@@ -32,7 +33,7 @@
3233
<dependency>
3334
<groupId>org.springframework.boot</groupId>
3435
<artifactId>spring-boot-starter-web</artifactId>
35-
<version>2.3.4.RELEASE</version>
36+
<version>2.4.0</version>
3637
<exclusions>
3738
<!-- Exclude the Tomcat dependency -->
3839
<exclusion>
@@ -47,6 +48,11 @@
4748
<version>3.8.9</version>
4849
<scope>runtime</scope>
4950
</dependency>
51+
<dependency>
52+
<groupId>net.ttddyy</groupId>
53+
<artifactId>datasource-proxy</artifactId>
54+
<version>1.7</version>
55+
</dependency>
5056
</dependencies>
5157
</dependencyManagement>
5258

roach-data-jdbc-plain/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Roach Demo Data :: Plain JDBC
2+
3+
A CockroachDB demo using only JDBC for data access.

roach-data-jdbc-plain/pom.xml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xmlns="http://maven.apache.org/POM/4.0.0"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<parent>
6+
<groupId>io.roach.data</groupId>
7+
<artifactId>roach-data-parent</artifactId>
8+
<version>1.0.0.BUILD-SNAPSHOT</version>
9+
</parent>
10+
11+
<artifactId>roach-data-jdbc-plain</artifactId>
12+
13+
<dependencies>
14+
<dependency>
15+
<groupId>org.slf4j</groupId>
16+
<artifactId>slf4j-api</artifactId>
17+
<version>1.7.30</version>
18+
</dependency>
19+
<dependency>
20+
<groupId>org.slf4j</groupId>
21+
<artifactId>slf4j-simple</artifactId>
22+
<version>1.7.30</version>
23+
<scope>provided</scope>
24+
</dependency>
25+
26+
<dependency>
27+
<groupId>com.zaxxer</groupId>
28+
<artifactId>HikariCP</artifactId>
29+
<version>3.4.5</version>
30+
</dependency>
31+
<dependency>
32+
<groupId>org.postgresql</groupId>
33+
<artifactId>postgresql</artifactId>
34+
</dependency>
35+
<dependency>
36+
<groupId>net.ttddyy</groupId>
37+
<artifactId>datasource-proxy</artifactId>
38+
</dependency>
39+
</dependencies>
40+
41+
<build>
42+
<finalName>roach-data-jdbc-plain</finalName>
43+
</build>
44+
</project>

0 commit comments

Comments
 (0)