📃
Tech White Papers
  • 📃White Papers
  • 🪶Apache
    • Kafka (EN)
      • Kafka Connect
      • Kafka Streams
      • ksqlDB
    • Ignite (TR)
      • Clustering
        • Baseline Topology
      • Thin Clients
      • Data Modeling
        • Data Partitioning
        • Affinity Colocation
      • Memory Architecture
      • Persistence
        • External Storage
        • Swapping
        • Snapshot
        • Disk Compression
        • Persistence Tuning
        • Change Data Capture
      • Cluster Snapshots
      • Data Rebalancing
      • Data Streaming
      • Using Key-Value API
        • Basic Cache Operations
        • Working With Binary Objects
      • Performing Transactions
      • Working with SQL
        • Understanding Schemas
        • Defining Indexes
        • Distributed Joins
      • Distributed Computing
      • Machine Learning
      • Using Continuous Queries
      • Using Ignite Messaging
      • .NET Specific
        • LINQ
        • Serialization
      • Working With Events
        • Events
      • Performance and Troubleshooting
        • Generic Performance Tips
        • Memory and JVM Tuning
        • Persistence Tuning
        • SQL Performance Tuning
        • Thread Pools Tuning
    • Pulsar (TR)
  • 📜Data
    • ClickHouse (TR)
    • QuestDB (TR)
  • Comparison
    • Pulsar vs Kafka
    • ClickHouse vs QuestDB
  • Architectural
    • Microservices
      • Design Principles
      • Design Patterns
Powered by GitBook
On this page
  • Configuring Rebalance Thread Pool
  • Rebalance Message Throttling

Was this helpful?

  1. Apache
  2. Ignite (TR)

Data Rebalancing

03/02/2023

Cluster’a yeni bir node katıldığında, bazı partitionlar yeni node’a taşınır, böylece veriler clusterda eşit olarak dağılmış halde kalır. Bu işleme data rebalancing denir.

Mevcut bir node clusterdan kalıcı olarak ayrılırsa ve yedeklemeler yapılandırılmazsa, bu nodeda depolanan partitionlar kaybedilir. Yedeklemeler yapılandırıldığında, kaybolan partitionların yedek kopyalarından biri birincil bölüm haline gelir ve rebalancing işlemi başlatılır. Rebalancing, cache başına yapılandırılır.

Data rebalancing, Baseline Topolojideki değişiklikler tarafından tetiklenir. Saf in-memory clusterlarda, varsayılan davranış, bir node clusterdan ayrıldığında veya clustera katıldığında hemen rebalancing başlamaktır (baseline topoloji otomatik olarak değişir). Persistence içeren clusterlarda baseline topolojinin manuel olarak değiştirilmesi gerekir (varsayılan davranış) veya baseline autoadjustment ayarı etkinleştirildiğinde otomatik olarak değiştirilebilir.

Ignite hem senkronize(synchronous) hem de asenkron(asynchronous) rebalancing destekler. Senkron modda, rebalancing tamamlanana kadar cache verileri üzerindeki herhangi bir işlem engellenir. Asenkron modda, rebalancing işlemi asenkron olarak yapılır. Belirli bir cache için reabalancing de devre dışı bırakılabilir.

Rebalancing modunu değiştirmek için cache yapılandırmasında aşağıdaki değerlerden bir ayarlanabilir;

  • SYNC → Senkron rebalancing modu. Bu modda, cache ortak API'sine yapılan herhangi bir çağrı, rebalancing tamamlanana kadar engellenir.

  • ASYNC → Asenkron rebalancing modu. Dağıtık cacheler hemen kullanılabilir ve arka planda diğer kullanılabilir cluster nodelarından gerekli tüm verileri yükler.

  • NONE → Bu modda rebalancing gerçekleşmez; bu, cachelerin ya verilere her erişildiğinde kalıcı depolamadan talep üzerine yüklenmesi ya da direkt doldurulması anlamına gelir.

⌨️ XML Config
<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

       <http://www.apache.org/licenses/LICENSE-2.0>

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<beans xmlns="<http://www.springframework.org/schema/beans>" xmlns:util="<http://www.springframework.org/schema/util>" xmlns:xsi="<http://www.w3.org/2001/XMLSchema-instance>" xsi:schemaLocation="         <http://www.springframework.org/schema/beans>         <http://www.springframework.org/schema/beans/spring-beans.xsd>         <http://www.springframework.org/schema/util>         <http://www.springframework.org/schema/util/spring-util.xsd>">
    <bean class="org.apache.ignite.configuration.IgniteConfiguration" id="ignite.cfg">
        <property name="cacheConfiguration">
            <list>
                <bean class="org.apache.ignite.configuration.CacheConfiguration">
                    <property name="name" value="mycache"/>
                    <!-- enable synchronous rebalance mode -->
                    <property name="rebalanceMode" value="SYNC"/>
                </bean>
            </list>
        </property>
    </bean>
</beans>
⌨️ .NET Config
IgniteConfiguration cfg = new IgniteConfiguration
{
    CacheConfiguration = new[]
    {
        new CacheConfiguration
        {
            Name = "mycache",
            RebalanceMode = CacheRebalanceMode.Sync
        }
    }
};

// Start a node.
var ignite = Ignition.Start(cfg);

Configuring Rebalance Thread Pool

Varsayılan olarak, rebalancing her node’da bir iş parçacığında gerçekleştirilir. Bu, zamanın her noktasında batchleri bir node’dan diğerine aktarmak veya remote node’dan gelen batchleri işlemek için yalnızca bir thread’in kullanıldığı anlamına gelir.

Sistem thread pool’undan alınan ve rebalancing için kullanılan thread sayısı arttırılabilir. Bir node’un remote bir node’a toplu veri göndermesi veya remote nodedan gelen bir batch’i işlemesi gerektiğinde pooldan bir sistem thread’i alınır. Batch işlendikten sonra thread serbest bırakılır.

⌨️ XML Config
<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

       <http://www.apache.org/licenses/LICENSE-2.0>

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<beans xmlns="<http://www.springframework.org/schema/beans>" xmlns:util="<http://www.springframework.org/schema/util>" xmlns:xsi="<http://www.w3.org/2001/XMLSchema-instance>" xsi:schemaLocation="         <http://www.springframework.org/schema/beans>         <http://www.springframework.org/schema/beans/spring-beans.xsd>         <http://www.springframework.org/schema/util>         <http://www.springframework.org/schema/util/spring-util.xsd>">
    <bean class="org.apache.ignite.configuration.IgniteConfiguration" id="ignite.cfg">

        <property name="rebalanceThreadPoolSize" value="4"/>

        <property name="cacheConfiguration">
            <list>
                <bean class="org.apache.ignite.configuration.CacheConfiguration">
                    <property name="name" value="mycache"/>
                </bean>
            </list>
        </property>
    </bean>
</beans>

Rebalance Message Throttling

Veriler bir nodedan diğerine aktarıldığında, tüm veri seti batchlere bölünür ve her batch ayrı bir mesajla gönderilir. Batch boyutu ve node’un mesajlar arasında bekleyeceği süre aşağıdaki gibi yapılandırılabilir;

⌨️ XML Config
<?xml version="1.0" encoding="UTF-8"?>
<!--
  Licensed to the Apache Software Foundation (ASF) under one or more
  contributor license agreements.  See the NOTICE file distributed with
  this work for additional information regarding copyright ownership.
  The ASF licenses this file to You under the Apache License, Version 2.0
  (the "License"); you may not use this file except in compliance with
  the License.  You may obtain a copy of the License at

       <http://www.apache.org/licenses/LICENSE-2.0>

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
-->
<beans xmlns="<http://www.springframework.org/schema/beans>" xmlns:util="<http://www.springframework.org/schema/util>" xmlns:xsi="<http://www.w3.org/2001/XMLSchema-instance>" xsi:schemaLocation="         <http://www.springframework.org/schema/beans>         <http://www.springframework.org/schema/beans/spring-beans.xsd>         <http://www.springframework.org/schema/util>         <http://www.springframework.org/schema/util/spring-util.xsd>">
    <bean class="org.apache.ignite.configuration.IgniteConfiguration" id="ignite.cfg">
        <property name="cacheConfiguration">
            <list>
                <bean class="org.apache.ignite.configuration.CacheConfiguration">
                    <property name="name" value="mycache"/>
                    <!-- Set batch size. -->
                    <property name="rebalanceBatchSize" value="#{2 * 1024 * 1024}"/>
                    <!-- Set throttle interval. -->
                    <property name="rebalanceThrottle" value="100"/>
                </bean>
            </list>
        </property>
    </bean>
</beans>
⌨️ .NET Config
IgniteConfiguration cfg = new IgniteConfiguration
{
    CacheConfiguration = new[]
    {
        new CacheConfiguration
        {
            Name = "mycache",
            RebalanceBatchSize = 2 * 1024 * 1024,
            RebalanceThrottle = new TimeSpan(0, 0, 0, 0, 100)
        }
    }
};

// Start a node.
var ignite = Ignition.Start(cfg);
PreviousCluster SnapshotsNextData Streaming

Last updated 2 years ago

Was this helpful?

🪶
Detaylı bilgi için…