One of the biggest features coming in Artillery 2.0 is multicore support. As we know, Node.js is single-threaded and will only use one CPU, even if there are 7 other CPUs available. Starting with Artillery 2.0 however, every single CPU will be put to work.

How does it work under the hood? Artillery will fork a number of worker processes (one per available core) and distribute the work between them (the same mechanism that the cluster module uses).

What does this mean for Artillery users? It means better performance! Higher load can now be generated on the same machine (provided it has more than one CPU, which it likely does - it’s 2016!) Artillery is already performant enough to be able to test a lot of production systems from humble hardware (a developer’s MacBook Air for example). It’s even faster now. And for distributed tests, whereas you might need 10 VMs to run a larger test now, with multicore support you may only need half of that or less (depending on the number of vCPUs of and other factors of course this can vary).

Let’s look at an example!

The chart below shows a linear improvement of Artillery running in multicore mode vs current single-process mode, roughly an improvement by a factor of 2.2x:

Artillery multicore performance improvement

In both of these test runs Artillery created 20 virtual users per second for 60 seconds, each of those users sending 100 GET requests to an URL:

artillery quick -n 100 -r 20 -d 60 http://localhost/

The URL is a static page served by nginx. Each virtual user established a new TCP connection (Artillery’s default behaviour).

Since nginx was running on the same host, one of the CPU cores was allocated to it to prevent any interference.

The machine is a bare-metal server from Packet.net with a 4-core 2.4Ghz Intel Atom C2550 CPU and 8GB of RAM.

This is only a quick unscientific benchmark but it’s indicative of the performance improvements with multicore support.

When can I use this?

Full multicore support is expected to ship in Artillery 2.0.

In the meantime, if you’re feeling adventurous you can try beta support with:

USE_MULTICORE=true ARTILLERY_WORKERS=2 artillery run my-script.yaml

Where ARTILLERY_WORKERS is the number of CPUs to use. A good rule-of-thumb is to set that to total number of CPUs - 1.