📊 Backend Performance Often Comes Down to SQL We sometimes focus heavily on application code when debugging performance. But in many cases, the bottleneck is in the database. What I now check first: • Execution plans • Missing indexes • Large scans caused by SELECT * • Inefficient joins Optimizing a query can reduce response time far more than scaling infrastructure. Database awareness is essential for backend engineers. #sql #databaseoptimization #java #backend
Bindu Priyanka Ganapathi’s Post
More Relevant Posts
-
I just published a deep‑dive on one of the most confusing issues in backend development: Why “connection timeout” doesn’t always mean the same thing. In this article, I break down the real differences between: 🔹 Database Connection Timeouts 🔹 HTTP Connection Timeouts Both look similar in logs—but come from completely different layers of your system. If you’ve ever chased the wrong root cause, this one’s for you. #BackendDevelopment #SoftwareEngineering #Microservices #Java #SpringBoot #Performance #ConnectionTimeOut
To view or add a comment, sign in
-
Most transaction bugs in Spring Boot are not SQL bugs—they’re transaction boundary bugs. Today’s focus is a deep dive into @Transactional: propagation, isolation, and rollback rules. If you only use the default settings everywhere, you may accidentally create hidden data inconsistencies or unexpected commits. Example: @Service public class PaymentService { @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED, rollbackFor = Exception.class) public void processPayment(Order order) { paymentRepository.save(new Payment(order.getId(), order.getTotal())); inventoryService.reserve(order.getItems()); } } Key idea: REQUIRED joins an existing transaction or starts a new one, REQUIRES_NEW creates a separate one, and isolation controls visibility of concurrent changes. By default, rollback happens for unchecked exceptions, so checked exceptions often need explicit rollbackFor. Treat @Transactional as an architectural decision, not just an annotation. #Java #SpringBoot #BackendDevelopment
To view or add a comment, sign in
-
-
Most transaction bugs in Spring Boot are not SQL bugs—they’re transaction boundary bugs. Today’s focus is a deep dive into @Transactional: propagation, isolation, and rollback rules. If you only use the default settings everywhere, you may accidentally create hidden data inconsistencies or unexpected commits. Example: @Service public class PaymentService { @Transactional(propagation = Propagation.REQUIRED, isolation = Isolation.READ_COMMITTED, rollbackFor = Exception.class) public void processPayment(Order order) { paymentRepository.save(new Payment(order.getId(), order.getTotal())); inventoryService.reserve(order.getItems()); } } Key idea: REQUIRED joins an existing transaction or starts a new one, REQUIRES_NEW creates a separate one, and isolation controls visibility of concurrent changes. By default, rollback happens for unchecked exceptions, so checked exceptions often need explicit rollbackFor. Treat @Transactional as an architectural decision, not just an annotation. #Java #SpringBoot #BackendDevelopment
To view or add a comment, sign in
-
-
Day 3 – Tech Stack Tech Stack used in my project: Java Spring Boot Spring Data JPA MySQL REST APIs Focused on building a scalable backend system. #TechStack #Backend
To view or add a comment, sign in
-
A single slow Database query almost brought down a production system I worked on. Not because of the query itself, but because it consumed every available thread, leaving nothing for the services that actually mattered. The fix? Bulkhead Semaphore pattern. Isolate your thread pools. Set a queue. Define a fallback. The slides show exactly how. Full Resilience4j docs: https://lnkd.in/dyMxUx_j #java #springboot #backend #resilience4j #softwareengineering
To view or add a comment, sign in
-
Day 54/100 Today I learned something that silently slows down applications… 👉 Lazy vs Eager fetching 👉 The N+1 query problem At first, everything worked fine. But under the hood, multiple unnecessary database queries were being executed. That’s when I understood: Just because code works doesn’t mean it’s efficient. Now I’m more conscious about: ✔ When data should be fetched ✔ Avoiding unnecessary DB calls ✔ Writing performance-aware backend code Small optimization, big impact. #100DaysOfCode #SpringBoot #BackendDevelopment #Performance #Java
To view or add a comment, sign in
-
-
Day 20: 🧑💻 Read Replicas - Scale Reads Horizontally, Free the Primary (Java + Spring Boot) What Are Read Replicas? Read Replicas are copies of your primary database that continuously receive updates via replication (WAL streaming / binary log). All writes go to the primary; reads are distributed across replicas — offloading the primary and enabling horizontal read scale. Without Replicas: All traffic → Single Primary 90% reads + 10% writes fighting for same connections Primary saturates → everything slows down With Read Replicas: Writes → Primary only Reads → Replica 1, Replica 2, Replica 3 (load balanced) Primary free for writes → faster writes Add replicas = scale reads linearly Key Takeaways — Plain English : 1. Read Replicas = copies of primary — receive updates via replication 2. All writes → Primary — replicas are read-only 3. All reads → Replicas — offloads primary, enables horizontal scale 4. readOnly=true = Spring routes automatically to replica via AbstractRoutingDataSource 5. Replica lag= milliseconds behind primary — eventual consistency 6. Read-after-write = don't write then immediately read from replica 7. Failover = if primary fails, promote replica (RDS/Aurora does this automatically) 8. Monitor lag = SELECT EXTRACT(EPOCH FROM now()-pg_last_xact_replay_timestamp()); 9. Rule: every SELECT-only method should have @Transactional(readOnly=true) — no exceptions #SystemDesign #ReadReplicas #Database #PostgreSQL #SpringBoot #Java #Microservices
To view or add a comment, sign in
-
Is your @Transactional annotation actually doing what you think? 🧐 In Spring Boot, data integrity is everything. But I often see a common trap: Self-invocation. If you call a transactional method from another method within the same class, the Spring Proxy is bypassed. 📉 The result? No transaction starts, and your data might end up inconsistent without any error message. Check: ✅ The Proxy Rule: Spring uses AOP proxies. External calls go through the proxy; internal calls don't. ✅ The Fix: Move the transactional logic to a separate Service or use AspectJ if complexity scales. ✅ Bonus: Always use readOnly = true for fetch operations to improve performance and avoid unnecessary flush calls. It’s not just about using the framework; it’s about understanding the "Magic" behind it. 🚀 Have you ever faced a "phantom" database bug because of this? Let's swap stories! 👇 #Java #SpringBoot #Backend #Database #CleanCode #SoftwareEngineering #JavaDeveloper
To view or add a comment, sign in
-
-
Practising distributed systems design, came up with QueueCTL Pro , a local-first PostgreSQL-backed distributed job queue designed for correctness under concurrent workers. ⚙️ # Core design 🚀 -> concurrency-safe leasing with FOR UPDATE SKIP LOCKED -> Java 21 virtual-thread workers -> retry, exponential backoff, DLQ, and replay workflows -> DB-driven worker coordination and graceful shutdown -> Prometheus metrics and live operational visibility # Execution characteristics 🧠 -> at-least-once execution semantics rather than exactly-once guarantees -> lease-based recovery allows unfinished jobs to be reclaimed after worker failure or timeout -> duplicate execution remains possible in retry/crash scenarios, so handlers should be idempotent -> durable state in PostgreSQL preserves job lifecycle, retry history, and DLQ visibility across restarts This project pushed me deeper into concurrency control, failure recovery, worker coordination, and observability in distributed job systems. 🏗️ Try it out: https://lnkd.in/g2PghA4q #SystemDesign #DistributedSystems #BackendEngineering #Java #PostgreSQL #SoftwareArchitecture
To view or add a comment, sign in
-
-
🚀 Database Replication Explained (Simple & Practical) Database Replication = copying data from one database (primary) to one or more databases (replicas) in real-time or near real-time. 👉 Why use it? • Improves read performance (scale reads) • High availability (failover support) • Disaster recovery • Data redundancy 💡 Example: Primary DB handles all writes. Replica DBs handle read-heavy queries like fetching user feeds or analytics. ⚙️ Types of Replication: • Synchronous → safer, but slower (waits for replica) • Asynchronous → faster, slight risk of data loss • Semi-synchronous → balanced approach 🔄 Flow: Write → Primary DB ✍️ ↓ Replication mechanism 🔁 ↓ Replica DBs (Read scaling) 📖 ✅ Result: Faster apps + Better reliability + Scalable systems 📌 Rule of Thumb: Use replication when your reads >> writes. 👉 If you are preparing for Spring Boot backend interviews, connect & follow - I share short, practical backend concepts regularly. #SpringBoot #Backend #Java #CleanCode #InterviewPrep #SoftwareEngineering #SystemDesign
To view or add a comment, sign in
-
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development
Amazing