BlockHound
r2dbc-postgresql
BlockHound | r2dbc-postgresql | |
---|---|---|
6 | 4 | |
1,297 | 986 | |
0.5% | 0.3% | |
7.4 | 7.6 | |
12 days ago | 25 days ago | |
Java | Java | |
Apache License 2.0 | Apache License 2.0 |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
BlockHound
- Is there a good way to monitor code for blocking operations?
-
Reactive Backend Applications with Spring Boot, Kotlin and Coroutines (Part 1)
There is a great tool called Blockhound we can use to detect if/when we have a blocking call in our application. This way, we can ensure that we don't break the non-blocking nature of our application by mistake while developing new features. Setting it up is fairly straightforward.
- Using Java's Project Loom to build more reliable distributed systems
-
3 Reasons Why All Java Developers Should Consider Quarkus
There's even a test library to detect them: https://github.com/reactor/BlockHound
-
BlockHound: how it works
One of the talks in my current portfolio is Migrating from Imperative to Reactive. The talk is based on a demo migrating from Spring WebMVC to Spring WebFlux in a step-by-step approach. One of the steps involves installing BlockHound: it allows to check whether a blocking call occurs in a thread it shouldn't happen and throws an exception at runtime when it happens.
-
Kicking Spring Native's tires
The first step is to make the application compatible with GraalVM. We need to remove Blockhound from the code. Blockhound allows verifying that no blocking code runs in unwanted places. It's a Java agent that requires a JDK, not a JRE. It's great for a demo, but it has nothing to do with a production application.
r2dbc-postgresql
-
Reactive Backend Applications with Spring Boot, Kotlin and Coroutines (Part 1)
Now that we have an application, let's turn it into a reactive application. For this, we will replace Spring Web dependency with Spring WebFlux, Spring Data JPA with Spring Data R2DBC. We will also add R2DBC dependency for our H2 database. R2DBC works with a reactive driver so it will integrate nicely with the rest of our application to allow us database access in a non-blocking way.
- Reactive db drivers (r2dbc)
-
I need to create an API, but I don't know what framework to use. What would you choose, of you were me, and scalability is a quite important factor?
However, if you really expect a lot of users (especially concurrent ones) to use your API, you should delve into the world of reactive programming. Use tools like RxJS (JS/TS) or Project Reactor (Java) in such a case, preferably in combination with a broker like Kafka or RabbitMQ. R2DBC is also great for a data store. Then of course if you want to go one step further, there also exists the less popular but very interesting Actor model which Akka easily has ported into Java.
- Postgres is a great pub/sub and job server
What are some alternatives?
spring-native - Spring Native is now superseded by Spring Boot 3 official native support
worker - High performance Node.js/PostgreSQL job queue (also suitable for getting jobs generated by PostgreSQL triggers/functions out into a different work queue)
imperative-to-reactive - Shows how to migrate from a Imperative Programming model to a Reactive Programming model step-by-step, while keeping caching
sql-task-queue
lucene-grep - Grep-like utility based on Lucene Monitor compiled with GraalVM native-image
dramatiq - A fast and reliable background task processing library for Python 3.
reactive-kotlin-weather-api
pg-boss - Queueing jobs in Node.js using PostgreSQL like a boss
agroal - The natural database connection pool
reactor-core - Non-Blocking Reactive Foundation for the JVM
walex - Postgres change events (CDC) in Elixir