api-guidelines icon indicating copy to clipboard operation
api-guidelines copied to clipboard

Document when to use an LRO vs. a VLRO in REST APIs

Open annelo-msft opened this issue 3 years ago • 2 comments

In the DeviceUpdate API, some operations use the x-ms-long-running-operation tag, where others are represented as a resource. This is according to the guidance found in the current API guidelines:

✅ DO implement an operation as an LRO if the 99th percentile response time is greater than 1s. In rare instances where an operation may take a very long time to complete, e.g. longer than 15 minutes, it may be better to expose this as a first class resource of the API rather than as an operation on another resource. https://github.com/microsoft/api-guidelines/blob/vNext/azure/Guidelines.md#long-running-operations--jobs

It would be great to clarify guidance regarding when specifically to use operations on another resource vs. a standard LRO, and what this pattern looks like.

@JeffreyRichter, @mikekistler, @johanste, @krzysztofcwalina, @tg-msft, FYI

annelo-msft avatar Jun 20 '22 20:06 annelo-msft

I'll kick start this: Use a real resource instead of an LRO if

  • A client needs to LIST the operations (or subset thereof).
  • The operation result can live a long time (typically more than 24 hours).
  • The operation could take longer than a client would want to poll.
    • I admit this is wishy-washy but maybe > 5 minutes? I'm open to other ideas here or killing this bullet entirely.

JeffreyRichter avatar Jun 20 '22 21:06 JeffreyRichter

Hello, any update on this topic?

Say we are using A to create B (like using training job to create/train a model), I have some specific questions like:

  • is deleting the A allowed, where the B it created is still there
  • what to do with A, if B is deleted?

Thanks!

pj-ms avatar Apr 03 '24 00:04 pj-ms