Adding a configuration for max retries to handle system wide outages

Đang mở
#789 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
45/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
java
Lĩnh vực
api

Hướng nghiên cứu

Bắt đầu với algoliasearch-core/src/main/java/com/algolia/search/HttpTransport.java, đặc biệt là executeWithRetry, sau đó đọc RetryStrategy.java và ConfigBase để theo dõi cách xử lý timeout và số lần thử lại. Xác nhận hành vi trong các request đã hết thời gian chờ và xác định công việc hoàn tất khi có giới hạn số lần thử lại có thể cấu hình theo từng host, ngăn số lần thử lại tăng vô hạn, đồng thời giữ nguyên hành vi thử lại hiện có khi chưa được thiết lập.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

  • 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.

Ngôn ngữ chính
Java
Star
51
Fork
33
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của algolia/algoliasearch-client-java

Tất cả issue của algolia/algoliasearch-client-java

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.