Development guide
Table of Contents
Debugging: build time
By default, the cluster is deployed in production mode with verbose logging and asserts disabled.
To turn on the debug mode, deploy a cluster with MODE=debug env variable (eg. MODE=debug make deploy).
A cluster deployed in debug mode will produce a log like this:
Debugging: run time
As of v3.18 (git tag 1.3.18), the following can be done at any point in time:
The example (above) elevates verbosity level of two specific modules: EC (erasure coding) and xactions (batch jobs).
The change takes an effect immediately. But you can also change logging verbosity for the entire cluster - all modules:
Caution: 5 is the maximum (super-verbose) level - use for shorter intervals of time and always reset back to the default (3).
NOTE: for module names, see cmn/cos/log_modules.go. Or, type ais config cluster or ais config node, and press <TAB-TAB>.
Using CLI to debug
Please refer CLI: verbose mode.
Scripts
There is a growing number of scripts and useful commands that can be used in development.
To see make options and usage examples, do:
Clean deploy
Deploys a new instance of an AIS cluster after shutting down currently running cluster(s), if any.
To make it even more convenient, consider setting up an alias:
Example: minimal remote cluster
The command below can be conveniently used to develop with remote AIS clusters and/or test related functionality.
Here we run two minimal - one gateway and one target - clusters: “local” (by default, at http://localhost:8080) and “remote”, at http://127.0.0.1:11080.
Henceforth, the terms “local cluster” and “remote cluster” are used without quotes.
The script will not only deploy the two clusters - it will also assign the remote one its user-specified alias and attach one cluster to another, thus forming a global namespace.
Here’s another example that illustrates multi-node (6 + 6) cluster with storage targets utilizing loopback devices to simulate actual non-shared storage disks (one disk per target mountpath):
Overall, this line above will create 4 loopbacks of total size 123M * 4 = 0.5GiB. It’ll take maybe a few extra seconds but only at the very first run - subsequent cluster restarts will utilize already provisioned devices and other persistent configuration.
From here, you can create and destroy buckets, read and write data, show buckets, objects and their respective properties -
in short, perform all supported operations on the remote cluster - either directly, via AIS_ENDPOINT or indirectly,
via the (attached) local cluster. For example:
Notice the bucket naming syntax: by convention, prefix
@indicated remote cluster’s UUIDs, and soais://@remais/abctranslates as “AIS backend provider, where remote cluster has aliasremais”.
Example: 5 proxies and 5 targets with GCP backend
The command below starts a cluster with 5 proxies and 5 targets with GCP cloud enabled.
Remember to set GOOGLE_APPLICATION_CREDENTIALS env when using GCP cloud!
The example below deploys:
- a simulated remote cluster with alias “remoteAIS”
- 3 targets
- 3 proxies
- with AWS support
Options
(**) To use this option, you must have generated certificates in $HOME directory. Here is a script which can help you with that:
Performance comparison
Compares benchmark between the current commit and old commit provided in argument.
This script is incredibly important because it allows catching regressions. It also can quickly provide an answer if the change that was made actually improved the performance.
Example usage
The command below will compare the benchmark(s) BenchmarkRandom* between the current commit and f9a1536f....
Options
More
This local-playground usage example is a yet another brief introduction into setting up Go environment, provisioniong data drives for AIS deployment, and running a minimal AIS cluster - locally.