Skip to content

Experiment using a high CPU runner for assets compilation jobs

Related to #213107.

Duration of gitlab:assets:compile_webpack_if_needed per job / runner

Job / Runner gsrm (n1-standard-2) e2-standard-2 e2-standard-4 e2-standard-8 e2-standard-16 c2-standard-4 c2-standard-8 c2-standard-16
compile-assets pull-cache (1st run) 69s 151s 142s 126s 133s 84s 80s 77s
compile-assets pull-cache (2nd run) 86s 176s 142s 140s 136s 86s 80s 76s
gitlab:assets:compile pull-cache (1st run) 1296s 1417s 1002s 826s 754s 646s 534s 518s
gitlab:assets:compile pull-cache (2nd run) 1428s 1460s 964s 864s 774s 652s 562s 482s

Time gains

  • Reference timing of gitlab:assets:compile_webpack_if_needed for the compile-assets pull-cache job: 77 seconds
  • Reference timing of gitlab:assets:compile_webpack_if_needed for the gitlab:assets:compile pull-cache job: 1362 seconds
Job / Runner gsrm (n1-standard-2) e2-standard-2 e2-standard-4 e2-standard-8 e2-standard-16 c2-standard-4 c2-standard-8 c2-standard-16
compile-assets pull-cache 1 163 / 77 = 2.11 142 / 77 = 1.84 133 / 77 = 1.72 134 / 77 = 1.74 85 / 77 = 1.10 80 / 77 = 1.03 76 / 77 = 0.98
gitlab:assets:compile pull-cache 1 1438 / 1362 = 1.05 983 / 1362 = 0.72 845 / 1362 = 0.62 764 / 1362 = 0.56 649 / 1362 = 0.47 548 / 1362 = 0.40 500 / 1362 = 0.36

Prices per month - https://cloud.google.com/compute/vm-instance-pricing

N1 standard machine types (General-purpose machine type family) (current GitLab shared runners)

Machine type Virtual CPUs Memory Price (USD) Preemptible price (USD)
n1-standard-2 2 7.5GB $48.5500 $14.60

E2 standard machine types (General-purpose machine type family)

Machine type Virtual CPUs Memory Price (USD) Preemptible price (USD)
e2-standard-2 2 8GB $48.92 $14.67
e2-standard-4 4 16GB $97.83 $29.35
e2-standard-8 8 32GB $195.68 $58.7
e2-standard-16 16 64GB $391.35 $117.41

C2 machine types (Compute-optimized machine type family)

Machine type Virtual CPUs Memory Price (USD) Preemptible price (USD)
c2-standard-4 4 16 $121.9392 $36.8650
c2-standard-8 8 32 $243.8784 $73.8030
c2-standard-16 16 64 $487.7568 $147.5330

Analysis: cost * time gain

Job / Runner gsrm (n1-standard-2) e2-standard-2 e2-standard-4 e2-standard-8 e2-standard-16 c2-standard-4 c2-standard-8 c2-standard-16
compile-assets pull-cache 48.5500 * 1 = 48.5500 48.92 * 2.11 = 103.22 97.83 * 1.84 = 180.00 195.68 * 1.72 = 336.56 391.35 * 1.74 = 680.949 121.9392 * 1.10 = 134.13 243.8784 * 1.03 = 251.19 487.7568 * 0.98 = 478.00
gitlab:assets:compile pull-cache 48.5500 * 1 = 48.5500 48.92 * 1.05 = 51.36 97.83 * 0.72 = 70.43 195.68 * 0.62 = 121.32 391.35 * 0.56 = 219.15 121.93 * 0.47 = 57.31 243.87 * 0.40 = 97.55 487.75 * 0.36 = 175.59

Conclusion

Based on the cost * time gain analysis, it looks like the c2-standard-4 machines would be have the best cost * time gain ratio (it costs 18% more than the n1-standard-2 for a 53% faster compilation). I suggest we use this type of machine only for the gitlab:assets:compile pull-cache job since there's almost no gain for the compile-assets pull-cache job.

Edited by Rémy Coutable

Merge request reports