Code Monkey home page Code Monkey logo

belajar-webflux-vs-webmvc's Introduction

Komparasi aplikasi web servlet vs reactive

Stack Web Servlet :

  • Lombok
  • PostgreSQL
  • Spring Data JPA
  • Spring WebMVC

Klik di sini untuk generate project

Stack Web Reactive :

  • Lombok
  • PostgreSQL
  • Spring Data R2DBC
  • Spring WebFlux

Klik di sini untuk generate project

Poin perbandingan:

  • Penggunaan class dan method
  • Implementasi CRUD
  • Transaction Propagation
  • Transaction Isolation

Tabel database :

  • Rekening
  • Mutasi
  • Running Number

Cara menjalankan database :

docker-compose up

Skenario yang dites dalam aplikasi:

  1. Insert data berelasi normal

    • Endpoint : http://localhost:10000/api/transfer

    • Method : POST

    • Parameter :

      • src=N-002
      • dst=N-001
      • amt=50000
    • Response code : 201

    • Hasil yang diharapkan :

      • Tabel rekening di rekening asal dan tujuan berubah saldonya
      • Tabel running number angkanya naik
      • Tabel mutasi terisi record baru
      • Tabel log_transaksi terisi record baru
  2. Insert data gagal

    • Endpoint : http://localhost:10000/api/transfer

    • Method : POST

    • Parameter :

      • src=N-002
      • dst=N-003
      • amt=50000
    • Response code : 500

    • Hasil yang diharapkan :

      • Tabel rekening di rekening asal dan tujuan tidak berubah saldonya (gagal update karena rollback)
      • Tabel running number angkanya tidak naik (gagal update karena rollback)
      • Tabel mutasi tidak terisi record baru (gagal insert karena rollback)
      • Tabel log_transaksi terisi record baru (tetap insert karena propagation pakai REQUIRES_NEW)
  3. Akses data secara bersamaan (concurrent access)

    • Endpoint : http://localhost:10000/api/payment

    • Method : POST

    • Parameter :

      • src=N-002
      • prd=PLN-001
      • cst=N002
      • amt=12500
    • Concurrent access : 5 thread

    • Iterasi : 10

    • Response code : 201

    • Hasil yang diharapkan :

      • Saldo akhir di rekening N-002 berkurang sejumlah 625.000 (5x10x12500)
      • Tabel running number angkanya bertambah 50 (50 kali transaksi)
      • Tabel mutasi terisi 50 record baru dengan nomor referensi tidak ada duplikat
      • Tabel log_transaksi terisi 50 record baru

belajar-webflux-vs-webmvc's People

Contributors

endymuhardin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.