Skip to content

Instantly share code, notes, and snippets.

@kleinron
Created March 23, 2015 07:59
Show Gist options
  • Save kleinron/5c16a9df260cc91595ab to your computer and use it in GitHub Desktop.
Save kleinron/5c16a9df260cc91595ab to your computer and use it in GitHub Desktop.
Background Request Sequence with shared k/v storage
title Background Request Sequence with shared k/v storage
client->LB: get x
LB->BG Service: get x
note right of BG Service: generate job-id
BG Service->k/v storage: k:job-id, v:empty
BG Service->Queue: enqueue x+job-id
BG Service->LB: job-id
LB->client: job-id
note right of BG Service: process when load < limit
Queue->BG Service: dequeue x+job-id
BG Service->BG Service: process x
BG Service->k/v storage: k:job-id, v: data
note right of client: time based polling
opt no results scenario
client->LB: get job-id
LB->BG Service: get job-id
BG Service->k/v storage: try get k:job-id
k/v storage->BG Service: empty
BG Service->LB: nothing yet
LB->client: nothing yet
end
opt results exist scenario
client->LB: get job-id
LB->BG Service: get job-id
BG Service->k/v storage: try get k:job-id
k/v storage->BG Service: data
BG Service->LB: found + data
LB->client: found + data
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment