Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support tmpfs and a server queue for C++ compilers #10

Merged
merged 4 commits into from
Apr 26, 2023
Merged

Conversation

tolk-vm
Copy link
Contributor

@tolk-vm tolk-vm commented Apr 25, 2023

tmpfs

This PR drops an option -working-dir, adding two new instead:

  • -cpp-dir {string}, Directory for incoming C++ files and src cache, default /tmp/nocc/cpp
  • -obj-dir {string}, Directory for resulting obj files and obj cache, default /tmp/nocc/obj

The directory passed as -cpp-dir can be placed in tmpfs.
All operations with cpp files are performed in that directory:

  • incoming files (h/cpp/etc.) are saved there mirroring client's file structure;
  • src-cache is placed there;
  • pch files are placed there;
  • tmp files for preventing race conditions are also there, not in sys tmp dir.

So, if that directory is placed in tmpfs, the C++ compiler will take all files from memory (except for system headers), which noticeably speeds up compilation.

When setting up limits to tmpfs in a system, ensure that it will fit -src-cache-limit plus some extra space.

Note, that placing -obj-dir in tmpfs is not recommended, because obj files are usually much heavier, and they are just transparently streamed back from a hard disk in chunks.

C++ compiler queue

nocc-server now managers C++ compiler launches with a waiting queue. The purpose of a waiting queue is not to over-utilize server resources at peak times.
Currently, amount of max parallel C++ processes is an option provided at start up via max-parallel-cxx (in other words, it's not dynamic, nocc-server does not try to analyze CPU/memory).

Other improvements

  • less disk lookups in general; for instance, mirror client's dir structure in advance, avoiding calling os.Mkdir on making a hard link from src cache or uploading a file
  • server start up becomes quicker, as old dirs are deleted in the background
  • client start up becomes quicker, as in connects to all remotes in parallel
  • send NOCC_SERVERS on a client connect and maintain uniqueRemotesList on a server-side to detect clients with weird env vars

This release bumps version to v1.2.

cmd/nocc-daemon/main.go Outdated Show resolved Hide resolved
internal/server/clients-storage.go Show resolved Hide resolved
@tolk-vm tolk-vm merged commit 73b26e5 into master Apr 26, 2023
@tolk-vm tolk-vm deleted the support-tmpfs branch April 26, 2023 15:28
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