gutschilla

gutschilla

CI/CD: What's the fastest CPU for Elixir compilation?

Hi,

I want to minimize the time required for the most-costly compilation step in our CI/CD environment.

Right now, We’re on GitLab using their runners to be installed on own machines. I tried with Kubernetes clusters on GCP and the Gitlab-provided runners and while this all runs fine and scales nicely horizontally, I am looking for quick build and test times. In our setup, the build step (fetching deps, comiling deps and own sources) takes the most time: a few minutes, depending on the project.

So I am looking into dedicated hardware for our gitlab runners where the major workload will be mix compile :computer: . Since the team isn’t big I don’t really need all the auto-scaling a Kubenetes cluster has to offer. I want quick result for individual builds from scratch.

Should I go many cores or for high single-core performance? Other than that I’ll go for local SSD storage and plenty of RAM (64GB).

Thanks for your insights!

Marked As Solved

dimitarvp

dimitarvp

In terms of CPUs, I found the AMD Threadripper series quite good for compilation and overall dev work. Best results so far however I achieved with recent Xeon CPUs. They have bigger L1 / L2 / L3 caches than most consumer CPUs and I found them to be extremely adequate for compiling.

I’d say go for a Threadripper or a Xeon with at least 8 physical cores and a NVMe / PCI SSD (> 2 GB/s read/write speed). RAM isn’t of huge consequence for a compilation / CI machine. Even 16GB would be an overkill, unless the machine is also a dev machine and I misread you.

Also Liked

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

The biggest thing when making a CI/CD fast is minimizing the work that you need to do each time. If you’re having to compile all the dependencies from scratch every time, the biggest win will come from finding a way to cache that, regardless of what CPUs are available. We have a large project, but the actual compilation step takes < 10 seconds in our CI unless we are changing a dependency.

sorentwo

sorentwo

Oban Core Team

Tiered caches will help with the build time a lot. On CircleCI, even with small test runners, you are able to cache the hex deps, the compiled code, and PLT files if dialyzer is your thing.

I do this for all my applications, but here is an example for an open source project:

benwilson512

benwilson512

Author of Craft GraphQL APIs in Elixir with Absinthe

Fair enough! The Elixir compiler is parallel, so you should be able to benefit from multiple cores. SSD speed is of course critical. 64gb of ram is wildly more than enough.

dimitarvp

dimitarvp

To follow up, on a Xeon 2150B (10/20 cores):

$ time mix compile --force
Compiling 418 files (.ex)
Generated <our_company_app> app
mix compile --force  76.51s user 16.60s system 664% cpu 14.020 total

To be honest, I expected the Elixir compiler to be able to utilise all cores. :confused:

Still pretty fast though.

dimitarvp

dimitarvp

Yep, I’ve heard the dependency graph can severely impact the parallelisation of compilation
and it makes sense.

Where Next?

Popular in Questions Top

srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
New
yawaramin
In the Dialyzer docs ( http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files ), there is a way to tu...
New
JorisKok
I have a server on AWS, and was running a load test using artillery. When looking at the Phoenix dashboard I see the Ports going to 100% ...
New
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? https://hexdocs.pm/ecto/Ecto.Repo.h...
New
hpopp
To simplify some tasks at work, I wrote and published this package yesterday. It’s a simple macro that enables Access behaviour on struct...
New
Mooodi
Given a string, how can I get access to its character by index? Enum.at("my_string", 2) doesn't work. Or rather, not char, but a substr...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New

Other popular topics Top

chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 30048 115
New
yurko
Here are few pieces of (common) Linux knowledge that we use for reasonably small one server apps. We use Ubuntu but this should work for ...
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1140 51847 244
New
yawaramin
In the Dialyzer docs ( http://erlang.org/doc/man/dialyzer.html#requesting-or-suppressing-warnings-in-source-files ), there is a way to tu...
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set? Thanks.
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
beno
I will often find my self writing things similar to: case some_value do nil -&gt; something() "" -&gt; something() _ -&gt; someth...
New
Nvim
Elixir appears to be a superior language to Python. I don’t see any advantage of Python over Elixir. Are there any?
New

We're in Beta

About us Mission Statement