Coder Social home page Coder Social logo

reactive-relational-database-tests's Introduction

reactive-relational-database-tests

Some combinations of frameworks are tested below. You can find implementation details by clicking through title. Presentation link is here: https://github.com/farukcankaya/reactive-relational-database-tests/blob/master/reactive-relational-database.pdf

Load test was run with maximum 1000000 users and 100000 hatch rate. Also, minimum user waiting duration was 1000ms and maximum user waiting duration was 2000ms. You can change this configuration in load-test.py file.

Follow instructions below to run load test:

Install Locust

  • For python2.7: python -m pip install locustio
  • For python3: python3 -m pip install locustio

Run load test

locust -f load-test.py --host=<host>

  • Approx. Memory Usage: 500MB
  • Approx. CPU Usage: 15%
  • It creates thread per request. Threads will increase up to instant request counts. It does not scale.
  • Request fail: 0%
  • Load test host: http://localhost:9494/api/jpa

  • Approx. Memory Usage: 1GB
  • Approx. CPU Usage: 30%
  • Approx. Thread count: 30
  • Request fail: 36%
  • Load test host: http://localhost:9595/api/r2dbc

R2DBC has not have connection pool in this project. It causes some request fails. After adding R2DBC connection pool, it could be better. R2DBC Pool repository: https://github.com/r2dbc/r2dbc-pool
  • Approx. Memory Usage: 500MB
  • Approx. CPU Usage: 15%
  • Approx. Thread count: Fixed 30 threads from pool.
  • Request fail: 0%
  • Load test host: http://localhost:9696/api/reactive-pg

JDBC

  • Approx. Memory Usage: 2GB
  • Approx. CPU Usage: 40%
  • Approx. Thread count: 230
  • Request fail: 1%
  • In /jdbc endpoint, fixed 200 thread pool is used to open JDBC connection to database.
  • Load test host: http://localhost:9393/api/jdbc

JPA

  • Approx. Memory Usage: 500MB
  • Approx. CPU Usage: 15%
  • Approx. Thread count: 22
  • Request fail: 0%
  • In /jpa endpoint, it uses NIO threads to open JDBC connection to database.
  • Load test host: http://localhost:9393/api/jpa

Webflux + JPA looks better but only select query is tested here. JPA gives better result with using caching, lazy loading properties. However, JPA is not work with webflux properly. JPA uses `ThreadLocal` to store some variables but in reactor threads could be changed. To look in details you can checkout the feature/city branch. JPA throws `org.hibernate.LazyInitializationException` exception when /api/jpa-city endpoint tries to return City with collection of addresses.

Conclusion

All tests run in 8-Core 2,9 GHz Intel Core i7, 16 GB 2133 MHz LPDDR3 machine and VisualVM is used to get information from applications. Results could be change based on physical server configurations. As a result, Webflux + PgClient gives best result compares to other implementations(Spring Web + JPA, Webflux + JDBC and JPA, Webflux + R2dbc) for now(10/05/2019).

References

reactive-relational-database-tests's People

Contributors

farukcankaya avatar

Watchers

 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.