Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposed New Feature: Add Caching Capabilities #2

Open
mkaplun opened this issue Jul 14, 2022 · 2 comments
Open

Proposed New Feature: Add Caching Capabilities #2

mkaplun opened this issue Jul 14, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@mkaplun
Copy link
Collaborator

mkaplun commented Jul 14, 2022

Add the capability to cache SDS responses.
Caching infrequently updated but often voluminous responses by SDS will considerably reduce bandwidth, latency, and load on servers and hide network failures.
A registry associated with an SDS instance may generate and store a "fresh" version of the response each time its content is updated.
Therefore, consistently with REST recommendations, GET requests should/can be cached by default - unless a client asks otherwise.
The handling of a POST request should be evaluated in conjunction with Issue faa-swim/sds20#4.

@wznira
Copy link
Collaborator

wznira commented Sep 26, 2022

To support caching, optional parameters should be included in the requests and responses to indicate the required/actual timeliness of the data.

For example, a client may indicate that it is willing to accept a cached list of published services as a response to its GetServices request only if the list is created less than 12 hours ago. There are several operations to accomplish this, for example -

  1. Using a cache control HTTP header to indicate that a cached response is acceptable or not, for example -
    • HTTP Header: Cache-Control: max-age = 43200
    • HTTP Header: Cache-Control: no-cache
  2. Include a query parameter in the request - /sds/services?max-age=43200

Similar, a DS may include a timestamp for the information it returns. For example,

  1. It could include a lastModified property in its JSON response to indicate the timeliness of the data
  2. It may use an Age HTTP header.

@mkaplun
Copy link
Collaborator Author

mkaplun commented Sep 27, 2022

I think there are several scenarios to consider in establishing caching in SDS.

Scenario 1. As suggested by @wznira in his comment. (However, Cache-control directives may require further research and potentially be extended.)

Scenario 2. To incorporate requirements or best practices into SDS documentation requiring SDS owners to update their caches when changes occur. For example, adding a new service to a registry should trigger updating the associated cache. SDS owners should also follow a similar approach when learning about new peers.
This way, infrequently changed information (e.g., list of peers, list of services) stays "fresh" and decreases the service's response time significantly.

Scenario 3. Some combination of 1 and 2. Even though the best effort should be made to ensure that a "fresh" cache is readily available (scenario 2), caching may still be controlled using Cache-control directives (scenario 1).

@wznira wznira transferred this issue from faa-swim/swim-discovery-service Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

10 participants