-
Notifications
You must be signed in to change notification settings - Fork 320
feat: blog post cold start improvements
#2811
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
Open
levivannoort
wants to merge
31
commits into
main
Choose a base branch
from
CLO-4110
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
d3dad38
feat: add mor information on reduction and cold start improvements
levivannoort 3e81d28
chore: improve readability
levivannoort aeab617
chore: add another paragraph about next steps
levivannoort c1a717b
chore: setup naming
levivannoort 308b47d
feat: add banner, avatar and roundup the blog post
levivannoort dc75779
Merge branch 'main' into CLO-4110
levivannoort 7bf0c31
Apply suggestion from @greptile-apps[bot]
adityaoberai c3ed91d
chore: remove anchor
levivannoort 2db7131
chore: update avatar and the results of the template testing
levivannoort 60bed63
Merge branch 'main' into CLO-4110
levivannoort 5739c65
chore: update usage of raw tar
levivannoort d05a9b2
chore: add images and option around image resizing to prevent it look…
levivannoort 9d098e0
chore: clear up references
levivannoort f48cb0c
chore: update with eline of text between the table and the observabil…
levivannoort a3ac70f
chore: downscale
levivannoort cb12ff3
chore: fix the format and assets tests
levivannoort e85dcb6
chore: optimize images
levivannoort a9e4b94
Update src/routes/blog/post/reducing-cold-starts-appwrite-sites/+page…
levivannoort f28eb02
Update src/routes/blog/post/reducing-cold-starts-appwrite-sites/+page…
levivannoort bc78f1d
Update src/routes/blog/post/reducing-cold-starts-appwrite-sites/+page…
levivannoort 47c71d0
Update src/routes/blog/post/reducing-cold-starts-appwrite-sites/+page…
levivannoort fe86bcd
Update src/routes/blog/post/reducing-cold-starts-appwrite-sites/+page…
levivannoort 1d1da1d
Update src/routes/blog/post/reducing-cold-starts-appwrite-sites/+page…
levivannoort 95f1bd0
Update src/routes/blog/post/reducing-cold-starts-appwrite-sites/+page…
levivannoort 412f68e
Update src/routes/blog/post/reducing-cold-starts-appwrite-sites/+page…
levivannoort a0e6f9e
Update src/routes/blog/post/reducing-cold-starts-appwrite-sites/+page…
levivannoort ce117ee
Update src/routes/blog/post/reducing-cold-starts-appwrite-sites/+page…
levivannoort b159142
Update src/routes/blog/post/reducing-cold-starts-appwrite-sites/+page…
adityaoberai 683f192
Update src/routes/blog/post/reducing-cold-starts-appwrite-sites/+page…
adityaoberai 27a062a
Update src/routes/blog/post/reducing-cold-starts-appwrite-sites/+page…
adityaoberai 8ae4f55
Update src/routes/blog/post/reducing-cold-starts-appwrite-sites/+page…
adityaoberai File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| --- | ||
| layout: author | ||
| name: Levi van Noort | ||
| slug: levi-van-noort | ||
| role: Platform Engineer | ||
| bio: Building a stable and standardized platform. | ||
| avatar: /images/avatars/levi.png | ||
| --- | ||
|
|
64 changes: 64 additions & 0 deletions
64
src/routes/blog/post/reducing-cold-starts-appwrite-sites/+page.markdoc
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| --- | ||
| layout: post | ||
| title: "How we reduced cold start times on Appwrite Sites" | ||
| description: Learn how we improved cold-start performance for Appwrite Sites, delivering faster load times for your web applications. | ||
| date: 2026-04-24 | ||
| cover: /images/blog/reducing-cold-starts-appwrite-sites/cover.png | ||
| timeToRead: 5 | ||
| author: levi-van-noort | ||
| category: product | ||
| --- | ||
|
|
||
| If you've ever deployed a site and noticed that first request taking just a bit too long, you've experienced a cold start. It's one of those things that's easy to overlook during development but quickly becomes noticeable in production, especially when your users are the ones waiting. | ||
|
|
||
| At Appwrite, improving the performance of [Sites](/products/sites) (and every other product) has always been a high priority. We wanted that first request to feel just as fast as every request after it. So we dug into the problem, ran some experiments, and made a series of changes that significantly brought down cold-start times. | ||
|
|
||
| In this blog, we will walk you through the cause of the slowdown, the approach we took to fix it, and the results we have seen since. | ||
|
|
||
| # Adding observability | ||
|
|
||
| Before implementing any fixes, we needed to understand what was actually happening. We started by adding observability across the full request lifecycle, instrumenting every step from the moment a request hits our edge to when the response is sent back. This gave us a clear breakdown of where time was being spent (and where it was being wasted). Without that visibility, we would have been guessing, and in performance work, guessing is how you end up optimizing the wrong thing. | ||
|
|
||
| # Compression and decompression | ||
|
|
||
| With better visibility into the request lifecycle, one pattern stood out immediately: compression and decompression of the build output accounted for a significant share of cold-start time. Build artifacts were being compressed with tar and extracted with gzip. This worked fine functionally, but the extraction step was eating up a noticeable chunk of every first request. | ||
|
|
||
| We tested a drop-in replacement of gzip with [igzip](https://github.com/intel/isa-l), an optimized implementation from Intel's Intelligent Storage Acceleration Library. The results were immediate: extraction times improved by 50 to 100%, making it one of the highest-impact changes we shipped. We also evaluated [zstd](https://github.com/facebook/zstd) as an alternative, but its performance was more variable and only showed gains at certain build output sizes, so we stuck with igzip for its consistent wins across the board. For very small build outputs, we skipped compression entirely and used plain tar, avoiding any decompression cost on the download path. | ||
|
|
||
| # Node file tracing | ||
|
|
||
| Faster decompression was a big win, but it raised an obvious next question: why were we extracting so much in the first place? Many build outputs included dependencies and files that were never touched at runtime. To address this, we implemented [Node file tracing](https://github.com/vercel/nft), which statically analyzes a Node.js application to determine exactly which files are required to run it. | ||
|
|
||
| The impact was dramatic. Smaller artifacts meant less to compress, less to transfer, and less to extract, compounding the gains we had already made on the decompression side. | ||
|
|
||
| Here are some examples of size reductions across our templates: | ||
|
|
||
| | Templates | Before | After | Reduction | | ||
| | --------- | ------ | ----- | --------- | | ||
| | Nuxt Playground | 235 MB | 46 MB | 80.4% | | ||
| | Analog Playground | 858 MB | 10 MB | 98.8% | | ||
| | TanStack Starter | 323 MB | 49 MB | 84.8% | | ||
| | Astro Playground | 169 MB | 95 MB | 43.8% | | ||
| | Remix Playground | 234 MB | 7 MB | 97.0% | | ||
| | Svelte Starter | 103 MB | 13 MB | 87.4% | | ||
| | Store Template | 185 MB | 3.5 MB | 98.1% | | ||
|
|
||
| The reduction in build output size also showed up clearly in our observability data: | ||
|
|
||
|  | ||
|
|
||
|  | ||
|
|
||
| # Cold starts | ||
|
|
||
| Those smaller artifacts translated directly into faster cold starts. With build outputs reduced by up to 98.8%, the download phase, previously one of the more costly steps, dropped from multiple seconds to just 100 to 200 milliseconds. Extraction saw a similar improvement, going from regular 4 to 7 second spikes down to around 200 to 400 milliseconds. Together, these two phases went from dominating the cold-start timeline to being barely noticeable. | ||
|
|
||
| The overall effect was a roughly 30 to 50% reduction in cold-start duration across the board. The remaining time is now largely spent on runtime initialization rather than transferring and unpacking artifacts. We've shifted the bottleneck to a fundamentally different part of the stack, and that's exactly where we want to focus next. With targeted work there, we expect to bring P95 timings below what P50 used to be. | ||
|
|
||
| # Benefit from this change | ||
|
|
||
| If you're running an SSR-based site on Appwrite Sites, all you need to do is redeploy your latest active deployment. The updated build process will automatically apply the optimizations described above, reducing your build output size and improving cold-start times, with no code changes required. | ||
|
|
||
| # What's next | ||
|
|
||
| These improvements are just the beginning. We're actively working on the next round of optimizations. Performance is not a one-time fix; it's an ongoing effort, and we're committed to making every deploy on Appwrite Sites feel instant. [Stay tuned](https://appwrite.io/discord) for more updates as we continue to push cold start times even lower. | ||
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+45 KB
static/images/blog/reducing-cold-starts-appwrite-sites/build-output-sizes-nft.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+52.8 KB
.../images/blog/reducing-cold-starts-appwrite-sites/build-output-sizes-non-nft.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.