Project

General

Profile

Actions

Idea #9446

closed

[SDK] Refactor keep parallel write strategy

Added by Peter Amstutz almost 8 years ago. Updated almost 8 years ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Category:
-
Target version:
Start date:
06/27/2016
Due date:
Story points:
1.0

Description

Currently arvados.keep.KeepClient.put creates one KeepWriterThread per keep server and then uses a complex (and error prone) locking strategy implemented in ThreadLimiter to ensure that only certain threads perform uploads in a certain order.

Refactor this code to use the following alternate strategy:

  • For N wanted copies create N upload threads
  • Start a new upload to the next server in sorted_roots when an upload fails
  • The server response may include a header x-keep-replicas-stored, if so the client's replica count should be incremented by the number in the header
  • If the service lists consists only of "disk" type services, start up N parallel write threads for each copy; if the service list has non-"disk" services (such as "proxy") perform one upload at a time and look for the x-keep-replicas-stored header.
  • Don't write to servers that are read only (this should already be handled by map_new_services(need_writable=True))

You may want to use a Queue (instead of explicit locks) to communicate between the main thread and the upload threads.

Consider setting up a thread pool attached to the keep client object and dispatching work instead of spawning new threads.

Two things to keep in mind:

  • The order that it tries to upload to each server matters (because the earlier servers are preferred over the later ones)
  • If it goes through the entire list without uploading sufficient replicas, it should try again. However, when it does so, it should:
    1. remember how many replicas have already been uploaded (so if it wanted 3 and got 2 on the first pass, it only needs 1 more)
    2. not try to upload to services to which it did a successful upload or did not get a retryable failure code in the previous round. Retryable failure codes (from the Go SDK) are 408 (Request Timeout), 429 (Too Many Requests), and any 5xx error except 503 (which means "Server Full").

Subtasks 1 (0 open1 closed)

Task #9469: Review 9446-refactor-keep-parallel-write-strategyResolvedPeter Amstutz06/27/2016Actions

Related issues

Related to Arvados - Idea #9180: [PySDK] Avoid overreplication in KeepClientResolvedLucas Di Pentima06/08/2016Actions
Actions

Also available in: Atom PDF