LogoLogo
English
English
  • Diarkis Help Center
  • Overview of Diarkis
  • Getting Started
    • Diarkis Server Template
    • Diarkis Client SDK
    • Tutorials
      • 1. Launch Diarkis Server in Local Environment
      • 2. Perform Connectivity Check with Test Client
      • 3. Implement Custom Command
      • Connect to Server from Diarkis Client
    • Samples
  • Diarkis Modules
    • Room Module
      • Set Up Room Module on Server
      • Room Sample
        • room_broadcast
      • Utilizing Room Module from Client
      • Additional Features of Room
    • MatchMaker Module
      • Set Up MatchMaker Module on Server
    • Field Module
      • Set Up Field Module on Server
    • P2P Module
      • Set Up P2P Module on Server
      • P2P Sample
    • DM (Direct Message) Module
      • Set Up DM Module on Server
    • Notifier Module
      • Set Up Notifier Module on Server
    • Session Module
      • Set Up Session Module on Server
    • Group Module
      • Set Up Group Module on Server
  • Diarkis Server
    • Launch Diarkis Server in Cloud Environment
      • AWS
    • Launch Diarkis Server on Windows Environment
    • MARS Server
    • UDP Server
    • TCP Server
    • HTTP Server
    • Metrics API
    • Inter-server Communication - Mesh
  • Diarkis Client
    • Runtime Library
      • Diarkis RUDP
    • Diarkis Module
      • Initialization and Termination of Diarkis Module
      • Customization of Diarkis Module
      • Logging System of Diarkis Module
      • Migration
      • Threads of Diarkis
    • Samples
      • C++
        • room_broadcast
        • directmessage_simple
        • group_sample
        • matching_and_turn
        • matchmaker_ticket
        • p2p_rudp_sample
        • session_simple
      • Unreal Engine Plugin
        • FieldWalker
      • Unity Plugin
        • FieldWalker
          • HowToReplicatePosition.md
  • Diarkis Tools
    • Diarkis CLI
      • Procedures to Switch to Diarkis CLI v3
  • References
    • API Reference
    • Release Notes
      • v1.0
      • v1.0.1
      • v1.0.2
      • v1.0.3
      • v1.0.4
      • v1.0.5
      • v1.0.6
  • Support
    • License and Billing
Powered by GitBook
On this page
  • Overview
  • What is Migration?
  • Overall Flow of the Migration Process
  • Client Response During Migration

Was this helpful?

  1. Diarkis Client
  2. Diarkis Module

Migration

PreviousLogging System of Diarkis ModuleNextThreads of Diarkis

Last updated 2 months ago

Was this helpful?

Overview

This page describes the behavior of migration on Diarkis servers.

What is Migration?

Diarkis servers are configured in a cluster, and users connect to one of these servers. Consider a scenario where the connected Diarkis server is scaled in and the server to which the user is connected is shut down. For a typical server, users connected at that time would be disconnected because the server stops. However, Diarkis servers can move within the cluster, allowing users to continue receiving services without disconnection. This mechanism, where the service is maintained by reconnecting from the server currently connected to another server, is called migration.

While we explained it using the example of scaling-in for simplicity, migration can occur due to various factors besides scaling-in. When migration occurs, the server and client application need to collaboratively proceed through the migration process. The following sections explain the specific processes when migration occurs.

If you are participating in a Room, please do not use the features below and refer to the .

Overall Flow of the Migration Process

Migration begins with a notification from the server. When the server determines that migration is necessary due to various factors, it notifies the client of the need for migration, triggering DiarkisTcpBase::OnOffline/DiarkisUdpBase::OnOffline(). Upon receiving this event, which indicates that migration is necessary, the client executes DiarkisTcpBase::SendMigrate()/DiarkisUdpBase::SendMigrate() to request the initiation of migration from the server. Once the server receives the migration request, it disconnects the requesting client, moves the user's data on the server to a new server, and the client reconnects to the new server. These processes are undertaken during migration.

Client Response During Migration

As explained in the previous section, on the client side, after receiving DiarkisTcpBase::OnOffline/DiarkisUdpBase::OnOffline(), it is necessary to proceed with the migration process by executing DiarkisTcpBase::SendMigrate()/DiarkisUdpBase::SendMigrate().

In the sample provided with the SDK, SendMigrate() is implemented to be called immediately after OnOffline() is triggered, as shown below:

void DiarkisTcp::OnOffline()
{
    DiarkisTcpBase::OnOffline();

    // Due to server scaling-in, the connected server will go offline.
    // Invoke SendMigrate at an appropriate timing that matches the application's implementation to perform server migration.
    this->SendMigrate();
}
void DiarkisUdp::OnOffline()
{
    DiarkisUdpBase::OnOffline();

    // Due to server scaling-in, the connected server will go offline.
    // Invoke SendMigrate at an appropriate timing that matches the application's implementation to perform server migration.
    this->SendMigrate();
}

Note that when executing DiarkisTcpBase::SendMigrate()/DiarkisUdpBase::SendMigrate(), the reconnection process starts, temporarily disabling communication as the connection to the server is disconnected briefly. The timing of disconnection can be controlled by the timing of executing DiarkisTcpBase::SendMigrate()/DiarkisUdpBase::SendMigrate(), so please adjust it according to your application's needs.

Room-specific migration