Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Table of Contents
minLevel1
maxLevel2
outlinefalse
styledisc
typelist
printabletrue

Overview

With Swarm 16.1.2 and Gateway 8.1.0, we introduced a new feature called “Per Domain Index”. We can now store metadata from each domain in separate indices within our Elasticsearch database. This feature allows for more efficient searching, querying, and retrieval of objects within a specific domain. It is enabled by settingsearch.perDomainIndex=Truebefore creating a search feed. You can enable this setting using any of the following options:

  • scsctl
    scsctl storage config set -d "search.perDomainIndex=true"
    scsctl storage config set -d "search.numberOfShards=5"

  • swarmctl
    swarmctl -C search.perDomainIndex -V 1 -a -p username:password

  • Storage UI

    image-20241003-114210.pngImage Added

Data in Elasticsearch is organized into indices. Each index is made up of one or more shards. Each shard is an instance of a Lucene index, which you can think of as a self-contained search engine that indexes and handles queries for a subset of the data in an Elasticsearch cluster.

...

With Per Domain Index (PDI), customers are separated by different domains and use distinct indices. As a result, the latency for each domain is directly related to the number of documents in its respective index, allowing for more efficient performance management.

Info

Note

This should only be enabled with Support guidance. The number of domains that the Swarm cluster supports, is limited due to limitations to the number of shards per Elasticsearch node.

Prerequisites

  • Gateway 8.1.0 or higher

  • Swarm Storage 16.1.2 or higher

Hardware Sizing

  • Shard Size: Recommended shard size is between 20 GB and 50 GB.

  • Shard Alignment: Align the number of shards with the number of nodes (shards should be a multiple of nodes).

  • Heap Size: Maximum heap size of 30.5 GB per node.

  • Shard Capacity: A node can handle up to 30.5 GB heap * 20 shards per GB of heap, resulting in a maximum of approximately 600 shards per node.

  • Elastic Limit: Elasticsearch has a default maximum shard limit of 1,000 per node. It is advisable to stay below 600 shards per node for optimal performance.

How to Implement/Enable in Production

Implementing PDI requires the following configurations:

  • Set search.numberOfShards = 5 to optimize performance and avoid exceeding the 600 shards per Elasticsearch node limit.

  • Set search.perDomainIndex = True in the cluster configuration before creating the Search Feed.

  • Create a new search feed and make it default. Once the search feed is 100% indexed, it will automatically create separate indices for each domain. For example, index_clustername_feedid_domainUUID.

Implementing Per Domain Index (PDI) Without Downtime

  1. Keep the new search feed index at 100% after PDI is enabled: When enabling PDI, a new set of indices is created, each corresponding to a specific domain. The new search feed means data being indexed with the new search feed targeting particular ES nodes. The new search feed need needs to be fully populated (100%) before switching to those indices. This means that all documents should be contexts and objects are indexed without any gaps or missing data.

  2. Once completed, set the new search feed as the default: When the search feed is 100%, make it defaultremember to verify indexerHosts in gateway.cfg and restart Gateways whenever the default Search Feed is changed. Now, the cluster is ready to list as per PDI. This switch should be seamless to ensure that users experience no disruption.

  3. Clean up the previous index (created without PDI) as needed: The old index stored data without per-domain segregation , is now redundant. Cleaning it up can free up resources and reduce storage costs.

Implementing Per Domain Index (PDI) With Downtime

  1. Set the new search feed as the default after enabling PDI: If downtime is acceptable, the process is simpler. You can immediately switch to the new search feed after enabling PDI, even if they are not fully populated. Users will experience downtime or incomplete search results until reindexing is complete.

  2. The new index will be temporarily unavailable for listing: During reindexing, the new domain indices may not be fully operational. Users may experience missing or incomplete data in search results.

  3. Listing will resume after the new search feed reaches 100% completion: Once the reindexing is complete, the search functionality will return to full capacity with complete and accurate listings.

Disabling Per Domain Index

  1. Set search.perDomainIndex = False and delete the associated Search Feed: To disable PDI, switch the configuration setting that enables search.perDomainIndex to False. This setting controls whether the system next Search Feed that is created should use per-domain indices or not. After disabling, delete all per-domain search feeds to delete all the per-domain indices.

  2. All Per Domain Indices will be removed, leaving a single index operational: After disabling PDI, the system will revert to using a single index for all domains. This simplifies data management but loses the benefits of domain-specific indexing.The number of shards will remain unchanged, so there won’t be any issues with single indexing: The shard count configuration is typically set at the cluster level and does not change when switching from PDI to a single index. This ensures that the system’s capacity for handling search queries remains stable.

Limitations

  • Increased Complexity: Managing multiple indexes can complicate the architecture of the search engine or database system. It requires more sophisticated algorithms and infrastructure to handle indexing and searching across domains.

  • Resource Intensive: Each index requires storage space and processing power. Maintaining multiple indexes can lead to higher resource consumption, increasing costs for hardware, maintenance, and energy.

  • Index Synchronization: Keeping indexes up-to-date across multiple domains can be challenging. Changes in the data must be reflected in all relevant indexes, which can introduce delays or errors.Search Performance: While Per Domain Index can improve search performance for specific queries, it may degrade overall performance when a query spans multiple domains. This can result in longer query times as the system needs to aggregate results from various indexes.

  • Scalability Issues: As the number of domains increases, scaling the infrastructure to support numerous indexes can become difficult. Performance may suffer if not properly managed.

How to Determine PDI is Working

Search Feed Schema

Code Block
languagebash
curl -X GET "http://ESNODE:9200/index_{CLUSTERNAME}{feed-id}*/_mappings?pretty"

...