The effect of switching id for new records from UUID v4 to UUID v7 on INSERT to a 24 GB PostgreSQL table with 116M rows.
Results vary from table to table - depending on number and type of indexes - I can see improvements on INSERTS from 20 to 80%
Jun 6, 2024 • 6 tweets • 2 min read
Upgrading to Spring Boot 3.3.0 (particularly Hibernate 6.5 upgrade) - caused 100% CPU usage on the database and crashed our production servers, because of small change in JPQL ➡️ SQL conversion.
Read more 👇 (1/6) 2/6 Take a look at following JPQL query and how different SQL gets generated in Hibernate 6.4 vs 6.5 when you pass empty list as a parameter
Jan 16, 2024 • 8 tweets • 2 min read
Which HTTP client to choose in 2024?
For Spring, some people recommend using the brand new RestClient, but that's not that simple. My thoughts:reddit.com/r/java/s/4HIBV…
In the past Java didn't have an HTTP client baked into the JDK. There has always been HttpUrlConnection but anyone who ever tried to use it can confirm that it was .. painful. Why? Because it's very low level.
@sergialmar was so kind to upload the keynote on right after the conference.
Some highlights from the talk in case you don't have 1h to watch:
@springjuergen on stage:
2023 is the year of anniversaries in Spring community.
1️⃣ The 10th edition of @spring_io
2️⃣ Spring Framework is 20 years old.
3️⃣ Spring Boot - the new kid on the block - is not so new anymore - it turns 10 this year.
Mar 29, 2023 • 4 tweets • 1 min read
I'm still puzzled that there is no first-class support for OpenAPI spec in Spring Boot.
Without getting again into the conversation if OpenAPI is the right thing to do, realistically - this is the industry standard.
I am happy with springdoc.org but again, it is an OSS project made by volunteers, just like SpringFox was until the maintainers (or rather 99% one person) stopped working on it.
Mar 19, 2023 • 4 tweets • 2 min read
📢 New project: Spring Boot Startup Report
This tiny library generates an interactive @springboot application startup report that lets you understand what contributes to the application startup time and perhaps helps to optimize it.
👉 github.com/maciejwalkowia…
It is dramatically simple to use, just add the dependency, run the application, go to the `/startup-report` in your web browser.
My thoughts 👇
We finally have an answer to slow startup time. No more tweaking, hacking, switching to lazy initialization. If startup time is critical the answer is simple - build GraalVM native image.
Native Image definitely paves the way for Spring to go serverless.
Aug 30, 2022 • 7 tweets • 2 min read
What is a Spring bean? How to create beans? Simple questions without simple answers.
Let me try to clarify it a bit.
How to create a bean?
You don't. You define a bean - create *bean definition* - a recipe for IOC container on how & when to create bean, and how to dispose it.
Bean definition can be created through class path scanning:
Jul 19, 2022 • 14 tweets • 5 min read
Few hints on how to write better tests:
1. Don't use "test" prefix for test methods. This had to be done in JUnit 3 (!) but now it only adds noise. Instead use method names that express the intent. 2. Group related tests together with JUnit 5 @nested annotation. This will add structure and save you from repetition
Jul 14, 2020 • 8 tweets • 1 min read
Thread 👇
As developers we have a tendency to project our experiences onto some general rules: static methods are bad, you must follow TDD, ORMs are shit, SQL is shit etc. but we often forget that developing software is very different depending on the constraints and goals. 1/8
While using feature branches and pull requests may not be the best idea in product development where time to market and fast iterations is the key, it is a great fit for open source projects. 2/8
Jul 2, 2019 • 6 tweets • 1 min read
1/6
Few hints 💬 that may help in writing easier to maintain Java code 📢:
✅ organise packages by vertical slices instead of layers
✅ reference other aggregates only by ids instead of type
2/6
✅ emit events from aggregates and use them to communicate with other slices instead of calling classes from other slices directly
✅ lower class visibility to package protected where possible instead of making everything public by default