Repository navigation
Speed up server startup class loading and module extraction - #1562
Conversation
|
Speedup: skipping the WEB-INF/classes probe Three alternating before/after pairs of routine restarts on a local dev server (macOS), same build:
Each missed probe costs about 90 µs ( |
|
Speedup: incremental module extraction Four alternating before/after pairs of restarts right after a deploy on a local dev server (macOS, 189 modules). Every deploy rewrites every
About 5.4 s saved per post-deploy restart. Extraction used to delete each exploded module and rewrite all ~17,000 files whenever an archive's timestamp changed. It now keeps files whose size and CRC match the archive and removes only what the archive no longer contains, so the remaining time is mostly reading existing files to check their CRCs. The last two pairs ran under heavy machine load, so their startup totals are left out. Restarts without a deploy are unaffected, and TeamCity, which always extracts into an empty directory, sees no gain. |
|
Speedup: largest-first module extraction Six alternating before/after pairs of full extractions (all 189 modules into empty directories, as on a fresh install or TeamCity agent), running
About 0.5 s saved, and the ordered run was faster in all six pairs. Archives used to be split across the common pool in directory order, so a large one (jbrowse, assistant, onprc_ehr each take 2–4 s alone) could start last and stretch the whole phase. They're now queued by estimated cost (uncompressed bytes plus a per-file charge, which together fit per-module extraction times with r² = 0.97) and handed out largest first. A heavy background disk load inflated the absolute times for both variants. Restarts that only re-extract a few changed modules see no difference. |
| List<File> undeleted = new ArrayList<>(); | ||
| ExplodedModule.deleteDirectory(targetDirectory, false, undeleted); | ||
| Set<File> unreplaced = new LinkedHashSet<>(undeleted); | ||
| // Rewrite only entries whose content changed; every build rewrites module.xml, so most entries are unchanged |
There was a problem hiding this comment.
I don't follow the final conclusion in this comment. Maybe reword?
There was a problem hiding this comment.
Reworded.
// Rewrite only entries whose content changed; a rebuilt module is re-extracted over the last one, and most files are usually unchanged
| { | ||
| private static final String WEB_INF_CLASSES = "/WEB-INF/classes"; | ||
|
|
||
| private volatile boolean _noWebappClasses = false; |
There was a problem hiding this comment.
Why isn't this always true? Is this just future-proofing in case some class ends up in /WEB-INF/classes?
There was a problem hiding this comment.
Yes. More complicated than it needed to be. I simplified.
## Rationale This PR shortens server bootstrap and routine startup, part of getting TeamCity BVT suites to their first test sooner. Measured speedups for each change are in the PR comments. ## Related Pull Requests - LabKey/server#1562 ## Changes - Load PostgreSQL foreign-key metadata with a lighter per-table catalog query instead of the JDBC driver's - Check for missing database views by name rather than by loading full table metadata - Skip the view check and the encryption cipher migration on a new install - Initialize audit providers in parallel ## Testing New `JdbcMetaDataTest` FK equivalence test passed on a local server; new `TableXmlUtils.TestCase` has not run yet. New `ModuleArchiveTestCase` re-extraction test, which covers the extraction change in LabKey/server#1562, passed in a standalone JUnit run. Fresh-database bootstraps and routine restarts ran locally without errors. ## Tasks - [x] Claude Code Review - [x] Manual Testing @labkey-adam - [x] Test Automation
Rationale
This PR shortens server startup by cutting time spent in class loading and module extraction, part of getting TeamCity BVT suites to their first test sooner. Measured speedups for each change are in the PR comments. Deploys still rewrite every module archive, so the first restart after a deploy still checks every module; that build-side cause is https://github.com/LabKey/internal-issues/issues/1936.
Related Pull Requests
Changes