GitHunt
KA

kai-niemi/spring-bootcamp

Spring Boot 4 bootcamp training modules

About

Spring Boot v4 bootcamp modules covering various topics relevant to development against CockroachDB using
a typical spring boot application stack. Many of these topics are also covered in
this blog.

Modules

Capter Chapter Description
(1) Transactions Transactions Transaction management including retries, timeouts, etc.
(2) Contention Contention Transaction contention mitigation
- CTE Modifying common table expressions
(3) Performance Caching Cache invalidation through CDC
- Batching Batch inserts, updates and upserts
- Followers Bounded and exact staleness reads
(4) Patterns Idempotency Service level idempotency by de-duplication
- Inbox Transactional inbox pattern through CDC
- Outbox Transactional outbox pattern through CDC
- Parallel Queries Parallel fork/join query execution pattern
- Locking Locking patterns equivalent to PG advisory locks

Compatibility

  • MacOS
  • Linux
  • JDK 21+ (LTS)
  • CockroachDB v23+

Setup

Things you need to build and run the modules locally.

Prerequisites

Install the JDK

MacOS (using sdkman):

curl -s "https://get.sdkman.io" | bash
sdk list java
sdk install java 21.0 (use TAB to pick edition)  

Ubuntu:

sudo apt-get install openjdk-21-jdk

Database Setup

See start a local cluster
for setup instructions. You can also use CockroachDB Cloud (basic, standard or advanced).

Then create the database, for an insecure cluster:

cockroach sql --insecure -e "create database bootcamp"

alternatively, for a secure cluster:

cockroach sql --certs-dir=certs -e "CREATE DATABASE bootcamp; ALTER ROLE root WITH PASSWORD 'cockroach'"

An enterprise license is needed for some of the chapters that
use enterprise features like follower reads and CDC.

Building

Clone the project

git clone git@github.com:kai-niemi/spring-bootcamp.git && cd bootcamp

Build the artifact

chmod +x mvnw
./mvnw clean install

Running

Pick the training chapter you want to run a test in (selected from menu), for example chapter 1:

spring-bootcamp-ch1-transactions/run-test.sh

Terms of Use

Use of this project is entirely at your own risk and Cockroach Labs makes no guarantees or warranties about its operation.

See MIT for terms and conditions.