microgateway icon indicating copy to clipboard operation
microgateway copied to clipboard

"Lazy Load" for context variables.

Open ozairs opened this issue 7 years ago • 0 comments

Presently, the µgw uses 2 middlewares to pre-populate APIC context variables:

  • The context middleware: for "general" context vars (system, request, and message metadata)
  • The preflow middleware: handles apiconnect-specific context metadata

A large percentage of these values are not used by policy so copying them from the middleware req object to a µgw context is largely a waste of memory and CPU time. I propose a "lazy load" strategy, meaning that the values of context variables are values are pulled from the middleware req at the time the value is requested.

This may help with portability to the DP/Edge gateway because there is no need to do a wholesale convert from Edge gateway metadata to Micro gateway metadata and vice-versa. The logic to do this would also benefit the cases where a policy needs to set metadata.

ozairs avatar Mar 17 '17 20:03 ozairs