department-of-veterans-affairs / va.gov-team

Public resources for building on and in support of VA.gov. Visit complete Knowledge Hub:
https://depo-platform-documentation.scrollhelp.site/index.html
284 stars 206 forks source link

Develop a general asynchronous processing model for vets-api requests #480

Open ricetj opened 5 years ago

ricetj commented 5 years ago

Problem Statement: Many vets-api requests that flow through to various backend systems take a long time to complete. This may be due to processing or data transfer or other unknown performance limitations in legacy systems. POST and PUT requests that submit or update information are frequent offenders, but there are some long-running GET requests as well.

Performing these operations synchronously in the context of the API request has several downsides:

Proposal: Develop a common mechanism for processing long-running requests asynchronously that can be used across vets-api.

Existing Patterns: Several form-submission type applications use asynchronous processing or submission.

Concerns:

Questions:

ricetj commented 5 years ago

(03/22/2018) This seems interesting: https://github.com/utgarda/sidekiq-status#retrieving-status

ricetj commented 5 years ago

(03/26/2018) notes from call:

How did this come about?

This ticket includes current design constraints Best practice examples of asynchronous API for frontend exist out there

PCIU telephone suggested as starting use case - steve-gov

Blockers on post/put ^decision on what to do approach wise - this call resolved ^if access is not granted with the GET, that would be a blocker

Goals:

  1. Show our API has better latency, can push on partners to improve backend latency
  2. Don’t want synchronous processing of API
    • currently the case, leads to thread exhaustion
  3. Create consistent API implementation
ricetj commented 5 years ago

(03/28/2018) I have some questions around reliability and monitoring. I don't think we need to nail all of these down before moving forward with a design, but we'll want to be keeping them in mind as we get closer to a production deployment.

Sorry if the answers to some of these are obvious, but sidekiq is not a technology with which I'm familiar.

Some guarantees I'd like to see:

ricetj commented 5 years ago

(03/28/2018) This is shaping up to be a bit more of an endeavor than we (or I?) had originally anticipated.

I wonder if perhaps we should decouple the creation of the new endpoints from the discovery & assembly of this new asynchronous request track. I feel these things can be done in parallel.

I raise this idea because these last few endpoints are the final pieces of the puzzle for the Profile form, and am concerned that this will add too much of a delay to the form's release.

In light of that, I am proposing that:

  1. These new POST endpoints for the profile form follow a standard synchronous request pattern
  2. Convert this story into a discovery story (or create an associated one), that answers all the questions raised thus far, as well as the ones we have not thought of yet
  3. Based on the deliverable from that discovery story, create any sub-issues to enact a standalone asynchronous request handler

What are everyone's thoughts?

ricetj commented 5 years ago

(03/28/2018) think this is very smart and agree wholeheartedly at this stage

This was my biggest concern with taking on asynch approach coupled to the POST/PUT endpoint delivery so late in our process, with so little to finish on profiles backend for launch.

I think it’s very smart to separate the smaller, more immediate launch task from the asynch discovery

ricetj commented 5 years ago

other notes can be found here, not moved in case not suitable for public repo: https://github.com/department-of-veterans-affairs/vets.gov-team/issues/9400