Scrivio Interview library
ScenarioAdvanced6 min read · updated 12 November 2026

There are 200 OpenFeign clients across your services with different timeout, retry and error-decoding settings. Define a standard for HTTP clients and decide whether to migrate to Spring HTTP interface clients.

I would define a standard covering connect and read timeouts, retry rules, error mapping, observation and authentication, and deliver it through an internal starter that configures both Feign clients and HTTP interface clients during the transition. Because Spring Cloud OpenFeign is feature complete, new clients use @HttpExchange interfaces backed by RestClient, while existing Feign clients migrate only when their services change anyway, protected by contract tests. A small inventory tool tracks the settings of every client so we can find those without timeouts first.

Why this question is asked

Two hundred HTTP clients with two hundred different settings is a reliability problem hiding in plain sight. One client has no timeout and hangs threads when a dependency is slow, another retries POST requests three times, a third swallows errors as null. Each was a reasonable local choice, but together they make the platform's behaviour under failure impossible to predict. Interviewers ask this to see whether we can standardise at scale without a risky big-bang rewrite. In this answer, we will find out what the clients do today, write the standard, deliver it through a starter, decide the migration path, and track progress.

1Start With an Inventory

We cannot fix what we cannot see, so the first step is a list of every client and its effective settings: target service, connect and read timeouts, retryer, error decoder, interceptors, and whether a circuit breaker wraps it. Much of this can be extracted automatically, by scanning the code for @FeignClient interfaces and the configuration files for spring.cloud.openfeign.client.config entries, and by reading runtime values from each service's /actuator/configprops on a test environment.

The inventory usually shows a few alarming groups at once: clients with no timeout configured, which fall back to Feign's defaults of 10 seconds to connect and 60 seconds to read; clients that retry non-idempotent methods; and clients that map every error to null. Those are the first to fix, before any migration discussion.

What a client inventory reveals (example)
FindingClientsRisk
No timeouts set (60 s read default)38threads held during a slow dependency
Retries POST or PUT11duplicate orders or payments
Errors mapped to null17silent wrong results
No tracing or metrics52blind during incidents
Matches the new standard21none
Illustrative numbers. The no-timeout group is fixed first.

2Writing the Standard

The standard should be short enough that people follow it. Timeouts: every client sets a connect timeout, such as 500 ms to 1 s, and a read timeout derived from the dependency's measured p99 latency plus a margin, with a strict platform default for clients that set nothing, for example 2 seconds. Retries: off by default; allowed only for idempotent methods, at most two attempts, with exponential backoff and jitter, and never at more than one layer of the call chain.

Error mapping: each client maps statuses to a small set of exception types, for example not found, conflict, bad request from us, and dependency unavailable, so callers handle failures consistently. Observation: every client produces metrics and traces through Micrometer with the client name as a tag. Authentication: service-to-service tokens are added by one shared interceptor, never copied by hand into each client.

3Delivering It Through a Starter

A standard written in a wiki is followed by some teams; a standard that is the default is followed by all. So we build an internal Spring Boot starter, a dependency that brings auto-configuration. It sets the default timeouts, registers the error mapping, the authentication interceptor and observation, and applies to both Feign clients and HTTP interface clients, because both will exist side by side for years.

Java
// From the platform starter: one place for the standard, both client styles
@AutoConfiguration
class PlatformHttpClientAutoConfiguration {
@Bean // HTTP interface clients: a pre-configured, load-balanced builder
@LoadBalanced
RestClient.Builder platformRestClientBuilder(PlatformHttpProperties props,
ServiceTokenInterceptor auth) {
var settings = ClientHttpRequestFactorySettings.defaults()
.withConnectTimeout(props.connectTimeout()) // default 1 s
.withReadTimeout(props.readTimeout()); // default 2 s
return RestClient.builder()
.requestFactory(ClientHttpRequestFactoryBuilder.detect().build(settings))
.requestInterceptor(auth)
.defaultStatusHandler(HttpStatusCode::isError, PlatformErrors::throwMapped);
}
@Bean // Feign clients: same error mapping and auth during the transition
ErrorDecoder platformErrorDecoder() { return PlatformErrors::feignDecode; }
@Bean
RequestInterceptor platformFeignAuth(ServiceTokenInterceptor auth) { return auth::applyTo; }
}
// Class names for request factory settings changed across Boot versions; check yours.

Teams can still override settings for a specific client, but they do so explicitly, in configuration that the inventory can read. The starter also sets the platform default for Feign through spring.cloud.openfeign.client.config.default, so the 38 clients without timeouts get a sane value the day their service upgrades the starter.

4New Clients and Migration of Old Ones

Spring Cloud OpenFeign is feature complete, so the standard says new clients are HTTP interfaces with @HttpExchange, backed by the starter's RestClient builder. For the existing Feign clients, a migration of 200 at once would be risky and would compete with product work. Instead, a client migrates when its service is being changed anyway, for example when the team adds an endpoint to the client, or when it needs a feature only RestClient has.

Each migration is protected by contract tests. A consumer-driven contract, for example with Spring Cloud Contract or Pact, records what the client sends and what it expects back, including error cases; the provider's build verifies it. If the new client sends the same requests and maps the same errors, the contract passes and callers see no difference. For simpler cases, stub tests with WireMock covering success, 404, 500 and timeout do the same job.

Step throughPath for one client
  1. Upgrade the service to the platform starterdefaults apply at once
  2. Client in the inventory meets the standard?
    YesLeave it until the service changesNoFix timeouts and retries now
  3. Service changing this client anyway?
    YesMigrate to an HTTP interface with contract testsNoKeep Feign, standard settings
  4. Inventory updatedsettings visible per client

4 steps in order. Play them, or step through them one at a time.

5Tracking Progress

The inventory becomes a living report, regenerated weekly from the code and from runtime configuration. It shows, per team and per service, how many clients have no timeout, how many retry unsafe methods, how many use the starter, and how many are still on Feign. The first goal is not migration but safety: zero clients without timeouts and zero unsafe retries within a quarter. Migration progress is tracked as a slower trend.

We share the report with engineering managers and review the safety numbers in reliability reviews. Incidents caused by a client setting are linked to the report, which keeps the motivation concrete.

6Follow-up questions

How do you choose a read timeout for each client?

From data: the dependency's p99 or p99.9 latency for that endpoint, plus a margin, and within the caller's own deadline. A client calling an endpoint with a p99 of 120 ms might get 500 ms, not the platform default of 2 seconds. The starter's default is only a safety net.

Why not migrate everything in one project?

Because 200 rewrites compete with product work, carry the risk of subtle behaviour changes and give no immediate safety benefit compared with fixing settings in place. Applying the standard through the starter delivers the safety quickly; migration then happens with normal change.

Where do retries belong if both the client and a service mesh can retry?

In one layer only. If the mesh retries three times and the client retries three times, a failing call becomes nine attempts. The standard should say which layer owns retries for service-to-service calls, and the other layer should not retry.

7Conclusion

In this answer, we standardised 200 HTTP clients by first building an inventory of their real settings, then writing a short standard for timeouts, retries, error mapping, observation and authentication, and delivering it through a starter that configures both Feign and HTTP interface clients. New clients use @HttpExchange interfaces, existing Feign clients migrate with contract tests when their services change, and a regular report tracks clients without timeouts until there are none.

What to say in the interviewAbout 90 seconds aloud

Open with

I would start with an inventory, extracted from code, configuration and actuator data, of every client's timeouts, retryer, error decoder and interceptors. That usually shows the urgent problems: clients without timeouts that fall back to Feign's 60 second read default, clients retrying POSTs, clients mapping errors to null.

Then, if they want more

Then I would write a short standard: connect and read timeouts on every client, with read timeouts based on the dependency's p99 and a strict platform default; retries off by default and only for idempotent calls with backoff, in one layer only; a small set of mapped exception types; Micrometer observation with the client name; and authentication through one shared interceptor.

To make it the default rather than a wiki page, I would ship it in an internal starter that configures both Feign clients and HTTP interface clients, since both will exist for a long time. Because OpenFeign is feature complete, new clients would be @HttpExchange interfaces on the starter's RestClient builder.

Existing clients would not be rewritten in a big bang; a client migrates when its service changes it anyway, protected by contract tests or WireMock stub tests for success, not found, server errors and timeouts.

Finally, the inventory becomes a weekly report per team, with a first goal of zero clients without timeouts and zero unsafe retries within a quarter, and migration tracked as a slower trend.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "There are 200 OpenFeign clients across your services with different timeout, retry and...": https://scrivio-interview-library.netlify.app/spring-boot/spring-cloud/8e3fbc719d/