# Improving the Reliability of Cadence Search Queries That Use OpenSearch/Elasticsearch

[Blog](/blog/)&gt;[Technology](/blog/category/technical/)&gt;Improving the Reliability of Cadence Search Queries That Use OpenSearch/Elasticsearch 

Improving the Reliability of Cadence Search Queries That Use OpenSearch/Elasticsearch
=====================================================================================

March 20, 2023 | By [ Rony Rahman](https://www.instaclustr.com/blog/author/rony-rahman/)

 

 

 

 



   [ ](https://x.com/intent/tweet?text=Improving%20the%20Reliability%20of%20Cadence%20Search%20Queries%20That%20Use%20OpenSearch/Elasticsearch&url=https://www.instaclustr.com/blog/improving-the-reliability-of-cadence-search-queries/) [ ](https://www.linkedin.com/shareArticle?mini=true&url=https://www.instaclustr.com/blog/improving-the-reliability-of-cadence-search-queries/&title=&summary=Improving%20the%20Reliability%20of%20Cadence%20Search%20Queries%20That%20Use%20OpenSearch/Elasticsearch&source=) 

Originally developed and open sourced by Uber, Cadence® is a workflow engine that greatly simplifies the development of complex, long-running automated business processes at scale. Cadence needs to use OpenSearch/Elasticsearch when the *Advanced Visibility* feature is turned on. However, some default configurations in Cadence are chosen more for ease of setup than robust production operations. This blog post walks through one such setting that Instaclustr tunes when provisioning a Cadence cluster to ensure production reliability of your Cadence architecture.

To enable the *Advanced Visibility* feature on a Cadence cluster, an index that has a naming pattern like ***cadence-visibility-****xxxxx* needs to be created on the OpenSearch/Elasticsearch cluster. This is achieved in 2 steps:

1. Creating an index template by using the schema file (called **index\_template.json**) provided by Cadence.
2. Creating the actual index by using the index template created in Step 1. Note, the index name must have the prefix ***cadence-visibility-***.

 The above 2 steps can be achieved by issuing 2 cURL commands demonstrated by the following code snippet (Snippet A):































SCHEMA\_FILE=$CADENCE\_HOME/schema/elasticsearch/$version/visibility/index\_template.json URL="https://$host:$port/\_template/cadence-visibility-template" curl -X PUT $URL -H 'Content-Type: application/json' --data-binary "@$SCHEMA\_FILE" URL="https://$host:$port/cadence-visibility-production" curl -X PUT $URL

   1

2

3

4

5

6

7

8

9

10

11

12

13



  SCHEMA\_FILE=$CADENCE\_HOME/schema/elasticsearch/$version/visibility/index\_template.json







URL="https://$host:$port/\_template/cadence-visibility-template"



curl -X PUT $URL -H 'Content-Type: application/json' --data-binary "@$SCHEMA\_FILE"







URL="https://$host:$port/cadence-visibility-production"



curl -X PUT $URL



   

 

 Closer inspection of the **index\_template.json** file shows that the required index has the number of replicas set to 0, i.e.:































..................... "settings": { "index": { "number\_of\_shards": "5", "number\_of\_replicas": "0" } } ......................

   1

2

3

4

5

6

7

8

9

10

11

12

13

14

15



  .....................



"settings": {



  "index": {



  "number\_of\_shards": "5",



  "number\_of\_replicas": "0"



  }



}



......................



   

 

 The number of shards on an index determines how it can be distributed across the cluster. An index with 1 shard can only be stored on 1 node. An index with 5 shards could be split across 5 nodes. The number of replicas on an index determines how resilient that index is. OpenSearch/Elasticsearch will spread replicas across different nodes in the cluster.

If an index has zero replicas, stopping a node in the cluster will likely cause some documents to become unavailable (if that node holds shards for that index). This can lead to failure of Cadence search queries via the CLI or via Cadence Web. If the node goes down permanently, i.e., due to disk failure, some data for the index will be permanently lost.

If an index has at least 1 replica, then stopping a node in the cluster will not cause documents to become unavailable. Replicas take up about as much disk space as the original shard and have some performance overhead. However, if the availability of your data is at all important, it usually makes sense to have at least 1 replica. This high availability of data will, in turn, improve the reliability of the search queries made via Cadence CLI and Cadence Web.

To update this setting, i.e., set the number of replicas to 1, the following cURL command can be issued immediately after executing Snippet A:































URL="https://$host:$port/cadence-visibility-production/\_settings" curl -X PUT $URL -H 'Content-Type: application/json' -d '{ "index": { "number\_of\_replicas" : "1" } }'

   1

2

3



  URL="https://$host:$port/cadence-visibility-production/\_settings"



curl -X PUT $URL -H 'Content-Type: application/json' -d '{ "index": { "number\_of\_replicas" : "1" } }'



   

 

 All of Instaclustr’s managed Cadence offerings automatically have this configuration applied.

Try it out with a free trial.

[Sign Up](https://console2.instaclustr.com/signup?)

 

 

 

### About the author

**[Rony Rahman](https://www.instaclustr.com/blog/author/rony-rahman/)** | Lead Software Engineer

Rony is a Lead software engineer at Instaclustr. He is based in Canberra, Australia.

 



 

 ![mail icon]()#### Get the latest articles for open sourceIn your inbox

 <a class="btn btn-primary btn-popup text-dark" href="">Sign up now</a> 

 

 

 

  ### Related content

 [ AWS PrivateLink for Cadence on Instaclustr by NetApp 

 

 Instaclustr has released AWS PrivateLink support for connecting to managed Cadence Workflow clusters... 

 

 

 

 

 

 

 ](https://www.instaclustr.com/blog/aws-privatelink-for-cadence-on-instaclustr-by-netapp/) 

 [ Airflow vs Cadence: A Side-by-Side Comparison 

 

 Apache Airflow and Cadence are both workflow management ecosystems, it is important for developers to know which solutions are ... 

 

 

 

 

 

 

 ](https://www.instaclustr.com/blog/airflow-vs-cadence-a-side-to-side-comparison/) 

 [ Building With Cadence®: Quantifiable Efficiency? 

 

 Discover quantifiable efficiency in software development with Cadence. Explore Instaclustr's guide on building with this ... 

 

 

 

 

 

 

 ](https://www.instaclustr.com/blog/building-with-cadence-quantifiable-efficiency/) 

 

  <a class="close-modal" href="">×</a>Sign upto ourNewsletter
-----------------------
