|
| 1 | +<!doctype html> |
| 2 | +<html> |
| 3 | + <head> |
| 4 | + <title>Why is CI so slow?</title> |
| 5 | + <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> |
| 6 | + <meta http-equiv="Content-Security-Policy" content="default-src 'self';"> |
| 7 | + <meta name="referrer" content="strict-origin"> |
| 8 | + <meta name="author" content="Hong Shick Pak"> |
| 9 | + <meta name="viewport" content="width=device-width, initial-scale=1"> |
| 10 | + <meta name="keywords" content="Michael Pak, Hong Shick Pak, Hong, Shick, Pak, Michael, Blog, hspak"> |
| 11 | + <meta name="description" content="Blog of Hong Shick Pak"> |
| 12 | + <meta property="og:url" content="https://hspak.dev"> |
| 13 | + <meta property="og:type" content="website"> |
| 14 | + <meta property="og:site_name" content="Hspak"> |
| 15 | + <meta property="og:title" content="Hspak"> |
| 16 | + <meta property="og:description" content="Blog of Hong Shick Pak"> |
| 17 | + <meta property="twitter:creator" content="@hspasta"> |
| 18 | + <link rel="canonical" href="https://hspak.dev/"> |
| 19 | + <link rel="stylesheet" href="/index.css"> |
| 20 | + </head> |
| 21 | + <body> |
| 22 | + <div class="outer"> |
| 23 | + <div class="container"> |
| 24 | + <div class="block"> |
| 25 | + <a href="/"><h1>Blog</h1></a> |
| 26 | + </div> |
| 27 | + <div class="block"> |
| 28 | + <h2>Why is CI so slow?</h2> |
| 29 | + <div class="date">Oct 26, 2024 </div> |
| 30 | + <div class="body"> |
| 31 | +<p>I believe that containerized CI environments helped the industry move forward. |
| 32 | +We have easily reproducable environments for testing and allows companies to |
| 33 | +stay relatively platform agnostic. But they're often reeeally slow. It's sad |
| 34 | +that most CI improvements have been thanks to tools like <a href="https://bun.sh/">bun</a> or |
| 35 | +<a href="https://astral.sh/blog/uv">uv</a> re-thinking package management from the ground |
| 36 | +up with performance at the forefront.</p> |
| 37 | +<p>Most CI platforms <a href="https://circleci.com/">are</a> |
| 38 | +<a href="https://github.com/features/actions">all</a> |
| 39 | +<a href="https://docs.gitlab.com/runner/">the</a> <a href="https://buildkite.com/">same</a>: you |
| 40 | +define some YAML-esque file a DAG of containers that run some shell scripts. |
| 41 | +These CI platforms can easily run multi-tenant workloads and improve margins |
| 42 | +since these container executions are mostly ephemeral. Artifacts are usually |
| 43 | +pushed out to an object store like <a href="https://aws.amazon.com/s3/">AWS S3</a>. Most of |
| 44 | +them offer a "cache" where they can push and pull from an object store. This is |
| 45 | +not really a cache. It's a hack at an attempt to mimic what a cache on local dev |
| 46 | +looks like.</p> |
| 47 | +<p>So much of CI time is burned:</p> |
| 48 | +<ul> |
| 49 | +<li>Downloading a container, which is often massive to include all necessary tooling.</li> |
| 50 | +<li>Installing dependencies of your project, which is also often also slow.</li> |
| 51 | +</ul> |
| 52 | +<p>I wonder why there has not been an attempt (a successful attempt?) of creating a |
| 53 | +CI platform that mimics local development environment:</p> |
| 54 | +<ul> |
| 55 | +<li>The git repo is "hot". It'll have the last commit checked out, which will never be that far away from the origin server. |
| 56 | +Pulling down the next branch to test should be small incremenatal delta.</li> |
| 57 | +<li>The filesystem persists: the dependencies are already mostly there (mod new changes). |
| 58 | +Any cached files generated during builds and tests persist. |
| 59 | +There's no slow fetches from an object store.</li> |
| 60 | +</ul> |
| 61 | +<p>Of course, a persistent fs allows for bugs to creep up (stale cache not being |
| 62 | +invalidated, invalid state not cleaned up, etc.). But this should be the |
| 63 | +exception we face, not the default. No developer is blowing their environment |
| 64 | +away on every commit. CI shouldn't have to either.</p> |
| 65 | +<p>Food for thought.</p> |
| 66 | + </div> |
| 67 | + </div> <div class="block"> |
| 68 | + <div class="footer"> |
| 69 | + <a href="#top">To Top</a> · <a href="https://hspak.com">By Hong</a> |
| 70 | + </div> |
| 71 | + </div> |
| 72 | + </div> |
| 73 | + </div> |
| 74 | + </body> |
| 75 | +</html> |
0 commit comments