<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by akash on Medium]]></title>
        <description><![CDATA[Stories by akash on Medium]]></description>
        <link>https://medium.com/@gumber04akash?source=rss-edfcd88b9fea------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*veWvATHa5C6DVru5</url>
            <title>Stories by akash on Medium</title>
            <link>https://medium.com/@gumber04akash?source=rss-edfcd88b9fea------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 01:18:17 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gumber04akash/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[ JWT Authentication in Spring Boot: Secure Your APIs the Right Way]]></title>
            <link>https://medium.com/codetodeploy/jwt-authentication-in-spring-boot-secure-your-apis-the-right-way-76cab16368ae?source=rss-edfcd88b9fea------2</link>
            <guid isPermaLink="false">https://medium.com/p/76cab16368ae</guid>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[jwt-authentication]]></category>
            <category><![CDATA[colnerable]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[code]]></category>
            <dc:creator><![CDATA[akash]]></dc:creator>
            <pubDate>Sun, 15 Feb 2026 09:50:18 GMT</pubDate>
            <atom:updated>2026-02-15T15:06:32.528Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5fXOomTUGIrPHZgicQvzFg.png" /><figcaption><strong>🔐 JWT Authentication in Spring Boot: Secure Your APIs the Right Way</strong></figcaption></figure><p>Building APIs is easy.</p><p>Securing them properly? That’s where most developers make mistakes.</p><p>Many Spring Boot applications implement JWT authentication incorrectly, leading to:</p><ul><li>Token misuse</li><li>Security vulnerabilities</li><li>Unauthorized access</li><li>Broken role validation</li></ul><p>Let’s build JWT authentication the right way — production-ready and secure.</p><p><a href="https://medium.com/codetodeploy/master-ai-cloud-coding-in-3-months-start-today-395947ebfd2c">Master AI, Cloud &amp; Coding in 3 Months — Start Today</a></p><h3>🧠 What Is JWT?</h3><p>JWT (JSON Web Token) is a compact, secure way to transmit information between parties.</p><p>A JWT contains:</p><ul><li>Header</li><li>Payload</li><li>Signature</li></ul><p>Example token structure:</p><pre>xxxxx.yyyyy.zzzzz</pre><p>Once issued, the client sends this token in every request:</p><pre>Authorization: Bearer &lt;token&gt;</pre><p>The server validates it and grants access.</p><h3>⚙ Step 1: Add Dependencies</h3><p>In pom.xml:</p><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;<br>    &lt;artifactId&gt;spring-boot-starter-security&lt;/artifactId&gt;<br>&lt;/dependency&gt;<br>&lt;dependency&gt;<br>    &lt;groupId&gt;io.jsonwebtoken&lt;/groupId&gt;<br>    &lt;artifactId&gt;jjwt-api&lt;/artifactId&gt;<br>    &lt;version&gt;0.11.5&lt;/version&gt;<br>&lt;/dependency&gt;</pre><h3>🔑 Step 2: Generate JWT Token</h3><p>Create a utility class:</p><pre>@Component<br>public class JwtUtil {<br>private final String SECRET_KEY = &quot;your-secret-key&quot;;<br>    public String generateToken(String username) {<br>        return Jwts.builder()<br>                .setSubject(username)<br>                .setIssuedAt(new Date())<br>                .setExpiration(new Date(System.currentTimeMillis() + 1000 * 60 * 60))<br>                .signWith(SignatureAlgorithm.HS256, SECRET_KEY)<br>                .compact();<br>    }<br>}</pre><p>Token expires in 1 hour.</p><p>Never use weak or hardcoded secrets in production.</p><h3>🛡 Step 3: Validate Token</h3><pre>public String extractUsername(String token) {<br>    return Jwts.parser()<br>            .setSigningKey(SECRET_KEY)<br>            .parseClaimsJws(token)<br>            .getBody()<br>            .getSubject();<br>}</pre><p>Always validate:</p><ul><li>Signature</li><li>Expiration</li><li>Claims</li></ul><h3>🚦 Step 4: Create JWT Filter</h3><p>This filter checks token on every request.</p><pre>@Component<br>public class JwtFilter extends OncePerRequestFilter {<br>@Autowired<br>    private JwtUtil jwtUtil;<br>    @Override<br>    protected void doFilterInternal(HttpServletRequest request,<br>                                    HttpServletResponse response,<br>                                    FilterChain filterChain)<br>            throws ServletException, IOException {<br>        final String authHeader = request.getHeader(&quot;Authorization&quot;);<br>        if (authHeader != null &amp;&amp; authHeader.startsWith(&quot;Bearer &quot;)) {<br>            String token = authHeader.substring(7);<br>            String username = jwtUtil.extractUsername(token);<br>            UsernamePasswordAuthenticationToken authentication =<br>                    new UsernamePasswordAuthenticationToken(username, null, List.of());<br>            SecurityContextHolder.getContext().setAuthentication(authentication);<br>        }<br>        filterChain.doFilter(request, response);<br>    }<br>}</pre><h3>🔒 Step 5: Configure Spring Security</h3><pre>@Configuration<br>@EnableWebSecurity<br>public class SecurityConfig {<br>@Bean<br>    public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {<br>        http<br>            .csrf().disable()<br>            .authorizeHttpRequests(auth -&gt; auth<br>                .requestMatchers(&quot;/auth/**&quot;).permitAll()<br>                .anyRequest().authenticated()<br>            );<br>        return http.build();<br>    }<br>}</pre><p>Now:</p><ul><li>/auth/login → public</li><li>All other endpoints → protected</li></ul><h3>🏗 Production Best Practices</h3><p>JWT security is often implemented incorrectly.</p><p>Follow these rules:</p><p>✅ Use strong secret key (environment variable)<br> ✅ Set token expiration<br> ✅ Implement refresh tokens<br> ✅ Store minimal data in payload<br> ✅ Use HTTPS always<br> ✅ Add role-based authorization</p><p>Example role protection:</p><pre>@PreAuthorize(&quot;hasRole(&#39;ADMIN&#39;)&quot;)<br>@GetMapping(&quot;/admin&quot;)<br>public String adminEndpoint() {<br>    return &quot;Admin Access&quot;;<br>}</pre><h3>⚠ Common Mistakes</h3><p>❌ Storing passwords inside JWT<br> ❌ Not validating expiration<br> ❌ No refresh token mechanism<br> ❌ Using same secret across environments<br> ❌ Not invalidating tokens on logout</p><p>JWT is stateless — logout requires special handling.</p><h3>📊 Why JWT Is Powerful</h3><ul><li>Stateless authentication</li><li>No session storage required</li><li>Scales easily in microservices</li><li>Works well with distributed systems</li></ul><p>Perfect for:</p><ul><li>REST APIs</li><li>Microservices</li><li>Cloud-native apps</li></ul><h3>🎯 Final Thoughts</h3><p>JWT authentication is simple in theory.</p><p>But production-ready implementation requires:</p><ul><li>Proper validation</li><li>Secure key management</li><li>Role-based authorization</li><li>Expiration handling</li></ul><p>Security should never be an afterthought.</p><p>If you’re building serious Spring Boot APIs — secure them properly from day one.</p><p>🔥 Follow for more deep dives into Spring Boot security, performance, and production architecture.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76cab16368ae" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codetodeploy/jwt-authentication-in-spring-boot-secure-your-apis-the-right-way-76cab16368ae">🔐 JWT Authentication in Spring Boot: Secure Your APIs the Right Way</a> was originally published in <a href="https://medium.com/codetodeploy">CodeToDeploy</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Spring Boot + Redis Caching: Cut Your API Response Time by 70%]]></title>
            <link>https://medium.com/codetodeploy/spring-boot-redis-caching-cut-your-api-response-time-by-70-8e16d1260c70?source=rss-edfcd88b9fea------2</link>
            <guid isPermaLink="false">https://medium.com/p/8e16d1260c70</guid>
            <category><![CDATA[caching]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[api-response]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[redis]]></category>
            <dc:creator><![CDATA[akash]]></dc:creator>
            <pubDate>Sun, 15 Feb 2026 09:41:13 GMT</pubDate>
            <atom:updated>2026-02-15T15:13:29.568Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QCD6MiWFWUGSSjeq6JJ1UA.png" /><figcaption><strong>🚀 Spring Boot + Redis Caching: Cut Your API Response Time by 70%</strong></figcaption></figure><p>Performance is not optional in modern applications.</p><p>Users expect APIs to respond in milliseconds.<br> But many Spring Boot applications slow down because:</p><ul><li>Repeated database queries</li><li>Expensive computations</li><li>High traffic spikes</li><li>Unoptimized data fetching</li></ul><p>The solution?</p><p><strong>Caching.</strong></p><p>And when it comes to high-performance caching, Redis is one of the best tools available.</p><p>Let’s see how to integrate Redis with Spring Boot and dramatically improve API performance.</p><p><a href="https://medium.com/codetodeploy/master-ai-cloud-coding-in-3-months-start-today-395947ebfd2c">Master AI, Cloud &amp; Coding in 3 Months — Start Today</a></p><h3>🧠 Why Caching Matters</h3><p>Imagine this API:</p><pre>@GetMapping(&quot;/users/{id}&quot;)<br>public User getUser(@PathVariable Long id) {<br>    return userRepository.findById(id).orElseThrow();<br>}</pre><p>Every request hits the database.</p><p>If 10,000 users request the same data →<br> 10,000 DB calls.</p><p>That’s unnecessary load.</p><p>With caching:</p><ul><li>First request → DB hit</li><li>Next requests → Served from memory</li></ul><p>Memory access is significantly faster than database access.</p><h3>⚡ Step 1: Add Redis Dependency</h3><p>In pom.xml:</p><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;<br>    &lt;artifactId&gt;spring-boot-starter-data-redis&lt;/artifactId&gt;<br>&lt;/dependency&gt;</pre><p>Also make sure Redis server is running locally or in Docker.</p><h3>⚙ Step 2: Configure Redis</h3><p>Add to application.properties:</p><pre>spring.data.redis.host=localhost<br>spring.data.redis.port=6379</pre><p>Enable caching:</p><pre>@SpringBootApplication<br>@EnableCaching<br>public class Application {<br>    public static void main(String[] args) {<br>        SpringApplication.run(Application.class, args);<br>    }<br>}</pre><h3>🚀 Step 3: Add @Cacheable</h3><p>Modify your service layer:</p><pre>@Service<br>public class UserService {<br>@Cacheable(&quot;users&quot;)<br>    public User getUserById(Long id) {<br>        simulateSlowQuery();<br>        return userRepository.findById(id).orElseThrow();<br>    }<br>    private void simulateSlowQuery() {<br>        try {<br>            Thread.sleep(2000); // simulate delay<br>        } catch (InterruptedException e) {<br>            e.printStackTrace();<br>        }<br>    }<br>}</pre><p>Now:</p><ul><li>First request → 2 seconds</li><li>Second request → instant</li></ul><p>That’s real performance improvement.</p><h3>📊 Performance Impact Example</h3><p>Without caching:</p><ul><li>Average response time: 1800ms</li></ul><p>With Redis caching:</p><ul><li>Average response time: 50ms–100ms</li></ul><p>That’s nearly <strong>70–90% improvement</strong>.</p><p>And your database load drops drastically.</p><h3>🔄 Step 4: Handle Cache Updates</h3><p>When data changes, update or clear cache:</p><pre>@CacheEvict(value = &quot;users&quot;, key = &quot;#id&quot;)<br>public void deleteUser(Long id) {<br>    userRepository.deleteById(id);<br>}</pre><p>OR</p><pre>@CachePut(value = &quot;users&quot;, key = &quot;#user.id&quot;)<br>public User updateUser(User user) {<br>    return userRepository.save(user);<br>}</pre><p>Always sync cache with database changes.</p><h3>🏗 Production Best Practices</h3><p>Don’t just enable caching blindly.</p><p>Follow these rules:</p><p>✅ Cache only frequently accessed data<br> ✅ Set TTL (Time To Live)<br> ✅ Avoid caching sensitive data<br> ✅ Monitor memory usage<br> ✅ Use Redis clustering for high traffic</p><p>Example TTL configuration:</p><pre>@Bean<br>public RedisCacheManager cacheManager(RedisConnectionFactory connectionFactory) {<br>    RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig()<br>        .entryTtl(Duration.ofMinutes(10));<br>return RedisCacheManager.builder(connectionFactory)<br>        .cacheDefaults(config)<br>        .build();<br>}</pre><h3>⚠ Common Mistakes</h3><p>❌ Caching everything<br> ❌ Not handling cache invalidation<br> ❌ Ignoring memory limits<br> ❌ Using local cache in distributed systems</p><p>Redis works best in distributed microservices.</p><h3>🎯 When Should You Use Redis?</h3><p>Use caching when:</p><ul><li>Read-heavy applications</li><li>Frequently requested data</li><li>Expensive database joins</li><li>Rate-limited external APIs</li></ul><p>Do NOT use caching when:</p><ul><li>Data changes constantly</li><li>Strong real-time consistency is required</li></ul><h3>🧩 Final Thoughts</h3><p>Spring Boot alone is powerful.</p><p>But when combined with Redis:</p><ul><li>API response time drops dramatically</li><li>Database pressure reduces</li><li>Scalability improves</li><li>User experience becomes smoother</li></ul><p>Performance is a competitive advantage.</p><p>And caching is one of the easiest ways to get it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8e16d1260c70" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codetodeploy/spring-boot-redis-caching-cut-your-api-response-time-by-70-8e16d1260c70">🚀 Spring Boot + Redis Caching: Cut Your API Response Time by 70%</a> was originally published in <a href="https://medium.com/codetodeploy">CodeToDeploy</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ How I Stress-Test Spring Boot Applications Before Production (So They Don’t Explode Later)]]></title>
            <link>https://medium.com/codetodeploy/how-i-stress-test-spring-boot-applications-before-production-so-they-dont-explode-later-1907b00f841d?source=rss-edfcd88b9fea------2</link>
            <guid isPermaLink="false">https://medium.com/p/1907b00f841d</guid>
            <category><![CDATA[application]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[before-production]]></category>
            <category><![CDATA[explode-later]]></category>
            <dc:creator><![CDATA[akash]]></dc:creator>
            <pubDate>Fri, 13 Feb 2026 16:29:14 GMT</pubDate>
            <atom:updated>2026-02-14T04:23:27.822Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BnpBwi8VogoBoQWUaucIcw.png" /><figcaption><strong>🚀 How I Stress-Test Spring Boot Applications Before Production (So They Don’t Explode Later)</strong></figcaption></figure><p>Most Spring Boot apps work perfectly…</p><p>Until real traffic hits. 😅</p><p>Then suddenly:</p><ul><li>CPU spikes</li><li>Threads block</li><li>DB connections exhaust</li><li>Latency jumps from 120ms → 3s</li></ul><p>And everyone asks:</p><blockquote><em>“But it worked fine locally?”</em></blockquote><p>Here’s exactly how I load-test <strong>Spring Boot apps before production</strong> — and what I measure to avoid disasters.</p><blockquote><strong><em>⚠️ Act Now or Miss 70% OFF VPN + 1TB FREE Cloud Storage!<br></em></strong><em> This heavy discount won’t last forever — secure your deal today.<br> ✅ 30-Day Money-Back Guarantee — zero risk.</em></blockquote><blockquote><em>👉 </em><a href="https://go.nordvpn.net/aff_c?offer_id=15&amp;aff_id=121274"><strong><em>Get 1TB + VPN</em></strong></a></blockquote><h3>🎯 Step 1: Define What “Healthy” Means</h3><p>Before testing, define:</p><ul><li>✅ Expected RPS (Requests Per Second)</li><li>✅ Acceptable P95 latency</li><li>✅ Error rate threshold</li><li>✅ Max CPU usage</li><li>✅ Max DB connections</li></ul><p>Example:</p><pre>Target: 500 RPS<br>P95 Latency &lt; 250ms<br>Error Rate &lt; 1%</pre><p>Without this, load testing is just noise.</p><h3>🛠️ Step 2: Use the Right Tool</h3><p>My go-to tools:</p><ul><li>🔥 Apache JMeter</li><li>⚡ k6</li><li>🚀 Gatling</li></ul><p>For lightweight, modern testing, I prefer <strong>k6</strong>.</p><h3>🧪 Example k6 Test Script</h3><pre>import http from &#39;k6/http&#39;;<br>import { sleep } from &#39;k6&#39;;<br>export const options = {<br>  vus: 100,<br>  duration: &#39;2m&#39;,<br>};<br>export default function () {<br>  http.get(&#39;http://localhost:8080/api/products&#39;);<br>  sleep(1);<br>}</pre><p>Run:</p><pre>k6 run test.js</pre><p>Now you simulate 100 concurrent users.</p><h3>📊 Step 3: Enable Observability First</h3><p>Before load testing, enable metrics in Spring Boot.</p><p>Add Actuator:</p><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;<br>    &lt;artifactId&gt;spring-boot-starter-actuator&lt;/artifactId&gt;<br>&lt;/dependency&gt;</pre><p>Expose endpoints:</p><pre>management:<br>  endpoints:<br>    web:<br>      exposure:<br>        include: metrics,health</pre><p>Now monitor:</p><ul><li>jvm.memory.used</li><li>system.cpu.usage</li><li>hikaricp.connections.active</li><li>http.server.requests</li></ul><p>Without observability, you’re blind.</p><h3>🧵 Step 4: Monitor Thread Pool Saturation</h3><p>Tomcat default max threads:</p><pre>server:<br>  tomcat:<br>    threads:<br>      max: 200</pre><p>If:</p><ul><li>Active threads = 200</li><li>Requests queue</li><li>Latency spikes</li></ul><p>You’re thread-bound.</p><p>Use metrics to check thread usage during test.</p><h3>🗄️ Step 5: Check Database Pool Under Load</h3><p>HikariCP default pool = 10.</p><p>During load test, check:</p><pre>/actuator/metrics/hikaricp.connections.active</pre><p>If:</p><ul><li>Active = max</li><li>Pending &gt; 0</li></ul><p>You have a connection bottleneck.</p><p>Often the app is slow not because DB is slow — <br> but because connections are exhausted.</p><h3>🧠 Step 6: Simulate Realistic Traffic Patterns</h3><p>Bad load test:</p><ul><li>Constant fixed load</li><li>Simple GET endpoint</li></ul><p>Realistic load test:</p><ul><li>Mixed endpoints</li><li>Authenticated users</li><li>DB writes + reads</li><li>Traffic spikes</li></ul><p>Example spike config (k6):</p><pre>export const options = {<br>  stages: [<br>    { duration: &#39;1m&#39;, target: 50 },<br>    { duration: &#39;2m&#39;, target: 200 },<br>    { duration: &#39;1m&#39;, target: 0 },<br>  ],<br>};</pre><p>This reveals scaling behavior.</p><h3>💥 Step 7: Test Failure Scenarios</h3><p>Don’t just test happy path.</p><p>Test:</p><ul><li>DB slow response</li><li>Redis down</li><li>External API timeout</li><li>Network latency</li></ul><p>Simulate slow DB query:</p><pre>SELECT pg_sleep(3);</pre><p>See how your API reacts.</p><p>If one slow dependency collapses your app — you need circuit breakers.</p><h3>🔥 Step 8: Measure P95 and P99 — Not Average</h3><p>Average latency lies.</p><p>Example:</p><pre>Average: 120ms<br>P95: 1.8s</pre><p>That means 5% of users suffer badly.</p><p>Always track:</p><ul><li>P95</li><li>P99</li></ul><p>That’s real-world experience.</p><h3>🧪 Step 9: Run Tests in Production-Like Environment</h3><p>Never trust local laptop tests.</p><p>Production-like means:</p><ul><li>Same CPU cores</li><li>Same DB config</li><li>Same container limits</li><li>Same network conditions</li></ul><p>Otherwise results are misleading.</p><h3>🛡️ Step 10: Watch for Memory Leaks</h3><p>During long test (15–30 min):</p><p>Check:</p><pre>jvm.memory.used</pre><p>If memory keeps rising without stabilizing:</p><ul><li>You may have object retention</li><li>Large collections</li><li>Unclosed streams</li></ul><p>Load testing exposes slow leaks.</p><h3>⚡ Step 11: Identify the First Bottleneck</h3><p>Under load, one resource fails first:</p><ul><li>CPU</li><li>Threads</li><li>DB connections</li><li>Network</li><li>GC pauses</li></ul><p>Find the FIRST limiter.</p><p>Fix that.</p><p>Then test again.</p><p>Performance tuning is iterative.</p><h3>📈 My Real Example</h3><p>Before load test:</p><ul><li>150 RPS stable</li><li>P95 = 90ms</li></ul><p>At 400 RPS:</p><ul><li>P95 = 2.3s</li><li>DB connections maxed</li><li>Threads blocked</li></ul><p>Fix:</p><ul><li>Increase pool to 25</li><li>Reduce transaction time</li><li>Add async for heavy endpoint</li></ul><p>After:</p><ul><li>500 RPS stable</li><li>P95 = 210ms</li></ul><p>Same codebase. Better configuration.</p><h3>🏗️ My Load Testing Checklist</h3><p>Before production I verify:</p><p>☑️ Thread pool not saturated<br> ☑️ DB pool not exhausted<br> ☑️ No memory growth over time<br> ☑️ Error rate &lt; 1%<br> ☑️ P95 latency acceptable<br> ☑️ Circuit breakers working<br> ☑️ App recovers after spike</p><p>If these pass, I feel confident.</p><h3>🎯 Final Thought</h3><p>Load testing isn’t about breaking your app.</p><p>It’s about discovering:</p><ul><li>Hidden bottlenecks</li><li>Configuration mistakes</li><li>Scaling limits</li></ul><p>Before your users do.</p><p>Because production traffic is the worst time to run your first stress test.</p><h3>Thank you for being a part of the community</h3><p><em>Before you go:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d9QTaaaxboQP_gKSLedW_w.png" /></figure><p>👉 Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></p><p>👉 Follow us: <a href="https://www.linkedin.com/in/code-to-deploy-3784391b9/"><strong>Linkedin</strong></a>| <a href="https://medium.com/codetodeploy"><strong>Medium</strong></a></p><p>👉 CodeToDeploy Tech Community is live on Discord — <a href="https://discord.gg/ZpwhHq6D"><strong>Join now!</strong></a></p><p><strong>Note:</strong> This Post may contain affiliate links.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1907b00f841d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codetodeploy/how-i-stress-test-spring-boot-applications-before-production-so-they-dont-explode-later-1907b00f841d">🚀 How I Stress-Test Spring Boot Applications Before Production (So They Don’t Explode Later)</a> was originally published in <a href="https://medium.com/codetodeploy">CodeToDeploy</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ From HTTP to JSON: The Complete Internal Journey of a Spring Boot REST Request]]></title>
            <link>https://medium.com/codetodeploy/from-http-to-json-the-complete-internal-journey-of-a-spring-boot-rest-request-34c6a37027a1?source=rss-edfcd88b9fea------2</link>
            <guid isPermaLink="false">https://medium.com/p/34c6a37027a1</guid>
            <category><![CDATA[rest-request]]></category>
            <category><![CDATA[json]]></category>
            <category><![CDATA[https]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[internal-journey]]></category>
            <dc:creator><![CDATA[akash]]></dc:creator>
            <pubDate>Fri, 13 Feb 2026 16:28:39 GMT</pubDate>
            <atom:updated>2026-02-14T04:19:31.528Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gmAAiOAZzTMfVdbfmKPAlA.png" /><figcaption><strong>🔍 From HTTP to JSON: The Complete Internal Journey of a Spring Boot REST Request</strong></figcaption></figure><p>Most developers write this:</p><pre>@GetMapping(&quot;/users/{id}&quot;)<br>public User getUser(@PathVariable Long id) {<br>    return userService.findById(id);<br>}</pre><p>And it just works. 🚀</p><p>But what actually happens <strong>inside Spring Boot</strong> when a request hits your API?</p><p>Understanding this flow makes you:</p><ul><li>Better at debugging</li><li>Better at performance tuning</li><li>Better at writing clean architecture</li><li>More confident in production</li></ul><p>Let’s walk through the complete request lifecycle.</p><blockquote><strong><em>⚠️ Act Now or Miss 70% OFF VPN + 1TB FREE Cloud Storage!<br></em></strong><em> This heavy discount won’t last forever — secure your deal today.<br> ✅ 30-Day Money-Back Guarantee — zero risk.</em></blockquote><blockquote><em>👉 </em><a href="https://go.nordvpn.net/aff_c?offer_id=15&amp;aff_id=121274"><strong><em>Get 1TB + VPN</em></strong></a></blockquote><h3>🌐 Step 1: Request Hits the Embedded Server</h3><p>When you start a Spring Boot app:</p><pre>mvn spring-boot:run</pre><p>Spring Boot auto-configures an embedded server:</p><ul><li>Tomcat (default)</li><li>Jetty</li><li>Undertow</li></ul><p>The server:</p><ul><li>Opens a port (usually 8080)</li><li>Listens for HTTP requests</li><li>Assigns request to a worker thread</li></ul><p>At this point:</p><pre>Incoming HTTP → Server Thread</pre><h3>🧵 Step 2: Thread Allocation</h3><p>Tomcat uses a thread pool:</p><pre>server:<br>  tomcat:<br>    threads:<br>      max: 200</pre><p>Each request gets a thread.</p><p>If all threads are busy:</p><ul><li>New requests wait</li><li>Latency increases</li></ul><p>That’s why thread pool tuning matters under load.</p><h3>🛣️ Step 3: DispatcherServlet — The Traffic Controller</h3><p>Now the request enters:</p><pre>DispatcherServlet</pre><p>This is the heart of Spring MVC.</p><p>It:</p><ul><li>Routes requests</li><li>Finds matching controller</li><li>Handles exceptions</li><li>Coordinates everything</li></ul><p>Think of it as the central traffic controller.</p><h3>🔎 Step 4: Handler Mapping</h3><p>Spring checks:</p><ul><li>URL path</li><li>HTTP method</li><li>Headers</li><li>Parameters</li></ul><p>To match this:</p><pre>@GetMapping(&quot;/users/{id}&quot;)</pre><p>Behind the scenes:</p><pre>RequestMappingHandlerMapping</pre><p>finds the correct method.</p><p>If no match:</p><p>👉 404 returned.</p><h3>🧠 Step 5: Argument Resolution</h3><p>Before calling your method, Spring resolves parameters:</p><pre>@PathVariable Long id<br>@RequestBody UserRequest request<br>@AuthenticationPrincipal UserDetails user</pre><p>Spring uses:</p><ul><li>ArgumentResolvers</li><li>HttpMessageConverters</li></ul><p>For JSON body:</p><ul><li>Jackson converts JSON → Java object</li></ul><p>Example:</p><pre>{<br>  &quot;name&quot;: &quot;Lakshita&quot;<br>}</pre><p>Becomes:</p><pre>UserRequest(name=&quot;Lakshita&quot;)</pre><p>All automatically.</p><h3>🔐 Step 6: Security Filters (If Enabled)</h3><p>If Spring Security is present:</p><p>Request first passes through:</p><pre>Security Filter Chain</pre><p>Checks:</p><ul><li>Authentication</li><li>Authorization</li><li>JWT token</li><li>CSRF</li><li>CORS</li></ul><p>If authentication fails:</p><p>👉 401 returned before hitting controller.</p><p>Security happens BEFORE your controller logic.</p><h3>🧩 Step 7: Controller Method Execution</h3><p>Now your method runs:</p><pre>public User getUser(Long id) {<br>    return userService.findById(id);<br>}</pre><p>This is your business logic layer.</p><p>If you use:</p><pre>@Transactional</pre><p>A database transaction starts here.</p><h3>🗄️ Step 8: Service → Repository → Database</h3><p>Typical flow:</p><pre>Controller<br>   ↓<br>Service<br>   ↓<br>Repository (JPA)<br>   ↓<br>Hibernate<br>   ↓<br>Database</pre><p>Hibernate:</p><ul><li>Generates SQL</li><li>Executes query</li><li>Maps ResultSet → Entity</li></ul><p>Then returns data back up the chain.</p><h3>🔄 Step 9: Return Value Handling</h3><p>Controller returns:</p><pre>return user;</pre><p>Spring now:</p><ol><li>Uses HttpMessageConverter</li><li>Converts Java object → JSON</li><li>Sets HTTP headers</li><li>Writes response body</li></ol><p>Jackson serializes object:</p><pre>{<br>  &quot;id&quot;: 1,<br>  &quot;name&quot;: &quot;Lakshita&quot;<br>}</pre><h3>📤 Step 10: Response Sent Back to Client</h3><p>Finally:</p><pre>Response → Server → Client</pre><p>Thread is released back to pool.</p><p>Lifecycle complete.</p><h3>📊 Full Flow Visual Summary</h3><pre>Client Request<br>      ↓<br>Embedded Server (Tomcat)<br>      ↓<br>Thread Allocation<br>      ↓<br>Security Filters<br>      ↓<br>DispatcherServlet<br>      ↓<br>Handler Mapping<br>      ↓<br>Argument Resolution<br>      ↓<br>Controller<br>      ↓<br>Service Layer<br>      ↓<br>Repository (JPA)<br>      ↓<br>Database<br>      ↓<br>Response Serialization<br>      ↓<br>Client</pre><h3>⚠️ Common Performance Bottlenecks in This Flow</h3><p>Understanding flow helps identify issues:</p><h3>🔥 Thread Pool Exhaustion</h3><p>Too many blocking calls.</p><h3>🐢 Slow Database Query</h3><p>Transaction holds thread.</p><h3>🧠 Heavy JSON Serialization</h3><p>Large payloads slow response.</p><h3>🔐 Security Misconfiguration</h3><p>Extra filters slow request.</p><h3>🧵 Blocking External API Calls</h3><p>Thread waits unnecessarily.</p><p>Every bottleneck maps to a stage in this pipeline.</p><h3>🛠️ How to Debug This Flow</h3><p>Useful tools:</p><ul><li>Actuator /metrics</li><li>Logs at DEBUG level</li><li>SQL logging</li><li>Thread dump</li><li>APM tools</li></ul><p>Example enable SQL logs:</p><pre>spring:<br>  jpa:<br>    show-sql: true</pre><p>Now you see what’s happening behind the scenes.</p><h3>🚀 Why This Knowledge Matters</h3><p>Junior dev mindset:</p><blockquote><em>“Controller returns JSON. Done.”</em></blockquote><p>Senior dev mindset:</p><blockquote><em>“How many threads? What’s the transaction boundary? Where is serialization happening? What’s blocking?”</em></blockquote><p>Understanding the request flow makes you:</p><ul><li>Architect better systems</li><li>Design async endpoints correctly</li><li>Debug production faster</li><li>Optimize performance intelligently</li></ul><h3>🎯 Final Thought</h3><p>Spring Boot hides complexity beautifully.</p><p>But that complexity still exists.</p><p>When you understand:</p><ul><li>Thread lifecycle</li><li>Filter chains</li><li>DispatcherServlet</li><li>Serialization</li><li>Transaction boundaries</li></ul><p>You stop guessing.</p><p>And start engineering with intention.</p><h3>Thank you for being a part of the community</h3><p><em>Before you go:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d9QTaaaxboQP_gKSLedW_w.png" /></figure><p>👉 Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></p><p>👉 Follow us: <a href="https://www.linkedin.com/in/code-to-deploy-3784391b9/"><strong>Linkedin</strong></a>| <a href="https://medium.com/codetodeploy"><strong>Medium</strong></a></p><p>👉 CodeToDeploy Tech Community is live on Discord — <a href="https://discord.gg/ZpwhHq6D"><strong>Join now!</strong></a></p><p><strong>Note:</strong> This Post may contain affiliate links.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=34c6a37027a1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codetodeploy/from-http-to-json-the-complete-internal-journey-of-a-spring-boot-rest-request-34c6a37027a1">🔍 From HTTP to JSON: The Complete Internal Journey of a Spring Boot REST Request</a> was originally published in <a href="https://medium.com/codetodeploy">CodeToDeploy</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ We Were Tuning the Wrong Things — The Simple Fixes That Made Our Java APIs 10x Faster]]></title>
            <link>https://medium.com/codetodeploy/we-were-tuning-the-wrong-things-the-simple-fixes-that-made-our-java-apis-10x-faster-08c1c60b7c1a?source=rss-edfcd88b9fea------2</link>
            <guid isPermaLink="false">https://medium.com/p/08c1c60b7c1a</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[10x]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[akash]]></dc:creator>
            <pubDate>Thu, 12 Feb 2026 16:22:00 GMT</pubDate>
            <atom:updated>2026-02-14T02:23:51.178Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*goyZIXANJpCucynDJsA75g.png" /><figcaption><strong>We Were Tuning the Wrong Things — The Simple Fixes That Made Our Java APIs 10x Faster</strong></figcaption></figure><p>Our Java APIs were slow.</p><p>Not “slightly slow.”<br> Painfully slow.</p><ul><li>P95 latency: ~900ms 😵</li><li>CPU spikes under load 🔥</li><li>Random timeouts ⏳</li><li>Dev team blaming the database (of course 😅)</li></ul><p>We spent months “optimizing.”</p><p>Then a senior engineer joined a call, looked at our setup for 20 minutes, and casually said:</p><blockquote><em>“Why are you tuning symptoms instead of fixing the bottlenecks?”</em></blockquote><p>Two days later…</p><p>10x faster.</p><p>Here’s what actually changed.</p><blockquote><strong><em>⚠️ Act Now or Miss 70% OFF VPN + 1TB FREE Cloud Storage!<br></em></strong><em> This heavy discount won’t last forever — secure your deal today.<br> ✅ 30-Day Money-Back Guarantee — zero risk.</em></blockquote><blockquote><em>👉 </em><a href="https://go.nordvpn.net/aff_c?offer_id=15&amp;aff_id=121274"><strong><em>Get 1TB + VPN</em></strong></a></blockquote><h3>⚠️ Mistake #1: We Were Returning Huge Payloads</h3><p>Our API:</p><pre>@GetMapping(&quot;/users&quot;)<br>public List&lt;User&gt; getUsers() {<br>    return userRepository.findAll();<br>}</pre><p>Looks innocent.</p><p>But User had:</p><ul><li>Orders</li><li>Addresses</li><li>Roles</li><li>Audit fields</li><li>Relationships</li></ul><p>Hibernate was loading everything.<br> We were sending megabytes per request.</p><h3>✅ Fix: Use DTO + Projection</h3><pre>public interface UserSummary {<br>    Long getId();<br>    String getName();<br>    String getEmail();<br>}<br>@Query(&quot;SELECT u.id AS id, u.name AS name, u.email AS email FROM User u&quot;)<br>List&lt;UserSummary&gt; findUserSummaries();</pre><p>Response size dropped by 80%.</p><p>Latency dropped instantly. 🚀</p><h3>⚠️ Mistake #2: N+1 Query Problem</h3><p>We had this pattern everywhere:</p><pre>List&lt;Order&gt; orders = orderRepository.findAll();<br>for (Order order : orders) {<br>    order.getItems().size();<br>}</pre><p>Under load, it became:</p><p>1 query + 500 extra queries 😳</p><h3>✅ Fix: Fetch Join</h3><pre>@Query(&quot;SELECT o FROM Order o JOIN FETCH o.items&quot;)<br>List&lt;Order&gt; findAllWithItems();</pre><p>Query count went from 501 → 1.</p><p>Database CPU dropped by half.</p><h3>⚠️ Mistake #3: Thread Pool Bottleneck</h3><p>We were using default Tomcat threads.</p><p>Under load, requests were queuing.</p><h3>✅ Fix: Tune Thread Pool</h3><pre>server:<br>  tomcat:<br>    threads:<br>      max: 200<br>      min-spare: 20</pre><p>Throughput improved immediately.</p><p>Sometimes defaults aren’t wrong — just not optimized for your traffic.</p><h3>⚠️ Mistake #4: Blocking External Calls</h3><p>We were calling another service synchronously:</p><pre>String result = restTemplate.getForObject(url, String.class);</pre><p>Each call blocked a thread.</p><p>Under load, thread starvation happened.</p><h3>✅ Fix: Timeout + Pooling</h3><pre>@Bean<br>public RestTemplate restTemplate() {<br>    HttpComponentsClientHttpRequestFactory factory =<br>        new HttpComponentsClientHttpRequestFactory();<br>factory.setConnectTimeout(3000);<br>    factory.setReadTimeout(3000);<br>    return new RestTemplate(factory);<br>}</pre><p>Even better? Move slow calls async.</p><h3>⚠️ Mistake #5: No Caching</h3><p>We were hitting DB for data that changed once a day.</p><h3>✅ Fix: Add Caching</h3><pre>@EnableCaching<br>@Cacheable(&quot;products&quot;)<br>public List&lt;Product&gt; getAllProducts() {<br>    return productRepository.findAll();<br>}</pre><p>API response time:</p><p>450ms → 40ms ⚡</p><h3>⚠️ Mistake #6: Debug Logging in Production</h3><p>Yes… we had this:</p><pre>logging:<br>  level:<br>    root: DEBUG</pre><p>Under heavy traffic, logging alone was adding latency.</p><h3>✅ Fix:</h3><pre>logging:<br>  level:<br>    root: INFO</pre><p>CPU stabilized.</p><h3>📊 The Result</h3><p>Before:</p><ul><li>P95 latency: 900ms</li><li>Throughput: 300 req/sec</li><li>CPU: 85%</li><li>DB overloaded</li></ul><p>After:</p><ul><li>P95 latency: 90ms 🚀</li><li>Throughput: 2,500+ req/sec</li><li>CPU: 45%</li><li>Stable under load</li></ul><p>No massive rewrite.<br> No microservices migration.<br> No hardware upgrade.</p><p>Just fixing architectural mistakes.</p><h3>🧠 What the Senior Engineer Actually Did</h3><p>He didn’t tune JVM flags.</p><p>He didn’t add more servers.</p><p>He asked:</p><ol><li>Are you sending too much data?</li><li>Are you running too many queries?</li><li>Are you blocking threads?</li><li>Are you measuring properly?</li><li>Are you using defaults blindly?</li></ol><p>Performance isn’t magic.</p><p>It’s eliminating waste.</p><h3>🎯 The Real Lesson</h3><p>We were optimizing at the wrong layer.</p><p>We were tuning GC…</p><p>While Hibernate was firing 500 queries.</p><p>We were tweaking heap size…</p><p>While sending 5MB JSON responses.</p><p>We were scaling horizontally…</p><p>While blocking threads on slow HTTP calls.</p><h3>🚀 Final Thought</h3><p>10x performance improvements rarely come from clever tricks.</p><p>They come from:</p><ul><li>Fixing data access</li><li>Reducing payload size</li><li>Removing unnecessary work</li><li>Measuring bottlenecks honestly</li></ul><p>Sometimes all it takes is a fresh pair of senior eyes.</p><p>And a few uncomfortable questions.</p><h3>Thank you for being a part of the community</h3><p><em>Before you go:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d9QTaaaxboQP_gKSLedW_w.png" /></figure><p>👉 Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></p><p>👉 Follow us: <a href="https://www.linkedin.com/in/code-to-deploy-3784391b9/"><strong>Linkedin</strong></a>| <a href="https://medium.com/codetodeploy"><strong>Medium</strong></a></p><p>👉 CodeToDeploy Tech Community is live on Discord — <a href="https://discord.gg/ZpwhHq6D"><strong>Join now!</strong></a></p><p><strong>Note:</strong> This Post may contain affiliate links.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=08c1c60b7c1a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codetodeploy/we-were-tuning-the-wrong-things-the-simple-fixes-that-made-our-java-apis-10x-faster-08c1c60b7c1a">🚀 We Were Tuning the Wrong Things — The Simple Fixes That Made Our Java APIs 10x Faster</a> was originally published in <a href="https://medium.com/codetodeploy">CodeToDeploy</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Your Database Is Fast.]]></title>
            <link>https://medium.com/codetodeploy/your-database-is-fast-6238532f3078?source=rss-edfcd88b9fea------2</link>
            <guid isPermaLink="false">https://medium.com/p/6238532f3078</guid>
            <category><![CDATA[connection]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[apps]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[bottleneck]]></category>
            <dc:creator><![CDATA[akash]]></dc:creator>
            <pubDate>Thu, 12 Feb 2026 16:21:12 GMT</pubDate>
            <atom:updated>2026-02-14T02:22:28.549Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lVEwMvRPkNx_AWfeo4zWcg.png" /><figcaption><strong>🚰 Your Database Is Fast. Your App Is Slow. The Hidden Bottleneck: Connection Pools Explained Simply</strong></figcaption></figure><h3>🚰 Your Database Is Fast. Your App Is Slow. The Hidden Bottleneck: Connection Pools Explained Simply</h3><p>You check your database metrics.</p><ul><li>CPU: Normal ✅</li><li>Query time: Fast ✅</li><li>No locks ❌</li><li>No slow queries ❌</li></ul><p>But your API is still slow.</p><p>Response times spike under load.<br> Threads start waiting.<br> Everything feels “stuck.”</p><p>The problem?</p><p>🧠 <strong>Database Connection Pool Misconfiguration.</strong></p><p>Let’s break this down visually and practically.</p><blockquote><strong><em>⚠️ Act Now or Miss 70% OFF VPN + 1TB FREE Cloud Storage!<br></em></strong><em> This heavy discount won’t last forever — secure your deal today.<br> ✅ 30-Day Money-Back Guarantee — zero risk.</em></blockquote><blockquote><em>👉 </em><a href="https://go.nordvpn.net/aff_c?offer_id=15&amp;aff_id=121274"><strong><em>Get 1TB + VPN</em></strong></a></blockquote><h3>🏗️ First: What Is a Database Connection Pool?</h3><p>Opening a database connection is expensive.</p><p>Instead of creating a new connection for every request, Spring Boot uses a <strong>connection pool</strong> (HikariCP by default).</p><p>Think of it like this:</p><pre>Incoming Requests → [ Connection Pool ] → Database</pre><p>The pool holds a limited number of reusable DB connections.</p><h3>🎨 Visual Analogy</h3><p>Imagine:</p><ul><li>100 users hit your API at once</li><li>Your connection pool size = 10</li></ul><p>What happens?</p><pre>100 requests<br>     ↓<br>10 DB connections available<br>     ↓<br>90 requests WAITING ⏳</pre><p>Your database is fine.</p><p>Your app is queuing.</p><p>That’s the slowdown.</p><h3>🔥 Why This Causes Latency Spikes</h3><p>Each incoming request needs:</p><ol><li>A thread</li><li>A DB connection</li></ol><p>If no connection is available:</p><p>👉 Thread blocks<br> 👉 Latency increases<br> 👉 Eventually timeouts</p><p>The DB is idle — but your app is starving.</p><h3>📊 Default Spring Boot Setup (HikariCP)</h3><p>By default:</p><pre>spring:<br>  datasource:<br>    hikari:<br>      maximum-pool-size: 10</pre><p>Ten connections.</p><p>That’s it.</p><p>For production APIs, that’s often too low.</p><h3>🚨 The Classic Misconfiguration</h3><p>Tomcat thread pool:</p><pre>server:<br>  tomcat:<br>    threads:<br>      max: 200</pre><p>DB pool:</p><pre>maximum-pool-size: 10</pre><p>So now:</p><ul><li>200 request threads</li><li>10 DB connections</li></ul><p>190 threads compete for 10 connections.</p><p>That’s artificial bottlenecking.</p><h3>⚡ How to Size Connection Pool Properly</h3><p>Rule of thumb:</p><pre>Pool Size ≈ (CPU Cores × 2) + Disk Factor</pre><p>Example:</p><p>8-core machine:</p><pre>(8 × 2) + 2 = ~18 connections</pre><p>Start small. Load test. Measure.</p><h3>🛠️ Proper Configuration Example</h3><pre>spring:<br>  datasource:<br>    hikari:<br>      maximum-pool-size: 20<br>      minimum-idle: 10<br>      idle-timeout: 30000<br>      max-lifetime: 1800000<br>      connection-timeout: 30000</pre><p>Important settings:</p><ul><li>maximum-pool-size → total DB connections</li><li>connection-timeout → how long request waits</li><li>max-lifetime → prevents stale connections</li></ul><h3>🧠 Why Bigger Is NOT Always Better</h3><p>Some developers panic and do this:</p><pre>maximum-pool-size: 200</pre><p>Bad idea ❌</p><p>Why?</p><ul><li>Too many DB connections overload database</li><li>Context switching increases</li><li>DB memory usage spikes</li></ul><p>Your database also has limits.</p><p>Balance matters.</p><h3>📉 How to Detect Pool Problems</h3><p>Enable metrics:</p><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;<br>    &lt;artifactId&gt;spring-boot-starter-actuator&lt;/artifactId&gt;<br>&lt;/dependency&gt;</pre><p>Expose metrics:</p><pre>management:<br>  endpoints:<br>    web:<br>      exposure:<br>        include: metrics</pre><p>Check:</p><pre>/actuator/metrics/hikaricp.connections.active<br>/actuator/metrics/hikaricp.connections.pending</pre><p>If:</p><ul><li>Active = Max</li><li>Pending &gt; 0</li></ul><p>You have a pool bottleneck.</p><h3>🎯 Common Real-World Scenario</h3><p>Traffic spike happens.</p><p>Pool gets exhausted.</p><p>Requests queue.</p><p>Response time jumps from:</p><p>80ms → 2 seconds.</p><p>Database is still fine.</p><p>Developers blame:</p><ul><li>Network</li><li>Garbage collector</li><li>Kubernetes</li><li>“Cloud issues” 😅</li></ul><p>But it’s just connection starvation.</p><h3>🔄 Another Hidden Issue: Long Transactions</h3><p>Even with correct pool size, if transactions are slow:</p><pre>@Transactional<br>public void processOrder(Order order) {<br>    // slow external call here ❌<br>    externalService.call();<br>    orderRepository.save(order);<br>}</pre><p>Connection is held during entire transaction.</p><p>If external call is slow, connection is blocked.</p><p>Fix:</p><ul><li>Keep transactions short</li><li>Never call external services inside transaction</li></ul><h3>🏎️ Performance Before &amp; After Tuning</h3><p>Before:</p><ul><li>Pool size: 10</li><li>Active connections: always 10</li><li>Pending: 30+</li><li>Latency: 1.5s</li></ul><p>After tuning:</p><ul><li>Pool size: 20</li><li>Active: 15–18</li><li>Pending: 0</li><li>Latency: 120ms 🚀</li></ul><p>Same database.<br> Same code.<br> Different pool.</p><h3>🧠 The Real Lesson</h3><p>When your app is slow but DB looks healthy:</p><p>Don’t check query speed first.</p><p>Check:</p><ul><li>Connection pool saturation</li><li>Pending connections</li><li>Transaction duration</li><li>Thread pool mismatch</li></ul><p>Performance problems are often bottlenecks — not raw speed issues.</p><h3>🏆 Final Thought</h3><p>Your database might not be slow.</p><p>Your application might just be waiting in line.</p><p>And sometimes…</p><p>All you need is a better-sized pool. 🚰🚀</p><h3>Thank you for being a part of the community</h3><p><em>Before you go:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d9QTaaaxboQP_gKSLedW_w.png" /></figure><p>👉 Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></p><p>👉 Follow us: <a href="https://www.linkedin.com/in/code-to-deploy-3784391b9/"><strong>Linkedin</strong></a>| <a href="https://medium.com/codetodeploy"><strong>Medium</strong></a></p><p>👉 CodeToDeploy Tech Community is live on Discord — <a href="https://discord.gg/ZpwhHq6D"><strong>Join now!</strong></a></p><p><strong>Note:</strong> This Post may contain affiliate links.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6238532f3078" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codetodeploy/your-database-is-fast-6238532f3078">🚰 Your Database Is Fast.</a> was originally published in <a href="https://medium.com/codetodeploy">CodeToDeploy</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Spring Boot Performance Tuning: 11 Battle-Tested Optimizations for High-Traffic Apps]]></title>
            <link>https://medium.com/codetodeploy/spring-boot-performance-tuning-11-battle-tested-optimizations-for-high-traffic-apps-96d4d4b9c489?source=rss-edfcd88b9fea------2</link>
            <guid isPermaLink="false">https://medium.com/p/96d4d4b9c489</guid>
            <category><![CDATA[optimization]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[high-traffic-apps]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[code]]></category>
            <dc:creator><![CDATA[akash]]></dc:creator>
            <pubDate>Wed, 11 Feb 2026 15:56:35 GMT</pubDate>
            <atom:updated>2026-02-12T12:43:53.288Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/399/1*V0hzquTB7WK_ILp3xrJBCQ.png" /><figcaption><strong>🚀 Spring Boot Performance Tuning: 11 Battle-Tested Optimizations for High-Traffic Apps</strong></figcaption></figure><p>Spring Boot makes it ridiculously easy to ship APIs fast.</p><p>But when traffic grows…</p><ul><li>Response time increases ⏳</li><li>CPU spikes 🔥</li><li>Memory pressure rises 📈</li><li>GC pauses hurt latency 😵</li></ul><p>Performance isn’t about one magic setting.<br> It’s about tuning multiple layers together.</p><p>Here are <strong>11 production-ready optimizations</strong> every Spring Boot developer should know.</p><blockquote><strong><em>⚠️ Act Now or Miss 70% OFF VPN + 1TB FREE Cloud Storage!<br></em></strong><em> This heavy discount won’t last forever — secure your deal today.<br> ✅ 30-Day Money-Back Guarantee — zero risk.</em></blockquote><blockquote><em>👉 </em><a href="https://go.nordvpn.net/aff_c?offer_id=15&amp;aff_id=121274"><strong><em>Get 1TB + VPN</em></strong></a></blockquote><h3>1️⃣ Enable Lazy Initialization (Faster Startup) ⚡</h3><p>Reduces startup time by loading beans only when needed.</p><pre>spring:<br>  main:<br>    lazy-initialization: true</pre><p>👉 Good for large microservices<br> ⚠️ Don’t use if you want fail-fast behavior</p><h3>2️⃣ Use Spring Boot Native Image (Instant Startup) 🚀</h3><p>With GraalVM:</p><pre>mvn -Pnative native:compile</pre><p>Benefits:</p><ul><li>50–80% lower memory</li><li>Near-instant startup</li><li>Great for serverless</li></ul><p>Perfect for high-scale, short-lived containers.</p><h3>3️⃣ Tune Tomcat Thread Pool 🧵</h3><p>Default settings are rarely optimal.</p><pre>server:<br>  tomcat:<br>    threads:<br>      max: 200<br>      min-spare: 20</pre><p>Too low → requests queue<br> Too high → CPU thrashing</p><p>Find balance based on load testing.</p><h3>4️⃣ Use Connection Pooling Properly (HikariCP) 🗄️</h3><p>Spring Boot uses HikariCP by default — tune it.</p><pre>spring:<br>  datasource:<br>    hikari:<br>      maximum-pool-size: 20<br>      minimum-idle: 10<br>      idle-timeout: 30000</pre><p>💡 Rule of thumb:<br> Pool size ≈ (CPU cores × 2) + disk factor</p><p>Avoid huge pool sizes — they kill DB performance.</p><h3>5️⃣ Avoid N+1 Query Problem 🧨</h3><p>Bad:</p><pre>List&lt;Order&gt; orders = orderRepository.findAll();<br>for(Order o : orders) {<br>    o.getItems().size(); // triggers extra query<br>}</pre><p>Fix with fetch join:</p><pre>@Query(&quot;SELECT o FROM Order o JOIN FETCH o.items&quot;)<br>List&lt;Order&gt; findAllWithItems();</pre><p>Or use:</p><pre>@EntityGraph(attributePaths = &quot;items&quot;)</pre><p>This alone can reduce response time drastically.</p><h3>6️⃣ Enable Response Compression 📦</h3><p>Saves bandwidth, improves latency.</p><pre>server:<br>  compression:<br>    enabled: true<br>    mime-types: application/json<br>    min-response-size: 1024</pre><p>Especially helpful for large JSON APIs.</p><h3>7️⃣ Cache Smartly (Redis / Caffeine) ⚡</h3><p>Enable caching:</p><pre>@EnableCaching</pre><p>Example:</p><pre>@Cacheable(&quot;users&quot;)<br>public User getUser(Long id) {<br>    return userRepository.findById(id).orElseThrow();<br>}</pre><p>Now repeated calls don’t hit DB.</p><p>Huge performance gain for read-heavy systems 📈</p><h3>8️⃣ Optimize Logging 🪵</h3><p>Excessive logging kills performance.</p><p>Bad:</p><pre>logging:<br>  level:<br>    root: DEBUG</pre><p>Better:</p><pre>logging:<br>  level:<br>    root: INFO</pre><p>Avoid logging inside tight loops.</p><h3>9️⃣ Use Asynchronous Processing for Slow Tasks 🔄</h3><p>Instead of blocking request thread:</p><pre>@Async<br>public void sendEmail(Order order) {<br>    emailService.send(order);<br>}</pre><p>Enable async:</p><pre>@EnableAsync</pre><p>Offloads heavy tasks (email, notifications, file processing).</p><h3>🔟 Use Proper JVM Tuning 🧠</h3><p>Set memory limits explicitly:</p><pre>java -Xms512m -Xmx1024m -jar app.jar</pre><p>For containers:</p><pre>-XX:+UseContainerSupport</pre><p>Monitor:</p><ul><li>GC time</li><li>Heap usage</li><li>Thread count</li></ul><p>GC tuning can drastically reduce latency spikes.</p><h3>1️⃣1️⃣ Monitor Before You Tune (Actuator + Micrometer) 📊</h3><p>Never guess.</p><p>Add dependency:</p><pre>&lt;dependency&gt;<br>    &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;<br>    &lt;artifactId&gt;spring-boot-starter-actuator&lt;/artifactId&gt;<br>&lt;/dependency&gt;</pre><p>Expose metrics:</p><pre>management:<br>  endpoints:<br>    web:<br>      exposure:<br>        include: health,metrics,prometheus</pre><p>Track:</p><ul><li>JVM memory</li><li>HTTP latency</li><li>DB connections</li><li>Thread usage</li></ul><p>Without metrics, tuning is blind optimization.</p><h3>⚡ Bonus: Use WebFlux for High Concurrency</h3><p>If your app is I/O heavy:</p><pre>@RestController<br>public class UserController {</pre><pre>    @GetMapping(&quot;/users/{id}&quot;)<br>    public Mono&lt;User&gt; getUser(@PathVariable Long id) {<br>        return userService.getUserReactive(id);<br>    }<br>}</pre><p>WebFlux handles thousands of concurrent requests with fewer threads.</p><p>But only use it when needed.</p><h3>🏆 Production Performance Checklist</h3><p>Before scaling your Spring Boot app:</p><ul><li>✅ Load test (JMeter / k6)</li><li>✅ Monitor CPU &amp; memory</li><li>✅ Check DB query plans</li><li>✅ Tune connection pool</li><li>✅ Add caching</li><li>✅ Remove unnecessary logging</li><li>✅ Track consumer lag (if Kafka)</li><li>✅ Profile with VisualVM / JFR</li></ul><h3>🎯 Final Thought</h3><p>Performance tuning isn’t about making your app fast.</p><p>It’s about making it <strong>predictable under load</strong>.</p><p>Because:</p><blockquote><em>Fast locally means nothing.<br> Stable under 10x traffic means everything.</em></blockquote><h3>Thank you for being a part of the community</h3><p><em>Before you go:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d9QTaaaxboQP_gKSLedW_w.png" /></figure><p>👉 Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></p><p>👉 Follow us: <a href="https://www.linkedin.com/in/code-to-deploy-3784391b9/"><strong>Linkedin</strong></a>| <a href="https://medium.com/codetodeploy"><strong>Medium</strong></a></p><p>👉 CodeToDeploy Tech Community is live on Discord — <a href="https://discord.gg/ZpwhHq6D"><strong>Join now!</strong></a></p><p><strong>Note:</strong> This Post may contain affiliate links.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=96d4d4b9c489" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codetodeploy/spring-boot-performance-tuning-11-battle-tested-optimizations-for-high-traffic-apps-96d4d4b9c489">🚀 Spring Boot Performance Tuning: 11 Battle-Tested Optimizations for High-Traffic Apps</a> was originally published in <a href="https://medium.com/codetodeploy">CodeToDeploy</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ The Spring Boot Upgrade That Out performed Months of Performance Tuning]]></title>
            <link>https://medium.com/codetodeploy/the-spring-boot-upgrade-that-outperformed-months-of-performance-tuning-1640eecc72b4?source=rss-edfcd88b9fea------2</link>
            <guid isPermaLink="false">https://medium.com/p/1640eecc72b4</guid>
            <category><![CDATA[outperformance]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[upgrade]]></category>
            <dc:creator><![CDATA[akash]]></dc:creator>
            <pubDate>Wed, 11 Feb 2026 15:55:37 GMT</pubDate>
            <atom:updated>2026-02-12T12:42:50.833Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cnijCLOvqR9G4sPlWPZ2-w.png" /><figcaption><strong>🚀 The Spring Boot Upgrade That Outperformed Months of Performance Tuning</strong></figcaption></figure><p>For months, I was optimizing everything.</p><ul><li>Tuned HikariCP 🗄️</li><li>Reduced logging 🪵</li><li>Added caching ⚡</li><li>Tweaked JVM flags 🧠</li><li>Profiled GC pauses 📉</li></ul><p>And yes… performance improved.</p><p>But then something unexpected happened.</p><p>I upgraded Spring Boot.</p><p>And the performance jump was bigger than all those optimizations combined. 😳</p><blockquote><strong><em>⚠️ Act Now or Miss 70% OFF VPN + 1TB FREE Cloud Storage!<br></em></strong><em> This heavy discount won’t last forever — secure your deal today.<br> ✅ 30-Day Money-Back Guarantee — zero risk.</em></blockquote><blockquote><em>👉 </em><a href="https://go.nordvpn.net/aff_c?offer_id=15&amp;aff_id=121274"><strong><em>Get 1TB + VPN</em></strong></a></blockquote><h3>🔥 Old Version vs New Version</h3><p>I upgraded:</p><pre>Spring Boot 2.6 → Spring Boot 3.x<br>Java 11 → Java 21</pre><p>No major code rewrite.<br> No architecture change.<br> Just dependency upgrades.</p><p>And here’s what happened 👇</p><h3>⚡ What Improved Immediately</h3><ul><li>Faster startup time 🚀</li><li>Lower memory usage 📉</li><li>Better GC performance 🧠</li><li>Improved HTTP throughput 📈</li><li>Reduced latency spikes ⏳</li></ul><p>Why?</p><p>Because newer Spring Boot versions bring:</p><ul><li>Better default configurations</li><li>Optimized dependency trees</li><li>Improved embedded server tuning</li><li>Updated Tomcat/Netty versions</li><li>Better JVM compatibility</li></ul><p>Sometimes the framework evolves faster than your tuning skills 😅</p><h3>🛠️ The Upgrade Process (Step-by-Step)</h3><h3>1️⃣ Update Parent Version</h3><pre>&lt;parent&gt;<br>    &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;<br>    &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;<br>    &lt;version&gt;3.2.5&lt;/version&gt;<br>&lt;/parent&gt;</pre><h3>2️⃣ Upgrade Java Version</h3><pre>&lt;properties&gt;<br>    &lt;java.version&gt;21&lt;/java.version&gt;<br>&lt;/properties&gt;</pre><p>Run with:</p><pre>java -version</pre><p>Java 21 brings:</p><ul><li>Better GC defaults</li><li>Performance improvements</li><li>Virtual threads support</li></ul><h3>3️⃣ Fix Jakarta Namespace Changes</h3><p>Spring Boot 3 uses <strong>Jakarta</strong>, not javax.</p><p>Before ❌</p><pre>import javax.persistence.Entity;</pre><p>After ✅</p><pre>import jakarta.persistence.Entity;</pre><p>That was the biggest breaking change.</p><h3>📊 Real Performance Difference</h3><p>Before upgrade:</p><ul><li>Startup: ~18 seconds</li><li>Memory usage: ~900MB</li><li>P99 latency: 480ms</li></ul><p>After upgrade:</p><ul><li>Startup: ~9 seconds 🚀</li><li>Memory usage: ~650MB 📉</li><li>P99 latency: 310ms ⚡</li></ul><p>No architecture change.</p><p>Just upgrade.</p><h3>🧠 Why Upgrades Improve Performance</h3><h3>1️⃣ Better Dependency Optimization</h3><p>Spring Boot removes outdated transitive libraries.</p><h3>2️⃣ Embedded Server Improvements</h3><p>New Tomcat/Undertow versions are faster.</p><h3>3️⃣ Improved Default Config</h3><p>Thread pools and connection handling improve across releases.</p><h3>4️⃣ JVM Improvements</h3><p>New Java versions optimize memory, GC, and JIT.</p><h3>🚀 Bonus: Virtual Threads (Game Changer)</h3><p>With Java 21:</p><pre>@Bean<br>public Executor taskExecutor() {<br>    return Executors.newVirtualThreadPerTaskExecutor();<br>}</pre><p>Or enable in Spring Boot:</p><pre>spring:<br>  threads:<br>    virtual:<br>      enabled: true</pre><p>Now your app can handle thousands of concurrent requests with fewer resources.</p><h3>⚠️ But Be Careful</h3><p>Upgrading blindly can break:</p><ul><li>Security config</li><li>Hibernate behavior</li><li>Custom filters</li><li>Deprecated APIs</li></ul><p>Always:</p><ul><li>Run integration tests</li><li>Load test before production</li><li>Read migration guide</li></ul><h3>💡 The Hidden Lesson</h3><p>We often try to micro-optimize:</p><ul><li>Thread pools</li><li>GC flags</li><li>Logging levels</li><li>Pool sizes</li></ul><p>But forget the biggest optimization lever:</p><blockquote><em>Stay on modern framework versions.</em></blockquote><p>Framework teams have already solved problems you’re manually tuning.</p><h3>🏗️ Upgrade Strategy for Production Teams</h3><ol><li>Upgrade every 6–12 months</li><li>Avoid staying 3+ major versions behind</li><li>Track deprecations early</li><li>Use CI to test compatibility</li><li>Measure performance before &amp; after</li></ol><h3>🎯 Final Thought</h3><p>Months of tuning gave me incremental improvements.</p><p>A simple Spring Boot + Java upgrade gave me exponential improvement.</p><p>Sometimes performance isn’t about working harder…</p><p>It’s about moving forward. 🚀</p><h3>Thank you for being a part of the community</h3><p><em>Before you go:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d9QTaaaxboQP_gKSLedW_w.png" /></figure><p>👉 Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></p><p>👉 Follow us: <a href="https://www.linkedin.com/in/code-to-deploy-3784391b9/"><strong>Linkedin</strong></a>| <a href="https://medium.com/codetodeploy"><strong>Medium</strong></a></p><p>👉 CodeToDeploy Tech Community is live on Discord — <a href="https://discord.gg/ZpwhHq6D"><strong>Join now!</strong></a></p><p><strong>Note:</strong> This Post may contain affiliate links.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1640eecc72b4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codetodeploy/the-spring-boot-upgrade-that-outperformed-months-of-performance-tuning-1640eecc72b4">🚀 The Spring Boot Upgrade That Out performed Months of Performance Tuning</a> was originally published in <a href="https://medium.com/codetodeploy">CodeToDeploy</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[⚡ Spring Boot That Starts in Milliseconds]]></title>
            <link>https://medium.com/codetodeploy/spring-boot-that-starts-in-milliseconds-2c74e908b497?source=rss-edfcd88b9fea------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c74e908b497</guid>
            <category><![CDATA[start]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[millisecods]]></category>
            <dc:creator><![CDATA[akash]]></dc:creator>
            <pubDate>Tue, 10 Feb 2026 14:31:14 GMT</pubDate>
            <atom:updated>2026-02-11T12:16:28.395Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zsMn2UfuHKZ8bramfmmF6g.png" /><figcaption><strong>⚡ Spring Boot That Starts in Milliseconds</strong></figcaption></figure><h3>🚀 How Native Images, CRaC &amp; Project Leyden Changed Everything</h3><p>There was a time when this was normal 😅</p><blockquote><em>“Spring Boot takes 40 seconds to start.”</em></blockquote><p>We accepted it.<br> We worked around it.<br> We added more memory and moved on.</p><p>That era is over.</p><p>In 2026, <strong>startup time is a business metric</strong> — and Spring Boot has quietly evolved to start in <strong>milliseconds</strong>, not seconds.</p><p>Let’s talk about <strong>how</strong> 👇</p><blockquote><strong><em>🚀 Launch your website in minutes with </em></strong><a href="https://www.cloudways.com/en/?id=2079457"><strong><em>Cloudways</em></strong></a></blockquote><blockquote><em>✅ Fast hosting<br> ✅ Free SSL<br> ✅ 24/7 support</em></blockquote><blockquote><em>Join 124,000+ websites already hosting here</em></blockquote><blockquote><a href="https://www.cloudways.com/en/?id=2079457"><strong><em>👉 Start Your Free Trial Now</em></strong></a></blockquote><h3>🧠 Why Startup Time Suddenly Matters</h3><p>Cold starts now hurt real money 💸</p><ul><li>Serverless platforms ☁️</li><li>Auto-scaling Kubernetes pods 📦</li><li>Blue-green deployments 🔄</li><li>Cost-optimized cloud setups 📉</li></ul><p>Every second of startup time means:</p><ul><li>Slower scaling</li><li>Higher infra cost</li><li>Worse user experience</li></ul><p>So Spring Boot adapted.</p><h3>🔄 The Three Technologies Powering Instant Startup</h3><p>Modern Spring Boot uses <strong>three different paths</strong> to instant startup:</p><p>1️⃣ GraalVM Native Images<br> 2️⃣ CRaC (Coordinated Restore at Checkpoint)<br> 3️⃣ Project Leyden (JVM-level future)</p><p>Each solves a <em>different</em> problem.</p><h3>🧊 1️⃣ Native Images (GraalVM)</h3><p>Native images compile your Spring Boot app into a <strong>platform-specific binary</strong>.</p><h3>What changes?</h3><ul><li>No JVM warm-up ❌</li><li>No classpath scanning ❌</li><li>No reflection at runtime ❌</li></ul><p>Result:<br> ⚡ Startup in <strong>10–100 ms</strong></p><h3>🛠️ Build a Native Image</h3><pre>./mvnw -Pnative native:compile</pre><h3>🧪 Spring Boot Native Config</h3><pre>&lt;plugin&gt;<br>  &lt;groupId&gt;org.graalvm.buildtools&lt;/groupId&gt;<br>  &lt;artifactId&gt;native-maven-plugin&lt;/artifactId&gt;<br>&lt;/plugin&gt;</pre><h3>⚠️ Trade-offs</h3><p>✅ Blazing-fast startup<br> ❌ Slower build time<br> ❌ More memory during build<br> ❌ Some dynamic features limited</p><p>Native images are perfect for:</p><ul><li>Serverless</li><li>APIs with spiky traffic</li><li>Edge deployments</li></ul><h3>💤 2️⃣ CRaC (Checkpoint Restore at Runtime)</h3><p>CRaC takes a different approach 🧠</p><p>Instead of recompiling everything…</p><p>👉 It <strong>starts the JVM once</strong>, takes a snapshot, and restores it instantly.</p><h3>🧊 How CRaC Works</h3><pre>Start App → Warm Up → Take Snapshot ❄️ → Restore in ms ⚡</pre><h3>🛠️ CRaC Hook Example</h3><pre>@Component<br>public class CacheWarmup implements Resource {<br>---<br><br>  @Override<br>    public void beforeCheckpoint(Context&lt;?&gt; context) {<br>        // close DB connections<br>    }<br>    @Override<br>    public void afterRestore(Context&lt;?&gt; context) {<br>        // reinitialize connections<br>    }<br>}<br><br></pre><h3>⚡ Result</h3><ul><li>Startup in <strong>~100 ms</strong></li><li>Full JVM features</li><li>No native compilation</li></ul><p>CRaC is perfect when:</p><ul><li>You need fast startup</li><li>You rely heavily on JVM features</li><li>Native images are too restrictive</li></ul><h3>🧬 3️⃣ Project Leyden (The Future of JVM)</h3><p>Project Leyden is where things get <em>really</em> interesting 😮</p><p>Instead of:</p><ul><li>Rebuilding as native</li><li>Or snapshotting runtime</li></ul><p>Leyden focuses on:<br> 👉 <strong>Precomputing JVM work at build time</strong></p><h3>🧠 What Leyden Optimizes</h3><ul><li>Class loading</li><li>Bytecode verification</li><li>Dependency resolution</li><li>Startup initialization</li></ul><p>Think of it as:</p><blockquote><em>“Spring Boot… but pre-warmed by the JVM itself.”</em></blockquote><p>No app changes required 🎉</p><h3>🧩 Spring Boot’s Secret Weapon: AOT Processing</h3><p>Spring Boot now uses <strong>Ahead-of-Time (AOT) processing</strong>:</p><pre>@SpringApplication<br>public class Application {<br>    public static void main(String[] args) {<br>        SpringApplication.run(Application.class, args);<br>    }<br>}</pre><p>Looks the same 👆<br> Runs <strong>very differently</strong> under the hood.</p><p>AOT removes:</p><ul><li>Reflection</li><li>Runtime scanning</li><li>Lazy surprises</li></ul><h3>📊 Real Startup Time Comparison</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*jJP1XSCtYhgjQ3RKIknyIQ.png" /></figure><h3>🧠 Which One Should You Choose?</h3><p>👉 <strong>Native Image</strong></p><ul><li>Serverless</li><li>Extreme cold-start needs</li></ul><p>👉 <strong>CRaC</strong></p><ul><li>Kubernetes</li><li>JVM-heavy workloads</li></ul><p>👉 <strong>Leyden</strong></p><ul><li>Long-term JVM future</li><li>Minimal code changes</li></ul><h3>🔄 The Quiet Revolution</h3><p>Spring Boot didn’t become “faster”.</p><p>It became <strong>startup-aware</strong>.</p><p>Today, performance isn’t just:</p><ul><li>Throughput</li><li>Memory</li></ul><p>It’s also:</p><ul><li>How fast your app is alive ⚡</li></ul><h3>🎯 Final Thought</h3><p>Cold starts are no longer acceptable.</p><p>Spring Boot apps in 2026:</p><ul><li>Start instantly</li><li>Scale faster</li><li>Cost less</li><li>Feel invisible to users</li></ul><p>And the best part?</p><p>👉 You don’t need to rewrite your app.<br> You just need to <strong>choose the right startup strategy</strong>.</p><h3>Thank you for being a part of the community</h3><p><em>Before you go:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d9QTaaaxboQP_gKSLedW_w.png" /></figure><p>👉 Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></p><p>👉 Follow us: <a href="https://www.linkedin.com/in/code-to-deploy-3784391b9/"><strong>Linkedin</strong></a>| <a href="https://medium.com/codetodeploy"><strong>Medium</strong></a></p><p>👉 CodeToDeploy Tech Community is live on Discord — <a href="https://discord.gg/ZpwhHq6D"><strong>Join now!</strong></a></p><p><strong>Note:</strong> This Post may contain affiliate links.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c74e908b497" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codetodeploy/spring-boot-that-starts-in-milliseconds-2c74e908b497">⚡ Spring Boot That Starts in Milliseconds</a> was originally published in <a href="https://medium.com/codetodeploy">CodeToDeploy</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Spring Boot Without REST Internally]]></title>
            <link>https://medium.com/codetodeploy/spring-boot-without-rest-internally-bd21f64c1f09?source=rss-edfcd88b9fea------2</link>
            <guid isPermaLink="false">https://medium.com/p/bd21f64c1f09</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[internally-displaced]]></category>
            <category><![CDATA[without-rest]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[code]]></category>
            <dc:creator><![CDATA[akash]]></dc:creator>
            <pubDate>Tue, 10 Feb 2026 14:24:46 GMT</pubDate>
            <atom:updated>2026-02-10T14:25:41.855Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eDjoqJYA4NyHWTE8G1LFrQ.png" /><figcaption><strong>🚫 Spring Boot Without REST Internally</strong></figcaption></figure><h3>🔄 Why Events, gRPC &amp; Messaging Replaced REST Behind the Scenes</h3><p>REST is not dead ❌<br> REST is just… <strong>being moved to the edges</strong>.</p><p>Quietly, modern Spring Boot teams are <strong>stopping REST calls inside their own systems</strong> — and replacing them with <strong>events, messaging, and gRPC</strong>.</p><p>Not because REST is bad.<br> But because <strong>internally, it hurts more than it helps</strong>.</p><p>Let’s talk about <em>why</em> and <em>what replaced it</em> 👇</p><blockquote><strong><em>🚀 Launch your website in minutes with </em></strong><a href="https://www.cloudways.com/en/?id=2079457"><strong><em>Cloudways</em></strong></a></blockquote><blockquote><em>✅ Fast hosting<br> ✅ Free SSL<br> ✅ 24/7 support</em></blockquote><blockquote><em>Join 124,000+ websites already hosting here</em></blockquote><blockquote><a href="https://www.cloudways.com/en/?id=2079457"><strong><em>👉 Start Your Free Trial Now</em></strong></a></blockquote><h3>🧠 REST Was Never Meant for Internal Communication</h3><p>REST was designed for:</p><ul><li>Client ↔ Server communication 🌐</li><li>Loose coupling across teams 👥</li><li>Public APIs &amp; integrations 🔌</li></ul><p>But internally?</p><p>Using REST inside Spring Boot apps means:</p><ul><li>JSON serialization 😵</li><li>HTTP overhead 🌐</li><li>Retry &amp; timeout chaos ⏳</li><li>No compile-time safety 🚫</li></ul><p>All to call… <strong>your own code</strong>.</p><h3>💥 The Hidden Cost of Internal REST</h3><p>Imagine this 👇</p><pre>restTemplate.getForObject(<br>    &quot;http://user-service/users/42&quot;,<br>    UserDto.class<br>);</pre><p>What actually happens:</p><ul><li>Java → JSON → HTTP → JSON → Java</li><li>Network hops</li><li>Silent runtime failures</li></ul><p>For one method call 😐</p><h3>🔄 What Replaced REST Internally?</h3><p>Modern Spring Boot systems now use <strong>three patterns</strong> instead:</p><p>1️⃣ Domain Events<br> 2️⃣ Messaging (Kafka / RabbitMQ)<br> 3️⃣ gRPC</p><p>Let’s look at each 👇</p><h3>📣 1️⃣ Domain Events (Inside the Same App)</h3><p>Perfect for <strong>modular monoliths</strong> 🧩</p><p>Instead of calling another module directly, you <strong>publish an event</strong>.</p><h3>🧾 Domain Event</h3><pre>public record UserRegisteredEvent(Long userId) {}</pre><h3>🚀 Publish Event</h3><pre>@Service<br>public class UserService {<br>private final ApplicationEventPublisher publisher;<br>    public UserService(ApplicationEventPublisher publisher) {<br>        this.publisher = publisher;<br>    }<br>    public void register(User user) {<br>        // save user<br>        publisher.publishEvent(<br>            new UserRegisteredEvent(user.getId())<br>        );<br>    }<br>}</pre><h3>👂 Listen From Another Module</h3><pre>@Component<br>public class EmailListener {<br>@EventListener<br>    public void handle(UserRegisteredEvent event) {<br>        // 📧 send welcome email<br>    }<br>}</pre><p>✨ No REST<br> ✨ No HTTP<br> ✨ Loose coupling</p><h3>📩 2️⃣ Messaging Over REST (Microservices)</h3><p>For real microservices, <strong>synchronous REST calls</strong> are being replaced by <strong>asynchronous messaging</strong>.</p><h3>❌ Old Way</h3><pre>Order Service → REST → Inventory Service</pre><h3>✅ New Way</h3><pre>Order Service → Kafka → Inventory Service</pre><h3>🚀 Kafka Producer</h3><pre>kafkaTemplate.send(&quot;order-created&quot;, orderId);</pre><h3>👂 Kafka Consumer</h3><pre>@KafkaListener(topics = &quot;order-created&quot;)<br>public void handle(Long orderId) {<br>    // 📦 update inventory<br>}</pre><p>Why teams love this ❤️:</p><ul><li>No cascading failures</li><li>Better resilience</li><li>Scales naturally</li><li>Works beautifully with retries</li></ul><h3>⚡ 3️⃣ gRPC (Fast, Typed, Quietly Winning)</h3><p>When synchronous communication <em>is required</em>, teams are choosing <strong>gRPC over REST</strong>.</p><p>Why?</p><ul><li>Binary protocol ⚡</li><li>Strong typing 🧠</li><li>Contract-first design 📜</li></ul><h3>📞 gRPC Client Call</h3><pre>UserResponse response =<br>    userClient.getUser(<br>        UserRequest.newBuilder()<br>                   .setId(42)<br>                   .build()<br>    );</pre><p>Feels like:</p><pre>userService.getUser(42);</pre><p>But it’s still distributed 🌍</p><h3>🧩 REST Still Exists — Just at the Edges</h3><p>Modern Spring Boot architecture looks like this:</p><pre>🌐 Frontend / External APIs<br>        ↓ REST<br>🧩 Application Core<br>        ↓ Events / Messaging / gRPC</pre><p>REST didn’t disappear.<br> It just found its <strong>right place</strong>.</p><h3>🤫 Why No One Talks About This</h3><p>Because:</p><ul><li>REST still works</li><li>“Removing REST” sounds scary 😬</li><li>The shift happens gradually</li><li>Teams don’t announce refactors</li></ul><p>But if you look closely…<br> it’s already happening.</p><h3>🧠 The New Rule of Thumb</h3><p>👉 <strong>Use REST for boundaries</strong><br> 👉 <strong>Avoid REST for internals</strong></p><p>If your services:</p><ul><li>Share a domain</li><li>Are owned by the same team</li><li>Deploy together or often</li></ul><p>Internal REST is probably slowing you down 🐢</p><h3>🎯 Final Thought</h3><p>REST is great for <strong>communication</strong>.<br> But <strong>internally</strong>, systems need:</p><ul><li>Speed ⚡</li><li>Safety 🧠</li><li>Resilience 🛡️</li></ul><p>That’s why modern Spring Boot apps are built:</p><ul><li>REST outside 🌐</li><li>Events &amp; messaging inside 🔄</li></ul><p>And once you experience it…<br> you won’t go back 😌🚀</p><h3>Thank you for being a part of the community</h3><p><em>Before you go:</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d9QTaaaxboQP_gKSLedW_w.png" /></figure><p>👉 Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></p><p>👉 Follow us: <a href="https://www.linkedin.com/in/code-to-deploy-3784391b9/"><strong>Linkedin</strong></a>| <a href="https://medium.com/codetodeploy"><strong>Medium</strong></a></p><p>👉 CodeToDeploy Tech Community is live on Discord — <a href="https://discord.gg/ZpwhHq6D"><strong>Join now!</strong></a></p><p><strong>Note:</strong> This Post may contain affiliate links.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bd21f64c1f09" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codetodeploy/spring-boot-without-rest-internally-bd21f64c1f09">🚫 Spring Boot Without REST Internally</a> was originally published in <a href="https://medium.com/codetodeploy">CodeToDeploy</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>