Adding a configuration for max retries to handle system wide outages

Aberta
#789 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
45/100
Tipo de issue
Funcionalidade
Clareza
Claramente especificada
Status de atividade
Estagnada
Stack de tecnologia
java
Domínio
api

Direção de pesquisa

Comece por algoliasearch-core/src/main/java/com/algolia/search/HttpTransport.java, especialmente executeWithRetry, e depois leia RetryStrategy.java e ConfigBase para rastrear o tratamento do timeout e da contagem de tentativas. Confirme o comportamento durante requisições que atingiram o timeout e defina o trabalho como concluído quando houver um limite de tentativas configurável por host que impeça que as tentativas se expandam indefinidamente, preservando o comportamento existente de tentativas quando não estiver definido.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

  • Algolia Client Version: 3.16.6
  • Language Version: Java
Description

Correct me if I am mistaken but HttpTransport.executeWithRetry will before sending a request, increase the timeout for the request based on the number of retries. After the response is received, it uses RetryStrategy to determine what to do with the results.

The function RetryStrategy.decide will in the case of a request time out, will always retry.

During an Indexer service outage in July 13th, it appears that was happening for the entire length of the outage causing the Promises to hang and never fail. This becomes a pretty big issue when using BatchIndexingResponse.waitTask() like in the API examples.

Proposed change
  1. Adding a new configurable property to ConfigBase called something along the lines of maxRetriesPerHost and update RetryStrategy to save that value in its constructor.
  2. Update RetryStrategy.decide to something along the lines of
} else if (response.isTimedOut()) {
    boolean shouldKeepUp = maxRetriesPerHost == null  || tryableHost.getRetryCount() <= maxRetriesPerHost;
    tryableHost.setUp(shouldKeepUp);
    tryableHost.setLastUse(AlgoliaUtils.nowUTC());
    tryableHost.incrementRetryCount();
    return RetryOutcome.RETRY;
}
Why make the change

During the time of the indexing outage, it was not clear immediately why our requests were stuck. Looking at the code it seems like if the servers actually responded with server errors, the StatefulHosts would have been turned off one by one which would be closer to what I would expect from an outage. The current logic has no way of determining this type of issue, causing ever expanding timeouts without any way of intervening.

Linguagem predominante
Java
Estrelas
51
Forks
33
Métricas de merge de PRs
Nenhum PR com merge em 30d

Preparar o ambiente

Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de algolia/algoliasearch-client-java

Todas as issues de algolia/algoliasearch-client-java

Issues semelhantes

Mais issues de Java

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.