V3 Documentation
Search

Engine Hosting Strategy

Global-level NCrunch configuration setting

Purpose

From v2.11, NCrunch has the ability to host its engine outside the IDE process and share data with the IDE using memory sharing IPC.

This setting controls how NCrunch should host its engine. Note that changing this setting may require a restart of the IDE, as NCrunch cannot unload the engine from the IDE process after it has been initialised with the HostInsideIDE option.

Default Value

The default value of this setting depends upon the capability of the machine NCrunch is installed on.

On 64-bit machines with total memory of at least 5,368,709,120 bytes (5GB), this setting will default to x64SatelliteProcess.

For all other machines, this setting will default to x86SatelliteProcess.

Recommendations

Hosting the engine outside the IDE brings both advantages and disadvantages. In most cases, the advantages will outweigh the disadvantages. However, it is worth understanding the implications of satellite hosting and deciding whether it is suitable for your environment.

When the engine is hosted outside the IDE, NCrunch will attempt to minimise its IDE footprint as much as possible. The only code executed within the IDE will be that which is required to service the visual elements of NCrunch's UI and to push data to the engine which is only available inside the IDE (such as open documents, the list of open projects, NCrunch configuration, etc). All background processing is performed in the satellite process with necessary data being exchanged with the IDE using shared memory (IPC).

Hosting the engine in an x86 satellite process consumes less total memory than an x64 satellite process, as objects under .NET have a smaller memory footprint under x86. However, the x86 process has a memory ceiling of only 2GB, greatly limiting its scalability. For this reason, x86 hosting is recommended on machines with only a small amount of physical memory available.

Satellite hosting brings the following benefits:

  • Memory allocated by NCrunch is mostly held in the satellite process, greatly reducing VS memory consumption and reducing the risk of OutOfMemoryExceptions and instability inside the IDE.
  • The allocations/deallocations by NCrunch (memory traffic) are confined mostly to the satellite process. This greatly reduces the load on the IDE's garbage collector, which is often responsible for locking the VS UI during heap compaction when memory traffic gets too high.
  • The NCrunch engine is able to operate with a higher memory ceiling (especially under x64 hosting). This allows the engine to scale further and leaves room for future feature development.
  • If the NCrunch engine crashes, the satellite process is cleanly torn down and can be restarted from the IDE without taking down Visual Studio with it.
  • If the IDE crashes, the NCrunch engine is able to perform a clean exit, saving any test and coverage data to its cache file.
IDE hosting brings the following benefits:
  • Less overall CPU is consumed because NCrunch does not need to perform extra work to exchange data between the engine and the IDE. Note that the work required to exchange this data is usually small compared to CPU consumed by executing tests and servicing the NCrunch engine.
  • Slightly less overall memory is consumed because NCrunch does not need to reload its binaries into a separate process with its own memory space.
  • The time taken to initialise the NCrunch engine is marginally lower because there is no need to spawn a new process.