𝗪𝗵𝗲𝗻 𝘁𝗵𝗲 𝗝𝗩𝗠 𝗗𝗶𝗱𝗻’𝘁 𝗞𝗻𝗼𝘄 𝗜𝘁 𝗪𝗮𝘀 𝗜𝗻 𝗮 𝗖𝗼𝗻𝘁𝗮𝗶𝗻𝗲𝗿 It’s 2024. Your Spring Boot application is running inside Kubernetes. The container memory limit is 2𝐆𝐁. Everything looks properly configured. A few hours after deployment, the pod restarts. Kubernetes reports: 𝗢𝗢𝗠𝗞𝗶𝗹𝗹𝗲𝗱 The logs show: 𝗢𝘂𝘁𝗢𝗳𝗠𝗲𝗺𝗼𝗿𝘆𝗘𝗿𝗿𝗼𝗿 You investigate the code. No obvious memory leak. Load is normal. Heap usage during testing was fine. So what happened? The issue isn’t your business logic. It isn’t a missing -𝗫𝗺𝘅 either. For years, the 𝗝𝗩𝗠 calculated heap size based on the host machine’s total memory, not the container’s limit. If the node had 16𝐆𝐁 RAM, the JVM sized itself assuming that memory was available even if the container was capped at 2𝐆𝐁. Kubernetes enforced the limit strictly. The JVM exceeded it. The Linux 𝗢𝗢𝗠 𝗞𝗶𝗹𝗹𝗲𝗿 terminated the process. The core problem was simple: the 𝗝𝗩𝗠 was not container-aware. It read memory information from '/proc/meminfo' and applied its ergonomics algorithm as if it were running directly on the host. Containers existed but the JVM didn’t fully see them. This behavior shaped early cloud-native decisions. Some teams concluded that Java as too heavy for Kubernetes. In reality, the language was not the problem environmental visibility was. The fix evolved gradually. Starting with experimental container support flags in later Java 8 updates, and eventually reaching proper 𝗰𝗴𝗿𝗼𝘂𝗽𝘀 support and container awareness by default in modern JVM versions. But the side effect lingered: many teams began over-provisioning memory out of fear, increasing infrastructure costs just to avoid mysterious restarts. Have you ever debugged an 𝗢𝗢𝗠𝗞𝗶𝗹𝗹𝗲𝗱 restart loop and later realized the issue wasn’t your code but how the 𝗝𝗩𝗠 sized its memory? #Java #Kubernetes #CloudNative #JVM #BackendEngineering #DevOps
Asad Tahseen’s Post
More Relevant Posts
-
☀️ Afternoon Tech Thought In modern backend development, writing code is easy. Designing scalable, resilient microservices is the real skill. With Java + Spring Boot, focus on: ✔️ Clean architecture ✔️ Proper exception handling ✔️ Logging & monitoring ✔️ RESTful best practices ✔️ Database indexing & query optimization Performance isn’t just about fast code — it’s about smart design. Keep building. Keep improving. 🚀 #Java #SpringBoot #Microservices #BackendDevelopment #SoftwareEngineering
To view or add a comment, sign in
-
🔗 How do backend APIs actually communicate in real systems? When I started building backend applications using Spring Boot, I thought services simply call each other. But in real-world systems, communication is more strategic. 🔹 1. Synchronous Communication (Direct API Calls) Order Service → Payment Service • Works via HTTP • Immediate response • Simple to implement ⚠️ Problem: If one service fails → entire flow breaks This creates tight coupling 🔹 2. Asynchronous Communication (Event-Driven) Using Apache Kafka: Order Service → Kafka Topic → Multiple Services • No direct dependency • Services work independently • Better scalability 🔥 Real Insight Modern backend systems don’t rely on just one approach. They combine both: ✔ Sync → for real-time operations ✔ Async → for scalability and reliability This shift from direct calls → event-driven architecture is what makes systems production-ready. Hashtags #BackendDevelopment #Java #SpringBoot #Microservices #ApacheKafka #SystemDesign #SoftwareArchitecture #EventDrivenArchitecture #SoftwareEngineering #Programming #Developers #TechCommunity #JavaDeveloper
To view or add a comment, sign in
-
-
🚀 7 Spring Boot Performance Tips Every Backend Developer Should Know While building APIs and microservices with Spring Boot, I realized that small optimizations can make a huge difference in performance and scalability. Here are some practical tips that helped improve my backend performance: 1️⃣ Use DTOs instead of Entities in API responses to avoid unnecessary data exposure and reduce payload size. 2️⃣ Implement Pagination when fetching large datasets instead of returning thousands of records. 3️⃣ Use HikariCP connection pooling to manage database connections efficiently. 4️⃣ Avoid the N+1 query problem by using proper joins or fetch strategies. 5️⃣ Enable Caching (Spring Cache / Redis) for frequently accessed data. 6️⃣ Use @Async processing for time-consuming operations like email sending or report generation. 7️⃣ Monitor application health with Spring Boot Actuator and metrics to identify performance bottlenecks. ⚡ Performance optimization is not only about writing code — it's about designing systems that scale. 💬 What is one performance optimization technique you use in your Spring Boot applications? #Java #SpringBoot #BackendDevelopment #Microservices #JavaDeveloper #SoftwareEngineering #PerformanceOptimization #Programming #Coding #TechCommunity #Developers #JavaProgramming #API #TechLearning #DeveloperLife
To view or add a comment, sign in
-
Spring Boot development is largely driven by powerful annotations that help developers build scalable applications. If you're building production-ready Microservice REST APIs, mastering these 4 core Spring Boot starter dependencies is essential: 🔹 spring-boot-starter-web : Build RESTful APIs using annotations like @RestController, @RequestMapping, @GetMapping, and @PostMapping. 🔹 spring-boot-starter-data-jpa : Simplify database interactions with @Entity, @Repository, @Transactional, and JPA repositories. 🔹 spring-boot-starter-validation : Ensure clean and validated request data using @Valid, @NotNull, @Size, @Email, and more. 🔹 spring-boot-starter-test : Write robust unit and integration tests using @SpringBootTest, @MockBean, and testing frameworks like JUnit and Mockito. Mastering these starters and their annotations can significantly improve developer productivity, code quality, and maintainability when building modern microservices with Spring Boot. #SpringBoot #Java #Microservices #BackendDevelopment #SoftwareEngineering
To view or add a comment, sign in
-
-
Confused about the Spring Bean Lifecycle? Here’s a simple breakdown. From Spring Container startup to Bean destruction, every step is managed automatically. ➡️ Bean Creation ➡️ Dependency Injection ➡️ Initialization ➡️ Ready for Use ➡️ Used by the Application ➡️ Destruction during Container Shutdown This lifecycle is what makes Spring powerful, scalable, and maintainable. Understanding it helps you debug applications faster and truly understand how Spring works behind the scenes. Master the basics- strong fundamentals build great developers. Follow Sofikul Islam to learn Java, Spring, Docker, and AWS. #Java #SpringBoot #SpringFramework #BackendDevelopment #SoftwareEngineering
To view or add a comment, sign in
-
-
🔧 5 Things I Always Do When Designing a REST API After working on multiple backend services in Spring Boot microservices, I realized that good API design saves a lot of problems later. Here are a few practices I always try to follow: 1️⃣ Clear endpoint naming Use meaningful resource names instead of action-based URLs. 2️⃣ Consistent error responses Define a standard error format so clients can handle failures properly. 3️⃣ Input validation at the boundary Validate requests at the controller layer to prevent bad data entering the system. 4️⃣ Pagination for large datasets Never return huge datasets in one response. 5️⃣ Meaningful logging Logs should help during debugging, especially in distributed systems. Small API design choices can make a huge difference in scalability and maintainability. What’s one REST API practice you always follow? #backendengineering #java #springboot #restapi #microservices #softwareengineering
To view or add a comment, sign in
-
Spring Boot Configuration — The Hidden Power Behind Applications In real-world applications, hardcoding values is a big mistake Instead, Spring Boot uses configuration files to manage everything. In simple terms: Spring Boot = “Keep your logic clean, I’ll handle configs separately.” --- 🔹 Where do we configure? application.properties (or) application.yml --- 🔹 What can we configure? ✔ Database connection ✔ Server port ✔ API keys ✔ Environment-based settings (dev / prod) --- 🔹 Example: server.port=8081 spring.datasource.url=jdbc:mysql://localhost:3306/mydb --- Why this is important: ✔ Clean code (no hardcoding) ✔ Easy environment switching ✔ Secure & flexible ✔ Production-ready applications --- Bonus: Using @Value and @ConfigurationProperties, we can inject these configs directly into our code. --- Currently learning and applying these concepts step by step #SpringBoot #Java #BackendDevelopment #Configuration #LearningInPublic #DevOps
To view or add a comment, sign in
-
-
Announcing deadline4j — open-source deadline propagation for Spring microservices. If you've worked with gRPC, you know how powerful withDeadlineAfter(5, SECONDS) is — one call at the edge, and the deadline propagates through every hop, enforces automatically, and cascades cancellation on expiry. Zero application code. Spring has no equivalent. Until now. I'm excited to open-source deadline4j — a library that brings gRPC's zero code deadline model to the Spring HTTP ecosystem. What it does: - Propagates deadlines across RestTemplate, WebClient, and Feign calls via a single HTTP header - Computes adaptive timeouts from observed latency distributions (P99, configurable) — no more guessing static timeout values - Tracks timeout budgets across sequential calls and automatically skips optional services when budget is exhausted - Ships in observe mode by default — full metrics, zero enforcement until you're ready What makes it different: - Zero code at call sites. Everything happens in filters and interceptors. - Configuration-driven. Required vs optional services, enforcement mode, budget thresholds — all in YAML. - Incremental adoption. Deploy everywhere, enforce per-service, per-environment, at your own pace. - Framework-agnostic core (Java 11+) with first-class Spring Boot 3.x auto-configuration. Observability built in — Micrometer metrics and OpenTelemetry span attributes out of the box. The library is modular: pick what you need from the core, WebMVC, WebFlux, OpenFeign, Micrometer, and OpenTelemetry modules. Check it out: [https://lnkd.in/gbr-sZwJ] Feedback, issues, and contributions welcome. Licensed under Apache 2.0. #java #springboot #microservices #opensource #distributedsystems #observability
To view or add a comment, sign in
-
🚀 Spring Boot Annotations – The Backbone of Every Application Many developers use Spring Boot annotations every day, but very few truly understand where each annotation works internally. I created this simple visual guide to understand the most important Spring Boot annotations and their roles in the application flow. 🔹 @SpringBootApplication – Entry point of the Spring Boot application 🔹 @ComponentScan – Scans and detects Spring components 🔹 @Configuration / @Bean – Defines configuration and beans 🔹 @Controller / @RestController – Handles HTTP requests 🔹 @Service – Contains business logic 🔹 @Repository – Handles database operations 🔹 @Transactional – Manages database transactions 🔹 @Value / @PropertySource – Injects configuration values All these components come together inside the Application Context, which manages the lifecycle of every bean in a Spring Boot application. Understanding this flow helps developers: ✅ Write cleaner architecture ✅ Debug issues faster ✅ Master Spring Boot internals 📌 If you're learning Spring Boot, understanding annotations is the first step toward mastering the framework. #Java #SpringBoot #BackendDevelopment #JavaDeveloper #Programming #SoftwareDevelopment #SpringFramework #TechLearning #Coding Durgesh Tiwari Anshika Singh
To view or add a comment, sign in
-
-
Most APIs focus on what happens inside the system. But real security starts before the request even reaches your code. In my latest Substack article, I break down a mindset shift: 👉 Protect your API before it protects itself Modern API security is not just about adding JWT or authentication. It’s about enforcing security at the right layers: - Validating tokens early (not just decoding them) - Using gateways and resource servers to enforce policies consistently - Separating authentication from authorization - Designing security as part of the architecture, not a patch Because most real-world issues don’t come from missing features… They come from gaps in enforcement. If you work with Spring Boot, microservices, or APIs at scale, this is one of those concepts that changes how you design systems. 👉 Worth the read: https://lnkd.in/d6Di3RjN What do you think is more critical in practice: token validation, API gateways, or authorization design? #Java #SpringBoot #APISecurity #Backend #Microservices #SoftwareEngineering #DevOps
To view or add a comment, sign in
Explore related topics
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