Posts

why your Spring Data JPA query so slow? took more than 10 mins to just fetch 100 thousands records

Image
We encountered a query performance issue which took more than 10 minutes to complete a query from a table which has 100 thousands records. We are using Spring Data JPA framework. We thought the framework shouldn't be quite slow. 100,000 records is not too much. After google search, find some similar issues. Why is JPA query so slow?I am implementing queries in my web application with JPA repositories. The two main tables I am querying from are FmReportTb and SpecimenTb. Here are the two entity  

Seamless Transaction ID Propagation in Spring WebFlux Applications

Image
Introduction In Spring WebFlux applications, ensuring consistent transaction ID propagation across asynchronous execution chains is essential for effective logging and tracing. However, the reactive, non-blocking nature of WebFlux introduces challenges due to multiple threads handling requests concurrently. In this guide, we'll explore how to seamlessly propagate transaction IDs using the Reactor Hooks library and ContextPropagation in Spring WebFlux applications. 1. Understanding the Challen  

Logging Transaction IDs in a Spring Web Application Execution Chain

Image
Introduction In complex Spring Web applications, tracking requests through the execution chain can be challenging, especially in distributed environments. One effective way to enhance request traceability is by logging transaction IDs throughout the request lifecycle. In this guide, we'll explore how to implement transaction ID logging using SLF4J, Logback, and Spring Web's execution chain. 1. Implementing Custom Log Layout with Transaction ID: As discussed in our previous post, we can extend  

Crafting Custom Log Layouts with SLF4J and Logback: A Step-by-Step Guide

Image
Introduction Customizing logging output is a common requirement in many applications, allowing developers to tailor log messages to specific formats and structures. SLF4J with Logback provides powerful capabilities for customizing logging behavior, including the ability to define custom layouts for log messages. In this guide, we'll explore how to implement LayoutBase<ILoggingEvent> to create a custom layout for log messages and integrate it with SLF4J and Logback. Define Custom LayoutBase<IL  

Copying MDC Context Map in Web Clients: A Comprehensive Guide

Image
Introduction In distributed systems, maintaining context across microservices is crucial for effective logging and tracing. The Mapped Diagnostic Context (MDC) in logging frameworks like Logback or Log4j allows developers to propagate contextual information such as request IDs, user IDs, or correlation IDs across threads and services. When using web clients to make outgoing requests, it's essential to propagate the MDC context map to ensure consistency and traceability. This guide will provide