Ask Your Question
3

What are some methods to prevent circular dependency when performing healthchecks on multiple APIs?

asked 2022-08-13 11:00:00 +0000

huitzilopochtli gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2022-08-13 00:00:00 +0000

djk gravatar image
  1. Break the dependencies: If possible, break the circular dependencies in the APIs. For example, API A depends on API B and API B depends on API A. Refactor the APIs to reduce the dependencies, so that API A depends on API B and API B does not depend on API A.

  2. Use timeouts: Set timeouts for API calls. If an API call takes longer than the timeout, it can be assumed that the API is down, and the healthcheck can flag it as an error.

  3. Use caching: Implement a caching mechanism to reduce the number of requests made to the APIs. Use a cache that stores responses from previous API calls.

  4. Use async checks: Use an asynchronous healthcheck system that can perform multiple checks at once. This will prevent dependencies from blocking healthchecks.

  5. Separated checks: Use separated checks for every API. This will make the check faster and much more clear.

  6. Monitor the system: Monitor the system closely and be ready to take action if needed. Observability provides vital feedback to identify when such dependencies occur and what causes them.

  7. Use a circuit breaker: Implement a circuit breaker which can prevent an API from being called after a failure. This will reduce the number of requests being sent to an API that is down.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2022-08-13 11:00:00 +0000

Seen: 9 times

Last updated: Aug 13 '22