| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Review requested:
|
Sorry, something went wrong.
Codecov Report✅ All modified and coverable lines are covered by tests. @@ Coverage Diff @@
## main #65293 +/- ##
==========================================
+ Coverage 90.32% 90.34% +0.01%
==========================================
Files 751 751
Lines 249960 250332 +372
Branches 47204 47316 +112
==========================================
+ Hits 225774 226160 +386
- Misses 15564 15566 +2
+ Partials 8622 8606 -16
... and 41 files with indirect coverage changes 🚀 New features to boost your workflow:
|
Sorry, something went wrong.
A portable compile cache is meant to be reused wherever the same module layout is found, which includes being generated once (at build time, say) and shipped read-only with an application for whoever runs it. On platforms with uids the cache subdirectory is suffixed with the uid of the user who created it, so such a cache is only ever found by that one user. Omit the suffix in portable mode: a user who cannot write to the directory still reads it, and a failed write is only a cache miss. Signed-off-by: Shelley Vohr <shelley.vohr@gmail.com>
|
I like this. Could it be used to speed up startup of servers deployed in Docker containers? Like maybe I build the cache when I build the Docker image, and when the container starts up it should start a little faster? |
Sorry, something went wrong.
|
@GeoffreyBooth yep that's the idea. you could build the cache during docker build with NODE_COMPILE_CACHE=/app/.cache NODE_COMPILE_CACHE_PORTABLE=1 node server.js (or module.enableCompileCache({ directory, portable: true }) from the app) and exit; the entries are keyed by path relative to the cache directory, so they hit at run time as long as the app and the cache directory keep the same relative layout in the image. the missing bit for read-only images is #65302 which just stops node from trying to write into the cache directory when it can't |
Sorry, something went wrong.
Sorry, something went wrong.
|
That sounds great. Once all the pieces land we should add a Docker example in the docs somewhere. |
Sorry, something went wrong.
Sorry, something went wrong.
|
@GeoffreyBooth any idea what's up with the commit queue? |
Sorry, something went wrong.
A portable compile cache is meant to be reused wherever the same module layout is found, which includes being generated once (at build time, say) and shipped read-only with an application for whoever runs it. On platforms with uids the cache subdirectory is suffixed with the uid of the user who created it, so such a cache is only ever found by that one user. Omit the suffix in portable mode: a user who cannot write to the directory still reads it, and a failed write is only a cache miss. Signed-off-by: Shelley Vohr <shelley.vohr@gmail.com> PR-URL: #65293 Reviewed-By: James M Snell <jasnell@gmail.com>
A portable compile cache is meant to be reused wherever the same module layout is found, which includes being generated once (at build time, say) and shipped read-only with an application for whoever runs it. On platforms with uids the cache subdirectory is suffixed with the uid of the user who created it, so such a cache is only ever found by that one user. Omit the suffix in portable mode: a user who cannot write to the directory still reads it, and a failed write is only a cache miss. Signed-off-by: Shelley Vohr <shelley.vohr@gmail.com> PR-URL: #65293 Reviewed-By: James M Snell <jasnell@gmail.com>
| Back | FazBrowse Home | New Git URL |
A portable compile cache is meant to be reused wherever the same module layout is found. One shape of that is a cache generated once, at build time, and shipped read-only with an application for whoever runs it. On platforms with uids the cache subdirectory is suffixed with the uid of the user who created it ($NODE_VERSION-$ARCH-$CACHE_DATA_VERSION_TAG-$UID), so such a cache is only ever found by that one user; the split exists so users sharing a writable directory do not trip over each other's file permissions.
This omits the uid suffix in portable mode only. A user who cannot write to the directory still reads it, and a failed write is only a cache miss (Persist already logs and skips a temp file it cannot create). Non-portable caches keep the suffix.
Docs updated for portable and NODE_COMPILE_CACHE_PORTABLE; test-compile-cache-api-portable now asserts the tag directory name.
Context: an Electron application generating its main-process cache at package time and shipping it beside its app.asar (module.enableCompileCache({ directory, portable: true }) at launch); measured on that app, the shipped cache roughly halves the launch bundle's load time, but with the uid in the tag it is only found by users whose uid matches the build machine's.