# ironcore-alloy Rust Benchmarks This directory contains a benchmark suite for the Rust version of ironcore-alloy. To build and run the benchmark, just execute the following commands from this directory: ``` docker compose up -d cargo bench ``` If you'd like to only run the benchmarks for standalone mode, which do not require a TSP, you can execute them by running: ```bash cargo bench -- "^Standalone.*" ``` ## Tenant Security Proxy In order to run the benchmarks, ironcore-alloy needs to connect to a _Tenant Security Proxy (TSP)_. This service is provided as a Docker container, so it is easy to run the proxy on any computer that has Docker installed. IronCore Labs hosts the Docker container on a publicly accessible container registry, so you can pull the image from there and run it locally. In addition to the Docker containers, you need a configuration file that specifies how the TSP should communicate with the IronCore Labs Configuration Broker and Data Control Platform, which work together to enable the end-to-end encryption that keeps all of the tenant KMS configuration information secure. To simplify the process of running these examples, we have created a demo vendor and tenants that you can use for the examples; all the necessary configuration information is included in the [demo-tsp.conf](demo-tsp.conf) file in this directory. **NOTE:** Normally, the file containing the configuration would be generated by the vendor and loaded into a Kubernetes secret or similar mechanism for securely loading the configuration into the docker container. We have included this configuration in the repository as a convenience. Also note that these accounts are all created in IronCore's staging infrastructure. Production TSPs will often be accompanied by one or more [Tenant Security Logdriver](https://ironcorelabs.com/docs/saas-shield/tenant-security-logdriver/overview/) instances. Because the purpose of this benchmark is to demonstrate the capabilities of ironcore-alloy Rust, we have chosen to not include Logdriver in it. If you wish to modify the Docker Compose file to include Logdriver, be sure to consult its [Deployment](https://ironcorelabs.com/docs/saas-shield/tenant-security-logdriver/deployment/) page to learn how to properly configure it based on the resources you have available. The following `docker compose` command will get a TSP running on your computer with the provided configuration: ``` docker compose up ``` This starts the TSP locally listening on port 32804. The benchmark expects to connect to the TSP at that address. To connect with and use the TSP, you need to supply a couple more configuration values: the first is the API key that the TSP uses to authenticate requests from ironcore-alloy, and the second is the tenant ID to use. The API key value is specified in the `demo-tsp.conf` file. You can just set the environment variable to the same value: `export API_KEY=0WUaXesNgbTAuLwn` The benchmark can be run using a different cloud KMS by selecting a different tenant configured for our demo SaaS vendor. There are six tenants defined; their IDs are the following: - tenant-gcp - tenant-aws - tenant-azure - tenant-gcp-l - tenant-aws-l - tenant-azure-l The last three are similar to the first three, but they have _key leasing_ enabled. By default, the benchmark will use the `tenant-gcp-l` tenant. If you would like to experiment with a different tenant, just do: ```bash export TENANT_ID=