During load tests or sudden traffic surges, the following symptoms are observed:
gorouter_time remains consistently low, while response_time is temporarily high.The root cause is autoscaling combined with backend cold-start behavior.
This is an example to simulate Spring bean lazy initialization, SlowInitService bean is being used in a Rest API controller for /api/process,
package com.example.lazydemo;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
// @Lazy defers construction (and the 5s delay below) until first use instead of app startup.
@Lazy
@Service
public class SlowInitService {
public SlowInitService() {
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
}
public String process() {
return "Slow service was lazily initialized and is now ready";
}
}
In application log, the first request response time spikes to 5 seconds and the 2nd one drops under 1 second.
2026-06-01T15:23:22.90+0200 [RTR/0] OUT spring-lazy-sample.<DOMAIN> - [2026-06-01T13:23:17.852431108Z] "GET /api/process HTTP/1.1" 200 0 72 "-" "curl/8.7.1" "###.###.###.###:34600" "###.###.###.###:61040" x_forwarded_for:"###.###.###.###, ###.###.###.###" x_forwarded_proto:"https" vcap_request_id:"6d493d8e-08dd-4c45-5b4f-c70547beb604" response_time:5.052037 gorouter_time:0.001051 app_id:"85f69166-d8c2-45fd-bd17-1c4228ff9b1b" app_index:"0" ...
2026-06-01T15:23:23.54+0200 [RTR/0] OUT spring-lazy-sample.<DOMAIN> - [2026-06-01T13:23:23.532148945Z] "GET /api/process HTTP/1.1" 200 0 69 "-" "curl/8.7.1" "###.###.###.###:34926" "###.###.###.###:61040" x_forwarded_for:"###.###.###.###, ###.###.###.###" x_forwarded_proto:"https" vcap_request_id:"a8e83229-2229-4f50-5089-e08c3f23b02f" response_time:0.010789 gorouter_time:0.000472 app_id:"85f69166-d8c2-45fd-bd17-1c4228ff9b1b" app_index:"0" ...
To mitigate cold-start latency in highly dynamic environments: