# 2.6 Asynchronous Execution of Karamba3D Components

Asynchronous (Async) execution in Grasshopper refers to the ability of components to process data independently and concurrently without blocking the main computational thread. In the traditional, synchronous execution model of Grasshopper, each component computes its outputs sequentially, requiring all upstream components to complete their computations before downstream components can begin. This can result in delays and inefficiencies, particularly when dealing with computationally intensive tasks.

In Karamba3D, asynchronous execution can be toggled via the **Karamba3D menu** under **"Settings > Async Execution"**. By default, this option is disabled.

Karamba3D's asynchronous components leverage the [`GrasshopperAsyncComponent`](https://github.com/specklesystems/GrasshopperAsyncComponent) framework, developed by [Speckle Systems](https://www.speckle.systems/). This architecture divides the execution process of async components into two distinct stages:

* **Data Acquisition**\
  During this initial stage, no new computed data is output, which creates challenges for components that iteratively process portions of a Grasshopper definition, such as Galapagos. This limitation makes it necessary to disable async execution for Karamba3D components during looping or optimization runs.
* **Data Processing**\
  Once the required data is acquired, processing occurs independently, allowing for improved performance in certain contexts.

{% hint style="info" %}
**Disable async-execution when doing optimization runs (e.g. with Galapagos) or looping.**
{% endhint %}

#### Async-Capable Components in Karamba3D

The following components in Karamba3D support asynchronous execution:

* **AssembleModel**
* All **Algorithms** components
* **ModelView**, **BeamView**, and **ShellView**
* **LineResultsOnShells**
* **MeshBreps**
* **Shell Section**

#### Features and Considerations

Async components in Karamba3D introduce key enhancements and options:

* **Improved Responsiveness**\
  Async components run parallel to the UI thread, preventing the interface from freezing during computation.
* **Context Menu Options**\
  Async-capable components include two additional entries in their context menu:
  * **Cancel**: Halts the component's execution while it is running.
  * **Parallel Execution**: Allows the component to process incoming data in parallel.

#### Caution on Parallel Execution

While parallel execution may enhance performance, Karamba3D's algorithms are already highly optimized for parallel processing. Activating an additional layer of parallelism via "Parallel Execution" in the context menu could result in **over-parallelization**, potentially causing performance degradation rather than improvement. Users are advised to enable this feature judiciously based on specific computational needs.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://manual.karamba3d.com/2-getting-started/2-getting-started-1/2.6-asynchronous-execution-of-karamba3d-components.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
