github.com/cloudfoundry/cli@v7.1.0+incompatible/doc/adr/0003-resource-matching-implementation.md (about) 1 # 3. Resource Matching Implementation 2 3 Date: 2019-03-22 4 5 ## Status 6 7 Accepted 8 9 ## Context 10 11 _The issue motivating this decision, and any context that influences or constrains the decision._ 12 13 When uploading applications to a particular foundation, 14 there may be duplicate files that are shared between apps. 15 In order to reduce the load from uploading duplicate files, 16 the Cloud Controller exposes an endpoint to match existing files prior to uploading application bits. 17 The client then uses this endpoint to determine which files require upload. 18 19 During the first stage of push, 20 PushPlans are created to determine what actions need to take place during the remaining push operation. 21 This introduced a unique decision, 22 perform resource match when creating push plans 23 or perform resource matching immediately prior to uploading application bits. 24 25 ## Decision 26 27 _The change that we're proposing or have agreed to implement._ 28 29 The decision was made to perform resource matching immediately prior to uploading application bits. 30 31 Performing resource matching as late as possible would result in the most optimized matching. 32 Since multiple applications can be pushed at a time, 33 if the client were to perform a resource match upfront, 34 none of the shared files between the apps would be matched because none of them have been uploaded yet. 35 By deferring the resource match to just before an app-specific upload, 36 files shared with any of the subsequent applications will then be matched before upload. 37 38 ## Consequences 39 40 _What becomes easier or more difficult to do and any risks introduced by the change that will need to be mitigated._ 41 42 The intention of the `CreatePushPlans` function was to have a single place which determines the actions needed during the push. 43 The decision to place resource matching later in the process diverges from this intention and may lead to confusion in the future. 44 The increase in performance when placing resource matching later in the process out-weighs the additional complexity due to the positioning.