Skip to content

CloudRequestEngine graceful non-blocking degradation  #132

@justadreamer

Description

@justadreamer

Motivation

Robustness, non-disruption to the integrating service operation.

Background

When cloud.51degrees.com is unavailable (f.e. behind firewall, or there are other errors like resource key expired) CloudRequestEngine may cause a resource exhaustion on the IIS server and make it return 503 Service Unavailable - for all threads will be stuck awaiting on it while some requests fail or time out.

The causes of threads getting stuck are multiple:

  • there are 2 double-checked locks in CloudRequestEngine - that may cause one thread await for response and others block on these locks
  • the device detection API request has a timeout (of 2 seconds by default?) - please check, but if all threads are stuck on this timeout and there are more incoming requests than threads - we will end up all threads waiting and some requests may never be served - IIS would respond with 503 potentially, but needs to be checked

Objectives

  • 1. build a reproduction scenario using the Cloud / Framework-Web example - try to deploy to the IIS specify some limited number of worker threads, limited length of the Queue in Application Pool and make it a subject to load testing
  • 2. get rid of the double-checked locks and make accessibleproperties and evidencefilter initialization asynchronous, triggered on object construction (a draft patch from James for this) - if properties have not been fetched - we can not initialize Pipeline - check if there is any recovery mechanism for this (reattempts to initialize properties), also please check if access to Task<> properties is synchronized
  • 3. add a backoff logic for any API request: that if one request has failed - we memorize the timestamp and do not attempt to make any new requests for the RecoveryPeriod from that timestamp (can be configurable, default can be 2 seconds)

cc: @BohdanVV

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions