IBM-Swift / swift-buildpack

IBM Cloud buildpack for Swift
BSD 3-Clause "New" or "Revised" License
32 stars 31 forks source link

Leverage dynamic caching. #7

Closed rolivieri closed 8 years ago

BDHernand commented 8 years ago

Read up on the following link:

http://blog.altoros.com/creating-a-custom-cloud-foundry-buildpack-from-scratch-whats-under-the-hood.html http://jamesthom.as/blog/2015/03/04/cloud-foundry-custom-buildpacks/

BDHernand commented 8 years ago

https://github.com/cloudfoundry/nodejs-buildpack/blob/master/bin/compile

is the NodeJS usage of cache

rolivieri commented 8 years ago

This task is being validated by https://github.com/IBM-Swift/swift-buildpack/pull/24.

rolivieri commented 8 years ago

After testing the changes many times on Bluemix and using bosh-lite, we have determined the following:

1) The unpack contents of the swift and clang tar files is more than 1 GB of data. The time that Cloud Foundry takes to move these files from the CACHE_DIR to its main data storage is very large (it may take over 2 mins to move this data). A re-execution of the cf push command also took longer because the platform had to make these files available on the CACHE_DIR folder when restarting the application.

2) To reduce the amount of time it took to move the files from the CACHE_DIR to the main storage, we tried caching the swift and clang tar files instead of the unpacked folders. This approach reduced significantly the amount of time that Cloud Foundry needed to copy the files to its main storage.

3) However, even after implementing #2 above, we noticed that there was no performance gain when using the CACHE_DIR. In fact, we noticed the opposite. If using the CACHE_DIR, it certainly increased the execution of the first cf push by 20, 30 seconds. There seems to be no benefit in leveraging the CACHE_DIR other than having an offline copy of the files that were downloaded during the first cf push (which, again, would take 20-30 secs longer if leveraging the CACHE_DIR folder). It is also worth mentioning that we measured the time a re-execution of the cf push command took when leveraging CACHE_DIR vs when the dependencies are downloaded again: no difference in the execution time of the cf push command.

4) Given these findings, we don't plan to leverage the CACHE_DIR since it will impact the performance of the buildpack in a negative way.

Miscellaneous points: