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

Add CacheContext to architecture and API #244

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -346,7 +346,9 @@ The diagram below provides a high-level view of the actions taken during the lif

* Protocol Selection Properties: The Protocol Selection Properties consist of the options that an application may set to influence the selection of transport protocol, or to configure the behavior of generic transport protocol features. These options can take the form of requirements, prohibitions, and preferences. Examples include reliability, service class, multipath support, and fast open support.

* Specific Protocol Properties: The Specific Protocol Properties refer to the subset of Protocol Properties options that apply to a single protocol (transport protocol, IP, or security protocol). The presence of such Properties does not necessarily require that a specific protocol must be used when a Connection is established, but that if this protocol is employed, a particular set of options should then be used..
* Specific Protocol Properties: The Specific Protocol Properties refer to the subset of Protocol Properties options that apply to a single protocol (transport protocol, IP, or security protocol). The presence of such Properties does not necessarily require that a specific protocol must be used when a Connection is established, but that if this protocol is employed, a particular set of options should then be used.

* Caching Context: The Caching Context defines the group of Preconnections, Connections, and Listeners that are allowed to share cached state. This cached state may influence establishment as well as heuristics used during the lifetime of a Connection.
Copy link
Contributor

@britram britram Oct 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, could quibble about the exact wording.

I think there are two separate entities here that we need to deal with at the architectural level:

  • a "cached remote view" (I hate this term, but something that means the same thing), which is everything that an endpoint can remember about a remote endpoint it has associated with in the past. (This is largely equivalent to Post Sockets' Association, though there is a discussion to have about the extent to which Paths are bound to a cached remote view as opposed to the caching context as a whole.

  • a "caching context" as we have here, though there is a missing argument about why the caching context is not simply 1:1 contained within a transport services application context. (Indeed, I can't think of a good reason why it shouldn't be -- if the system can make inferences about paths from what it knows, why give the application special control over when it shouldn't)

Copy link
Contributor

@britram britram Oct 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, could quibble about the exact wording.

I think there are two separate entities here that we need to deal with at the architectural level:

  • a "cached remote view" (I hate this term, but something that means the same thing), which is everything that an endpoint can remember about a remote endpoint it has associated with in the past. (This is largely equivalent to Post Sockets' Association, though there is a discussion to have about the extent to which Paths are bound to a cached remote view as opposed to the caching context as a whole.

  • a "caching context" as we have here, though there is a missing argument about why the caching context is not simply 1:1 contained within a transport services application context. (Indeed, I can't think of a good reason why it shouldn't be -- if the system can make inferences about paths from what it knows, why give the application special control over when it shouldn't)

Copy link
Contributor

@britram britram Oct 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, could quibble about the exact wording.

I think there are two separate entities here that we need to deal with at the architectural level:

  • a "cached remote view" (I hate this term, but something that means the same thing), which is everything that an endpoint can remember about a remote endpoint it has associated with in the past. (This is largely equivalent to Post Sockets' Association, though there is a discussion to have about the extent to which Paths are bound to a cached remote view as opposed to the caching context as a whole.

  • a "caching context" as we have here, though there is a missing argument about why the caching context is not simply 1:1 contained within a transport services application context. (Indeed, I can't think of a good reason why it shouldn't be -- if the system can make inferences about paths from what it knows, why give the application special control over when it shouldn't)


### Establishment Actions {#establishment}

@@ -328,14 +328,15 @@ describes properties of a Connection that might exist in the future. This state
comprises Local Endpoint and Remote Endpoint Objects that denote the endpoints
of the potential Connection (see {{endpointspec}}), the Selection Properties
(see {{selection-props}}), any preconfigured Connection Properties
({{connection-props}}), and the security parameters (see
{{security-parameters}}):
(see {{connection-props}}), the security parameters (see
{{security-parameters}}), and a cache context (see {{cache-context}}):

~~~
Preconnection := NewPreconnection(LocalEndpoint,
RemoteEndpoint,
TransportProperties,
SecurityParams)
SecurityParams,
CacheContext)
Copy link
Contributor

@britram britram Oct 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above -- not clear why we need to expose this up as something special beyond a feature of the transport services application context (does this have a name in this doc?)

Copy link
Contributor

@mwelzl mwelzl Nov 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After discussion with Tommy in Bangkok: CacheContext should be an optional parameter.

~~~

The Local Endpoint MUST be specified if the Preconnection is used to Listen()
@@ -705,6 +706,65 @@ ChallengeCallback := NewCallback({
SecurityParameters.SetIdentityChallengeCallback(challengeCallback)
~~~

## Specifying Caching Context {#cache-context}

During the lifetime of Connection, the various protocols used may generate
state or statistics that can be cached to help optimize future Connections.
New Connections can then take advantage of this cached state to influence
connection establishment, tuning protocol heuristics, and resuming state.
Copy link
Contributor

@chris-wood chris-wood Oct 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/to influence connection establishment, tuning protocol heuristics, and resuming state/for connection establishment and protocol heuristic tuning.


Some examples of cached state include:

- DNS query answers may be cached for use in subsequent Connections
to the same hostname.

- TCP round-trip-time (RTT) metrics may be cached to tune delays for
protocol stack racing.

- TLS state may be cached for use in session resumption.
Copy link
Contributor

@chris-wood chris-wood Oct 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe drop a reference to RFC 5077?


Within a single application, there may need to be several distinct and separate
Copy link
Contributor

@chris-wood chris-wood Oct 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/to be/to maintain?

caches to ensure that data and state is not shared between certain Connections.
Each Preconnection is therefore associated with a CacheContext, which defines
a distinct set of cached information. All Connections and Preconnections that are
Copy link
Contributor

@chris-wood chris-wood Oct 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possibly add here, or in the implementation draft: Moreover, certain cache state may not be appropriate for re-use for all applications. For example, to improve privacy and limit client tracking, TLS 1.3 {{!RFC8446}} connection state should not be re-used absent early data to write, as this introduces an unnecessary tracking vector without saving any round trips. (It may however cost more CPU.)

Copy link
Contributor

@theri theri Nov 12, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Bangkok we said that the default is that all sharing is allowed:
If the application does not provide any explicit caching context, all Connections are associated with the same implicit caching context, so they can share state.

If we do it like this, let's make it very explicit in the text:
I suggest to move the sentence "By default, a Preconnection is associated with an implicit CacheContext." up here, clarify that it's always the same implicit CacheContext, and say that this means that by default, all Connections within the same application context are allowed to share state.
After this, the warning about sharing TLS 1.3 connection state fits quite nicely imo.

Alternatively, we could set the default that all state can be shared except TLS 1.3 connection state ...?

associated with a single CacheContext are allowed to share state.
Copy link
Contributor

@chris-wood chris-wood Oct 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd piggyback this with a blurb similar to the above, wherein we only want use that shared state if necessary.


A new CacheContext can be created and handed to one or more Preconnections.

~~~
CacheContext := NewCacheContext()
~~~

By default, a Preconnection is associated with an implicit CacheContext. This
context may be directly accessed if needed.

~~~
CacheContext := ImplicitCacheContext()
~~~

A custom CacheContext may be configured to set up policy for how it should
cache data. Setting any of these items on the implicit
CacheContext is an error.

~~~
CacheContext.SetDefaultEntryLifetime(SECONDS_PER_DAY)
CacheContext.SetTotalCapacity(MAX_CACHE_ELEMENTS)
~~~

A custom CacheContext may also be configured to disable all caching
for privacy-sensitive connections that should not preserve state.

~~~
CacheContext.SetDisableCaching(true)
Copy link
Contributor

@chris-wood chris-wood Oct 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if it's cleaner to give Preconnections a caching context that disables caching, or simply not give them a caching context.

Copy link
Contributor

@philsbln philsbln Dec 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tend to have a global, singleton DoNotCacheContext as a shortcut for that.

~~~

If an application wants to flush all cached data in a context, it can invoke
a flush function.

~~~
CacheContext.Flush()
~~~

# Establishing Connections {#establishment}

Before a Connection can be used for data transfer, it must be established.