Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

retries: Create minimal demo of the Retry feature #3341

Closed
shalier opened this issue May 13, 2021 · 1 comment
Closed

retries: Create minimal demo of the Retry feature #3341

shalier opened this issue May 13, 2021 · 1 comment
Assignees
Labels
area/retries Retry feature size/M 7 days (~1.5 week)
Milestone

Comments

@shalier
Copy link
Contributor

shalier commented May 13, 2021

With #3338 we proposed the creation of a POC of RetryPolicy.

This GitHub issue is for the creation of a demo, which can showcase this feature.

Create a demo to show the retry feature
See doc for additional info.

In our current demo we utilize a Bookstore app. This is an HTTP server, which responds to HTTP GET requests from another app called Bookbuyer.
To demo this feature we could:

  1. Deliberately introduce errors in the Bookstore server. For example we could return a 500 ISE on every other request here:
    // sellBook increments the value of the booksSold
    func sellBook(w http.ResponseWriter, r *http.Request) {
    fmt.Println("Selling a book!")
    atomic.AddInt64(&booksSold, 1)
    setHeaders(w)
    renderTemplate(w)
    log.Info().Msgf("%s; URL: %q; Count: %d\n", getIdentity(), html.EscapeString(r.URL.Path), booksSold)
    // Loop through headers
    for name, headers := range r.Header {
    name = strings.ToLower(name)
    for _, h := range headers {
    log.Info().Msgf("%v: %v", name, h)
    }
    }
    go common.RestockBooks(1) // make this async for a smoother demo
    // Slow down the responses artificially.
    maxNoiseMilliseconds := 750
    minNoiseMilliseconds := 150
    intNoise := rand.Intn(maxNoiseMilliseconds-minNoiseMilliseconds) + minNoiseMilliseconds // #nosec G404
    pretendToBeBusy := time.Duration(intNoise) * time.Millisecond
    log.Info().Msgf("Sleeping %+v", pretendToBeBusy)
    time.Sleep(pretendToBeBusy)
    }
  2. Then we can annotate the demo TrafficTarget to enable retry:
    kind: TrafficTarget
    apiVersion: access.smi-spec.io/v1alpha3
    metadata:
    name: bookbuyer-access-bookstore-v1
    namespace: "$BOOKSTORE_NAMESPACE"
    spec:
  3. Given that every other request is erroring out - we should not see errors in Bookbuyer app's logs
@draychev draychev changed the title Create minimal demo of the Retry feature retries: Create minimal demo of the Retry feature May 13, 2021
@draychev draychev added the size/M 7 days (~1.5 week) label May 18, 2021
@draychev draychev added this to the v0.10.0 milestone May 21, 2021
@draychev draychev modified the milestones: v0.10.0, vNext Aug 23, 2021
@shashankram
Copy link
Member

Demo for Retry feature should go into https://main--osm-docs.netlify.app/docs/demos/

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/retries Retry feature size/M 7 days (~1.5 week)
Projects
None yet
Development

No branches or pull requests

3 participants