Skip to content

Bug 2070106 - Use 4 threads by default when running grcov. - #3079

Open
nicolas-guichard wants to merge 1 commit into
mozilla:masterfrom
nicolas-guichard:push-lkrsuvsvoytr
Open

nicolas-guichard wants to merge 1 commit into
mozilla:masterfrom
nicolas-guichard:push-lkrsuvsvoytr

Conversation

@nicolas-guichard

Copy link
Copy Markdown
Contributor

Bugzilla URL: https://bugzilla.mozilla.org/show_bug.cgi?id=2070106

Some Firefox code coverage artifacts are huge (up to almost 3 GiB for some JSVM info files) and the grcov producer fully loads them in memory to send them to the consumers.

By default grcov uses as many consumers as the machine has got threads, that's way too many and leads to lock contention (in add_results) and huge memory consumption.

Using the coverage artifacts from 1137460458364499c6788a3f8ac9836a086bb04b, on my machine going down to 4 threads gets the peak RAM usage down to 25 GiB with a reasonable run time:

time -v grcov --threads 4 \
              --ignore-parsing-error \
              -t covdir \
              -s firefox \
              --ignore-not-existing \
              ccov-artifacts/* \
              > /dev/null

User time (seconds): 2357.67
System time (seconds): 288.88
Percent of CPU this job got: 337%
Elapsed (wall clock) time (h:mm:ss or m:ss): 13:03.12
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 25340076
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 4
Minor (reclaiming a frame) page faults: 122990948
Voluntary context switches: 800355
Involuntary context switches: 23554
Swaps: 0
File system inputs: 150660064
File system outputs: 0
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0

@marco-c

marco-c commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator

Should we use a different kind of instance that has more memory and fewer CPUs?

@nicolas-guichard

Copy link
Copy Markdown
Contributor Author

If I read correctly we are currently using c2-standard-8 machines, ie 8 vCPU/32 GiB RAM @ 0,417616 $US/h.
It seems to me that a c2d-highmem-4 with 4 vCPU/32 GiB RAM @ 0,24494 $US/h would be better suited yes.
https://docs.cloud.google.com/compute/docs/memory-optimized-machines lists the m4-hypermem-4 and m4n-hypermem-4 with 4 vCPU/62 GiB RAM, but I can't find them on the pricing page.

Some Firefox code coverage artifacts are huge (up to almost 3 GiB for
some JSVM info files) and the grcov producer fully loads them in
memory to send them to the consumers.

By default grcov uses as many consumers as the machine has got threads,
that's way too many and leads to lock contention (in add_results) and
huge memory consumption.

Using the coverage artifacts from 1137460458364499c6788a3f8ac9836a086bb04b,
on my machine going down to 4 threads gets the peak RAM usage down to
25 GiB with a reasonable run time:
```
time -v grcov --threads 4 \
              --ignore-parsing-error \
              -t covdir \
              -s firefox \
              --ignore-not-existing \
              ccov-artifacts/* \
              > /dev/null

User time (seconds): 2357.67
System time (seconds): 288.88
Percent of CPU this job got: 337%
Elapsed (wall clock) time (h:mm:ss or m:ss): 13:03.12
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 25340076
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 4
Minor (reclaiming a frame) page faults: 122990948
Voluntary context switches: 800355
Involuntary context switches: 23554
Swaps: 0
File system inputs: 150660064
File system outputs: 0
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants