Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/crabzilla/accounts-quarkus


https://github.com/crabzilla/accounts-quarkus

Last synced: about 1 month ago
JSON representation

Awesome Lists containing this project

README

        

:sourcedir: src/main/java
:source-highlighter: highlightjs
:highlightjsdir: highlight
:highlightjs-theme: rainbow
:revnumber: {project-version}
:example-caption!:
ifndef::imagesdir[:imagesdir: images]
ifndef::sourcedir[:sourcedir: ../../main/java]
:toclevels: 4

= Accounts Quarkus

image:https://img.shields.io/badge/crabzilla.v0.5.7-orange.svg[link="https://github.com/crabzilla/crabzilla"]
https://github.com/crabzilla/accounts-quarkus/actions/workflows/blank.yml[image:https://github.com/crabzilla/accounts-quarkus/actions/workflows/blank.yml/badge.svg[CI]]
https://codecov.io/gh/crabzilla/accounts-quarkus[image:https://codecov.io/gh/crabzilla/accounts-quarkus/branch/main/graph/badge.svg?[codecov]]

This is an example of an application using https://github.com/crabzilla/crabzilla[Crabzilla] with https://quarkus.io/[Quarkus]

== https://eventmodeling.org/posts/what-is-event-modeling/[Eventmodeling]

image::accounts.drawio.png[Overview]

== Requirements

* Java 11
* Maven
* Docker compose
* https://k6.io[K6] for running stress test

== Building

1 - Start Postgres:
```
docker-compose up
```

2 - Build it, running both unit and integration tests:
```
mvn clean install
```

== Running

1 - Start Postgres if no already started:
```
docker-compose up
```

2 - Run the using Quarkus dev mode:
```
mvn compile quarkus:dev
```

3 - Exploring api

Just open http://localhost:8080/q/swagger-ui/#

=== Transfer test

Open an account 1 with 110.00 and 2 with 0.00 then make a 100.00 transfer from account 1 to 2:

```
k6 run - <./k6/transfer.js
```

Note: on Mac M1 you will need to install and run K6 locally. I still have to figure out this bug.

=== Stress test

Opening many accounts with 1000 virtual users during 60 seconds:

```
k6 run - <./k6/open-many-accounts.js
```

And you will see something like:

```
/\ |‾‾| /‾‾/ /‾‾/
/\ / \ | |/ / / /
/ \/ \ | ( / ‾‾\
/ \ | |\ \ | (‾) |
/ __________ \ |__| \__\ \_____/ .io

execution: local
script: -
output: -

scenarios: (100.00%) 1 scenario, 1000 max VUs, 1m30s max duration (incl. graceful stop):
* default: 1000 looping VUs for 1m0s (gracefulStop: 30s)

data_received..................: 28 MB 459 kB/s
data_sent......................: 15 MB 239 kB/s
http_req_blocked...............: avg=6.55ms min=1.13µs med=2.63µs max=1.14s p(90)=4.61µs p(95)=6.43µs
http_req_connecting............: avg=6.48ms min=0s med=0s max=1.02s p(90)=0s p(95)=0s
http_req_duration..............: avg=1.09s min=505.72ms med=877.96ms max=2.52s p(90)=1.55s p(95)=1.75s
{ expected_response:true }...: avg=1.09s min=505.72ms med=877.96ms max=2.52s p(90)=1.55s p(95)=1.75s
http_req_failed................: 0.00% ✓ 0 ✗ 55012
http_req_receiving.............: avg=47.94µs min=13.33µs med=42.99µs max=9.55ms p(90)=70.5µs p(95)=85.68µs
http_req_sending...............: avg=192.25µs min=8.01µs med=19.25µs max=149.53ms p(90)=30.86µs p(95)=42.68µs
http_req_tls_handshaking.......: avg=0s min=0s med=0s max=0s p(90)=0s p(95)=0s
http_req_waiting...............: avg=1.09s min=503.94ms med=877.89ms max=2.52s p(90)=1.55s p(95)=1.75s
http_reqs......................: 55012 895.945492/s
iteration_duration.............: avg=1.1s min=547.04ms med=879.2ms max=2.52s p(90)=1.57s p(95)=1.79s
iterations.....................: 55012 895.945492/s
vus............................: 267 min=267 max=1000
vus_max........................: 1000 min=1000 max=1000

```

=== Inspiration links

* https://www.youtube.com/watch?v=GzrZworHpIk
* http://www.codingthearchitecture.com/2015/03/08/package_by_component_and_architecturally_aligned_testing.html