KR102294048B1 - Method and system for replicating blockchain application service - Google Patents

Method and system for replicating blockchain application service Download PDF

Info

Publication number
KR102294048B1
KR102294048B1 KR1020200036888A KR20200036888A KR102294048B1 KR 102294048 B1 KR102294048 B1 KR 102294048B1 KR 1020200036888 A KR1020200036888 A KR 1020200036888A KR 20200036888 A KR20200036888 A KR 20200036888A KR 102294048 B1 KR102294048 B1 KR 102294048B1
Authority
KR
South Korea
Prior art keywords
user request
server
key
reader
log
Prior art date
Application number
KR1020200036888A
Other languages
Korean (ko)
Inventor
이명준
권민호
Original Assignee
울산대학교 산학협력단
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 울산대학교 산학협력단 filed Critical 울산대학교 산학협력단
Priority to KR1020200036888A priority Critical patent/KR102294048B1/en
Application granted granted Critical
Publication of KR102294048B1 publication Critical patent/KR102294048B1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2365Ensuring data consistency and integrity
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1027Persistence of sessions during load balancing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

Disclosed are a method for replicating a blockchain application service to recover a service state and a system thereof. According to one embodiment of the present invention, the method comprises the following steps: checking whether a value related to any one of a server state change, server state maintenance, and log record is included in a header of a user request when the user request related to a blockchain application service is received from a client; when the value is included, confirming that the user request satisfies a storage condition; reading a log size for the total number of stored log entries from a first key-value distributed repository connected to a reader server among key-value distributed repository connected to a plurality of servers executing block chain application services, respectively; calculating a storage location of the user request by using the log size; storing the user request in the first key-value distributed repository by associating the user request to the storage location as a log entry; and responding to the client by processing the user request stored in the first key-value distributed repository through the reader server.

Description

블록체인 응용서비스의 복제 실행 방법 및 블록체인 응용서비스의 복제 실행 시스템{METHOD AND SYSTEM FOR REPLICATING BLOCKCHAIN APPLICATION SERVICE}The replication execution method of the blockchain application service and the replication execution system of the blockchain application service

본 발명은 블록체인 응용서비스의 복제 실행 기법에 연관되며, 보다 특정하게는 복제된 블록체인 응용서비스 간 지속적인 동기화 및 복구 기능을 통한 재난 상황에서의 블록체인 서비스의 안전성 향상에 연관된다.The present invention is related to the replication execution technique of the blockchain application service, and more specifically, it is related to the improvement of the safety of the blockchain service in a disaster situation through the continuous synchronization and recovery function between the replicated blockchain application services.

블록체인 기술은 비트코인과 같은 전자화폐의 기반 기술로 시작되었으나, 지금은 공공기관이나 금융, 의학, 행정과 같이 데이터의 신뢰성이 중요한 산업 분야로 급속히 확장되어 있다.Blockchain technology started as a basic technology for electronic money such as Bitcoin, but now it is rapidly expanded to industries where data reliability is important, such as public institutions, finance, medicine, and administration.

한편 지진이나 홍수, 테러와 같은 각종 재난이나 해킹 공격으로 인해 블록체인 기반의 응용서비스가 파괴되어 서비스 실패가 발생할 경우, 그로 인한 부작용을 예측하기 어려우며 복구하는데 막대한 비용이 소요될 수 있다.On the other hand, when a service failure occurs due to the destruction of blockchain-based application services due to various disasters such as earthquakes, floods, and terrorism or hacking attacks, it is difficult to predict the side effects and it may cost a lot to recover.

하지만 현재까지 블록체인 응용서비스의 견고한 실행 및 서비스 실패의 복구를 위한 체계적인 연구는 거의 이루어지고 있지 않은 실정이다.However, until now, systematic research for the robust execution of blockchain application services and recovery of service failures has not been conducted.

이에 따라 장애나 결함에도 지속적인 서비스를 제공할 수 있도록, 블록체인 응용서비스의 견고한 실행을 보장하기 위한 서비스 복제 기법이 절실히 요구되고 있다.Accordingly, there is an urgent need for a service replication technique to ensure the robust execution of blockchain application services so that continuous service can be provided even in the face of failures or defects.

본 발명의 실시예는 키-값 분산저장소를 통해, 복수의 서버에 분산되어 실행되는 복제된 블록체인 응용서비스 간 지속적인 동기화를 실시하여, 재난 상황에서도 블록체인 응용서비스를 안정적으로 실행하는 것을 목적으로 한다.An embodiment of the present invention is to perform continuous synchronization between replicated blockchain application services distributed and executed on a plurality of servers through a key-value distributed storage, thereby stably executing the blockchain application service even in a disaster situation. do.

본 발명의 실시예는 이더리움 블록체인의 스마트 컨트랙트를 이용해 설계한 서비스 레지스트리를 통해, 블록체인 속에서 서비스의 정보를 관리하고, 서비스 접근 위치 및 복구 요청 기능을 제공하여, 복제된 블록체인 응용서비스의 보다 견고한 실행을 보장하는 것을 목적으로 한다.The embodiment of the present invention manages service information in the block chain through a service registry designed using smart contracts of the Ethereum block chain, and provides a service access location and recovery request function, thereby providing a duplicated block chain application service It aims to ensure a more robust implementation of

본 발명의 일실시예에 따른 블록체인 응용서비스의 복제 실행 방법은, 클라이언트로부터, 블록체인 응용서비스와 연관된 사용자 요청이 수신됨에 따라, 상기 사용자 요청의 헤더 내에, 서버의 상태 변경, 서버의 상태 유지 및 로그용 기록 중 어느 하나와 연관된 값이 포함되어 있는지 확인하는 단계와, 상기 값이 포함되어 있으면, 상기 사용자 요청이 저장 조건을 만족하는 것으로 확인하는 단계와, 상기 블록체인 응용서비스를 실행하는 복수의 서버에 각각 연결되는 키-값 분산저장소 중, 리더 서버와 연결된 제1 키-값 분산저장소로부터, 저장된 로그 엔트리의 총 개수에 관한 로그 사이즈를 리드하는 단계와, 상기 로그 사이즈를 이용하여, 상기 사용자 요청의 저장 위치를 계산하는 단계와, 상기 사용자 요청을, 로그 엔트리로서 상기 저장 위치에 연관시켜 상기 제1 키-값 분산저장소에 저장하는 단계, 및 상기 제1 키-값 분산저장소에 저장한 상기 사용자 요청을 상기 리더 서버를 통해 처리하여, 상기 클라이언트에 응답하는 단계를 포함할 수 있다.In the method for executing replication of a blockchain application service according to an embodiment of the present invention, as a user request related to a blockchain application service is received from a client, in the header of the user request, the state of the server is changed, and the state of the server is maintained. and checking whether a value related to any one of the log records is included. If the value is included, confirming that the user request satisfies the storage condition; reading a log size for the total number of stored log entries from a first key-value distributed storage connected to a reader server among key-value distributed storages respectively connected to servers of calculating a storage location of a user request; storing the user request in the first key-value distributed repository by associating the user request with the storage location as a log entry; and storing the user request in the first key-value distributed repository. and responding to the client by processing the user request through the reader server.

또한, 본 발명의 실시예에 따른 블록체인 응용서비스의 복제 실행 시스템은, 클라이언트로부터, 블록체인 응용서비스와 연관된 사용자 요청이 수신됨에 따라, 상기 사용자 요청의 헤더 내에, 서버의 상태 변경, 서버의 상태 유지 및 로그용 기록 중 어느 하나와 연관된 값이 포함되어 있는지 확인하고, 상기 값이 포함되어 있으면, 상기 사용자 요청이 저장 조건을 만족하는 것으로 확인하는 판단부와, 상기 블록체인 응용서비스를 실행하는 복수의 서버에 각각 연결되는 키-값 분산저장소 중, 리더 서버와 연결된 제1 키-값 분산저장소로부터, 저장된 로그 엔트리의 총 개수에 관한 로그 사이즈를 리드하고, 상기 로그 사이즈를 이용하여, 상기 사용자 요청의 저장 위치를 계산하고, 상기 사용자 요청을, 로그 엔트리로서 상기 저장 위치에 연관시켜 상기 제1 키-값 분산저장소에 저장하는 저장부, 및 상기 제1 키-값 분산저장소에 저장한 상기 사용자 요청을 상기 리더 서버를 통해 처리하여, 상기 클라이언트에 응답하는 처리부를 포함할 수 있다.In addition, the replication execution system of the block chain application service according to the embodiment of the present invention, as a user request related to the block chain application service is received from the client, in the header of the user request, the state of the server changes, the state of the server A judging unit that checks whether a value related to any one of maintenance and log records is included, and if the value is included, a determination unit that confirms that the user request satisfies the storage condition; reads the log size for the total number of stored log entries from the first key-value distributed storage connected to the reader server among the key-value distributed storages connected to the servers of a storage unit that calculates a storage location of may include a processing unit that processes the data through the reader server and responds to the client.

본 발명의 일실시예에 따르면, 클라이언트로부터의 사용자 요청을 키-값 분산저장소에 저장한 이후에 리더 서버에 의해 처리하도록 하고, 재난 상태로 인해 현재 서비스를 제공하는 리더 서버가 실행되지 않을 때, 상태를 동기화하고 있던 복수의 서버 중에 새로운 리더 서버를 키-값 분산저장소를 통해 선출하고 그 새로운 리더 서버가 서비스를 이어나가도록 함으로써, 장애나 결함 속에서도 복사된 서버로 대처하여 지속적으로 서비스를 재개하거나, 모든 서버가 서비스 상태를 잃어버렸다고해도, 키-값 분산저장소에 저장되어 있는 로그 엔트리를 독출하여 서비스 상태를 복구할 수 있다.According to one embodiment of the present invention, the user request from the client is stored in the key-value distributed storage and then processed by the reader server, and when the reader server providing the current service is not running due to a disaster state, A new leader server is elected through a key-value distributed storage among multiple servers that are synchronizing status, and the new leader server continues the service. , even if all servers lose the service state, the service state can be restored by reading the log entry stored in the key-value distributed storage.

본 발명의 일실시예에 따르면, 스마트 컨트랙트를 통해 설계한 서비스 레지스트리를 이용하여, 블록체인 속에서 서비스의 정보를 관리하고, 서비스의 접근 위치를 수정하거나, 수정된 서비스의 접근 위치를 확인하는 기능을 제공함으로써, 재난 상태가 복구되어 서비스 재개되었을 때 처리가 중단된 사용자 요청을 새로운 리더 서버에서 이어서 처리하게 할 수 있다.According to an embodiment of the present invention, using a service registry designed through a smart contract, a function to manage service information in a block chain, modify the access location of the service, or check the access location of the modified service By providing this, when the disaster state is restored and the service is resumed, the user request whose processing was interrupted can be continuously processed by the new leader server.

도 1은 본 발명의 일실시예에 따른 블록체인 응용서비스의 복제 실행 시스템에서, 블록체인 응용서비스의 복제(Replication) 기법을 도시한 도면이다.
도 2는 본 발명의 일실시예에 따른 블록체인 응용서비스의 복제 실행 시스템에서, 서비스 레지스트리(Service Registry)의 구조를 도시한 도면이다.
도 3는, 도 2에 도시된 서비스 레지스트리를 이용한 블록체인 응용서비스의 복제 기법을 도시한 도면이다.
도 4는 본 발명의 일실시예에 따른 블록체인 응용서비스의 복제 실행 시스템에서, 복제한 블록체인 응용서비스가 동작하는 환경을 도시한 도면이다.
도 5는 본 발명의 일실시예에 따른 블록체인 응용서비스의 복제 실행 시스템의 구성을 도시한 블록도이다.
도 6 내지 도 9는 본 발명의 일실시예에 따른 블록체인 응용서비스의 복제 실행 방법의 순서를 도시한 흐름도이다.
1 is a diagram illustrating a replication technique of a block chain application service in a system for executing replication of a block chain application service according to an embodiment of the present invention.
2 is a diagram showing the structure of a service registry in the replication execution system of the block chain application service according to an embodiment of the present invention.
FIG. 3 is a diagram illustrating a replication technique of a blockchain application service using the service registry shown in FIG. 2 .
4 is a diagram illustrating an environment in which the duplicated blockchain application service operates in the system for executing the replication of the blockchain application service according to an embodiment of the present invention.
5 is a block diagram showing the configuration of a replication execution system of a block chain application service according to an embodiment of the present invention.
6 to 9 are flowcharts illustrating a sequence of a method for executing replication of a block chain application service according to an embodiment of the present invention.

이하에서, 첨부된 도면을 참조하여 실시예들을 상세하게 설명한다. 그러나, 실시예들에는 다양한 변경이 가해질 수 있어서 특허출원의 권리 범위가 이러한 실시예들에 의해 제한되거나 한정되는 것은 아니다. 실시예들에 대한 모든 변경, 균등물 내지 대체물이 권리 범위에 포함되는 것으로 이해되어야 한다.Hereinafter, embodiments will be described in detail with reference to the accompanying drawings. However, since various changes may be made to the embodiments, the scope of the patent application is not limited or limited by these embodiments. It should be understood that all modifications, equivalents and substitutes for the embodiments are included in the scope of the rights.

실시예에서 사용한 용어는 단지 설명을 목적으로 사용된 것으로, 한정하려는 의도로 해석되어서는 안된다. 단수의 표현은 문맥상 명백하게 다르게 뜻하지 않는 한, 복수의 표현을 포함한다. 본 명세서에서, "포함하다" 또는 "가지다" 등의 용어는 명세서 상에 기재된 특징, 숫자, 단계, 동작, 구성요소, 부품 또는 이들을 조합한 것이 존재함을 지정하려는 것이지, 하나 또는 그 이상의 다른 특징들이나 숫자, 단계, 동작, 구성요소, 부품 또는 이들을 조합한 것들의 존재 또는 부가 가능성을 미리 배제하지 않는 것으로 이해되어야 한다.The terms used in the examples are used for description purposes only, and should not be construed as limiting. The singular expression includes the plural expression unless the context clearly dictates otherwise. In the present specification, terms such as “comprise” or “have” are intended to designate that a feature, number, step, operation, component, part, or combination thereof described in the specification exists, but one or more other features It should be understood that this does not preclude the existence or addition of numbers, steps, operations, components, parts, or combinations thereof.

다르게 정의되지 않는 한, 기술적이거나 과학적인 용어를 포함해서 여기서 사용되는 모든 용어들은 실시예가 속하는 기술 분야에서 통상의 지식을 가진 자에 의해 일반적으로 이해되는 것과 동일한 의미를 가지고 있다. 일반적으로 사용되는 사전에 정의되어 있는 것과 같은 용어들은 관련 기술의 문맥 상 가지는 의미와 일치하는 의미를 가지는 것으로 해석되어야 하며, 본 출원에서 명백하게 정의하지 않는 한, 이상적이거나 과도하게 형식적인 의미로 해석되지 않는다.Unless otherwise defined, all terms used herein, including technical or scientific terms, have the same meaning as commonly understood by one of ordinary skill in the art to which the embodiment belongs. Terms such as those defined in commonly used dictionaries should be interpreted as having a meaning consistent with the meaning in the context of the related art, and should not be interpreted in an ideal or excessively formal meaning unless explicitly defined in the present application. does not

또한, 첨부 도면을 참조하여 설명함에 있어, 도면 부호에 관계없이 동일한 구성 요소는 동일한 참조부호를 부여하고 이에 대한 중복되는 설명은 생략하기로 한다. 실시예를 설명함에 있어서 관련된 공지 기술에 대한 구체적인 설명이 실시예의 요지를 불필요하게 흐릴 수 있다고 판단되는 경우 그 상세한 설명을 생략한다.In addition, in the description with reference to the accompanying drawings, the same components are given the same reference numerals regardless of the reference numerals, and the overlapping description thereof will be omitted. In the description of the embodiment, if it is determined that a detailed description of a related known technology may unnecessarily obscure the gist of the embodiment, the detailed description thereof will be omitted.

본 발명에 따른 블록체인 응용서비스의 실행 시스템은, 블록체인 기반으로 제작된 응용서비스의 견고한 실행을 보장할 수 있는 서비스 복제 기법을 실시할 수 있다.The execution system of the blockchain application service according to the present invention can implement a service replication technique that can ensure the robust execution of the application service produced based on the blockchain.

본 서비스 복제 기법에 따르면, 분산 환경에서 응용서비스를 복제하기 위하여, Raft 컨센서스 프로토콜을 사용한 분산 저장소인 ETCD를 이용할 수 있으며, 재난 상태에서도 서비스 복제 기법이 적용된 이더리움 블록체인 응용서비스의 견고한 실행을 위해 필요한 서비스 레지스트리를, 이더리움 블록체인 기반으로 실행되는 스마트 컨트랙트(Smart contract)를 이용해 설계할 수 있다.According to this service replication technique, ETCD, a distributed storage using the Raft consensus protocol, can be used to replicate application services in a distributed environment. The necessary service registry can be designed using a smart contract that runs on the Ethereum blockchain.

여기서, 서비스 레지스트리(Service Registry)는, 서비스의 중요한 정보를 저장하고 서비스의 접근 위치 제공 및 복구 요청 기능을 제공하는 기능을 수행할 수 있다.Here, the service registry may perform a function of storing important information of a service and providing an access location of the service and a function of requesting a recovery.

Raft는, 분산 환경에 참여한 서버 노드들이 충돌 오류와 같은 상황에서도 복제 로그를 용이하게 관리하기 위한 합의 알고리즘으로서, 합의 그룹의 참여 노드 중 과반수에 장애가 발생하기 전까지는 합의 그룹에 속하는 서버 노드들이 정상적으로 동작하고 있음을 보장하는데 이용될 수 있다. 본 발명에서는 기존의 분산 환경에서 발생하는 합의 문제를 해결하기 위해 이용했던 Paxos와 동일한 성능을 가지면서도, 보다 간단하고 이해하기 쉬운 장점을 가지는 Raft를 이용함으로써, 분산 환경에서의 충돌 오류가 발생되는 경우에 복제 로그를 보다 효율적으로 관리할 수 있다.Raft is a consensus algorithm for easily managing replication logs even in situations such as collision errors between server nodes participating in a distributed environment. Until a majority of nodes participating in the consensus group fail, server nodes belonging to the consensus group operate normally. It can be used to ensure that In the present invention, when a collision error occurs in a distributed environment by using Raft, which has the same performance as Paxos, which has been used to solve the consensus problem occurring in the existing distributed environment, but has the advantage of being simpler and easier to understand You can manage the replication log more efficiently.

ETCD는, 분산 시스템 또는 시스템 클러스터에서 데이터를 안정적으로 저장할 수 있는 Raft 기반의 키-값 분산 저장소로서, 본 발명에서는 분산 그룹 내에서 발생할 수 있는 실패에 대한 일관성 있는 정책과 복구 기능 및 사용자 인증서를 통한 자동 TLS를 제공하는 ETCD를 이용함으로써, 각각의 서버에 복제한 블록체인 응용서비스들의 더욱 안전한 실행을 보장할 수 있다.ETCD is a Raft-based key-value distributed storage that can stably store data in a distributed system or system cluster. By using ETCD, which provides automatic TLS, more secure execution of blockchain application services replicated on each server can be ensured.

스마트 컨트랙트는, 실제 사람이 대면하는 기존 계약 방식에서 벗어나 블록체인 상에서 조건에 따라 자동으로 수행하는 실행 코드로서, 본 발명에서는 서비스 레지스트리를 설계할 때, 이더리움 블록체인 기반에서 실행되는 스마트 컨트랙트를 이용하기 때문에 무결성 보장 및 조작 방지가 용이하다.A smart contract is an executable code that is automatically executed according to conditions on a blockchain, out of the existing contract method that real people face. In the present invention, when designing a service registry, a smart contract executed on the Ethereum blockchain is used Therefore, it is easy to ensure integrity and prevent manipulation.

일례로, 사용자 측에서 배포된 스마트 컨트랙트를 이용하기 위해 트랜잭션을 보내면 스마트 컨트랙트에 정의된 내용에 따라 기능을 제공 받을 수 있으며, 스마트 컨트랙트에서는 기능을 수행하기 전후로 특정 기능을 수행하여 클라이언트에 전달하고 트랜잭션에 로그 형태로 저장된 이벤트 기능을 통해 안전하고 다양한 형태로 기능을 수행할 수 있다.For example, if the user sends a transaction to use the deployed smart contract, the function can be provided according to the contents defined in the smart contract. Through the event function stored in the log format, functions can be performed safely and in various forms.

여기서 이더리움 블록체인은, 2세대 블록체인으로 스마트 계약 기능을 제공하기 위하여 고안된 블록체인 플랫폼으로서, 기존의 1세대 블록체인에 없는 반복문과 제어문을 사용할 수 있는 튜링 완전성을 가지고 있어 간단한 거래 뿐만 아니라 복잡한 형태의 탈중앙화 어플리케이션을 만들 수 있는 장점을 가지고 있다.Here, the Ethereum block chain is a block chain platform designed to provide smart contract functions as a second-generation block chain. It has the advantage of being able to create decentralized applications in the form of

본 발명에서 제안하는 서비스 복제 기법은, 블록체인 응용서비스를 적어도 3개 이상의 서버 노드로 이루어진 분산 환경에서 복제하게 되며, 각각의 서버 노드에는 복제된 블록체인 응용서비스가 실행되고, Raft 컨센서스 프로토콜을 사용하는 ETCD와 각각 연결될 수 있다.In the service replication technique proposed in the present invention, the blockchain application service is replicated in a distributed environment composed of at least three server nodes, and the replicated blockchain application service is executed in each server node, and the Raft consensus protocol is used. It can be connected to each ETCD.

이처럼 본 서비스 복제 기법에서는 블록체인 응용서비스가 복수의 서버에서 실행되는 분산 환경에서, 각 서버와 연결된 ETCD에 기록되는 로그의 일치 작업을 수행할 수 있도록 ETCD 중에서 강력한 리더를 선출하여, 리더인 ETCD를 기준으로 분산 그룹 내 ETCD들이 동일한 로그를 가지도록 할 수 있다.As such, in this service replication technique, a strong leader is selected from among ETCDs to match the logs recorded in the ETCD connected to each server in a distributed environment where the blockchain application service runs on multiple servers, and the leader ETCD is created. As a standard, ETCDs in a distribution group can have the same logarithm.

또한 본 서비스 복제 기법에서는 상기 리더로 선출된 ETCD와 연결된 서버를, 클라이언트에 서비스를 제공하는 리더 서버로서 선출하고, 상기 리더 서버에 의해 클라이언트로부터의 사용자 요청을 처리하기에 앞서, 상기 사용자 요청을 리더 서버에 연결된 ETCD에 로그 엔트리로서 저장함으로써, 각 ETCD 간 로그 일치 작업에 따라 각각의 서버에서의 응용서비스의 상태가 최신의 상태로 동기화 되도록 할 수 있다.In addition, in this service replication technique, a server connected to the ETCD elected as the leader is selected as a leader server that provides a service to the client, and before processing the user request from the client by the leader server, the user request is read as a leader. By storing as log entries in the ETCD connected to the server, it is possible to synchronize the state of the application service in each server to the latest state according to the log matching operation between each ETCD.

본 발명에 따르면, 상태를 동기화하고 있던 복수의 서버 중에 새로운 리더 서버를 키-값 분산저장소를 통해 선출하고 그 새로운 리더 서버가 서비스를 이어 나가도록 함으로써, 장애나 결함 속에서도 복사된 서버로 대처하여 지속적으로 서비스를 재개하거나, 모든 서버가 서비스 상태를 잃어버렸다고 해도, 키-값 분산저장소에 저장되어 있는 로그 엔트리를 독출하여 서비스 상태를 복구할 수 있다. 이 같은 서비스 복제 기법이 적용된 블록체인 응용서비스에 대하여 도 1에 도시한다.According to the present invention, a new leader server is selected through a key-value distributed storage among a plurality of servers that are synchronizing the status, and the new leader server continues the service, thereby coping with the copied server even in the event of a failure or defect. Even if the service is resumed with , or all servers lose the service state, the service state can be restored by reading the log entry stored in the key-value distributed storage. A block chain application service to which such a service replication technique is applied is shown in FIG. 1 .

도 1은 본 발명의 일실시예에 따른 블록체인 응용서비스의 복제 실행 시스템에서, 블록체인 응용서비스의 복제(Replication) 기법을 도시한 도면이다.1 is a diagram illustrating a replication technique of a block chain application service in a system for executing replication of a block chain application service according to an embodiment of the present invention.

도 1을 참조하면, 본 발명의 블록체인 응용서비스의 복제 실행 시스템은 블록체인 응용서비스를 복제한 프로그램(App)을 적어도 3개 이상의 서버 노드(Node1, Node2, Node3)에 설치하여 분산 그룹을 구성하고, 각각의 서버 노드에, App 실행에 따른 로그를 기록하기 위한 ETCD(ETCD-A, ETCD-B, ETCD-C)를 연결할 수 있다.Referring to FIG. 1, the system for executing the replication of the blockchain application service of the present invention configures a distributed group by installing a program (App) that replicates the blockchain application service on at least three server nodes (Node1, Node2, Node3). and ETCD (ETCD-A, ETCD-B, ETCD-C) for recording logs according to the execution of the App can be connected to each server node.

ETCD는 합의 알고리즘(Raft) 기반으로 동작하는 분산 저장소로서, 리더(Leader)로 선출되는 ETCD-A를 기준으로, ETCD-B 및 ETCD-C의 로그 일치 작업이 수행될 수 있다.ETCD is a distributed storage that operates based on a consensus algorithm (Raft), and log matching of ETCD-B and ETCD-C can be performed based on ETCD-A, which is elected as a leader.

각각의 ETCD에는 로그 엔트리(Request Log Entry)가 인덱스에 연관되어 저장되고, 또한, 저장된 로그 엔트리의 총 개수에 관한 로그 사이즈(Log Size)와, 가장 최근에 처리된 로그 엔트리의 인덱스에 관한 최근 처리 인덱스(Latest Processed Index), 저장된 사용자 요청(로그 엔트리)의 처리 여부(Response state)도 저장될 수 있다.In each ETCD, a log entry (Request Log Entry) is stored in association with an index, and also, a log size related to the total number of stored log entries, and a recent processing related to the index of the most recently processed log entry An index (Latest Processed Index) and whether a stored user request (log entry) is processed (Response state) may also be stored.

이 중 어느 하나의 값이 리더인 ETCD-A에서 변경됨에 따라, 나머지 ETCD에서도 Raft 기반으로 값을 다시 저장(변경)하게 되며, ETCD 내부적으로 값의 변경을 알리는 이벤트가 발생될 수 있다. 이에 따라 리더 서버를 제외한 다른 서버(팔로우 서버)에서는 상기 이벤트를 구독하여 변경된 값을 인지할 수 있다.As any one of these values is changed in ETCD-A, the leader, the remaining ETCDs also store (change) the values based on Raft, and an event notifying the change of values may occur internally in the ETCD. Accordingly, other servers (follow servers) other than the leader server may subscribe to the event and recognize the changed value.

블록체인 응용서비스의 복제 실행 시스템은, 리더인 ETCD-A와 연결된 서버 노드(Node1)를, 상기 분산 그룹의 리더 서버로서 선출하고, 클라이언트로부터 수신되는 사용자 요청(request)을, 리더 서버와 연결된 ETCD-A 내에 새로운 로그 엔트리(Request Log Entry)로서 저장할 수 있다. 이에 따라 사용자 요청이 로그용으로 기록될 수 있다.The replication execution system of the blockchain application service selects the server node (Node1) connected to the leader ETCD-A as the leader server of the distributed group, and responds to the user request received from the client, the ETCD connected to the leader server -A can be saved as a new log entry (Request Log Entry). This allows user requests to be logged for log purposes.

블록체인 응용서비스의 복제 실행 시스템은 상기 사용자 요청의 저장에 따라, ETCD-A 내의 로그 엔트리의 총 개수가 1개 늘어나고 해당 로그 엔트리의 인덱스에 관련된 Response state도 생성되면, ETCD-A의 로그 사이즈(Log Size)를 늘어난 개수 만큼 증가시키고, ETCD 내에서 로그 사이즈의 수정이 완료되면 로그 사이즈의 업데이트 이벤트가 발생한다.In the replication execution system of the blockchain application service, when the total number of log entries in ETCD-A increases by one and the response state related to the index of the log entry is also created, the log size of ETCD-A ( Log Size) is increased by the increased number, and when the log size modification in the ETCD is completed, an update event of the log size occurs.

이에 따라, ETCD 내에서는 Raft 합의 알고리즘에 의해 ETCD-B 및 ETCD-C에 사용자 요청이 복사되고, 복사에 따라 ETCD-B 및 ETCD-C의 로그 사이즈도 증가될 수 있다.Accordingly, in the ETCD, user requests are copied to ETCD-B and ETCD-C by the Raft consensus algorithm, and the log size of ETCD-B and ETCD-C may be increased according to the copy.

로그 사이즈의 업데이트 이벤트가 발생할 때마다 리더 서버에 의해 ETCD-A에 저장된 상기 사용자 요청이 처리되면, 블록체인 응용서비스의 복제 실행 시스템은, 클라이언트로 처리 결과를 전송하고 사용자 요청 처리 완료 이벤트의 트리거인 Response state의 0(ETCD에 저장된)의 값을 수정하여 처리 완료 이벤트를 다른 서버 노드로 발생할 수 있으며, 상기 사용자 요청 이전에 가장 최근에 처리된 요청의 저장 위치(인덱스)를 기록한 최근 처리 인덱스(Latest Processed Index)를, 상기 처리된 사용자 요청의 저장위치(인덱스)로 갱신할 수 있다.Whenever the log size update event occurs, when the user request stored in ETCD-A is processed by the reader server, the replication execution system of the blockchain application service transmits the processing result to the client and triggers the user request processing completion event. By modifying the value of 0 (stored in the ETCD) of the response state, a processing completion event can be generated to another server node, and the latest processing index (Latest) that records the storage location (index) of the most recently processed request before the user request Processed Index) may be updated with a storage location (index) of the processed user request.

상기 사용자 요청에 대한 처리 완료 이벤트를 구독한 서버 노드(Node2, Node3)에서는, ETCD-B 및 ETCD-C에 저장된 상기 사용자 요청을 처리하고, 최근 처리 인덱스를 상기 사용자 요청의 저장위치로 갱신함으로써, 리더 서버와 동기화(Sync)될 수 있다.The server nodes (Node2, Node3) that have subscribed to the processing completion event for the user request process the user request stored in ETCD-B and ETCD-C, and update the latest processing index to the storage location of the user request, It can be synchronized with the reader server.

이와 같이, 본 발명은 상태를 동기화하고 있던 복수의 서버 중에 새로운 리더 서버를 키-값 분산저장소를 통해 선출하고 그 새로운 리더 서버가 서비스를 이어 나가도록 함으로써, 장애나 결함 속에서도 복사된 서버로 대처하여 지속적으로 서비스를 재개하거나, 모든 서버가 서비스 상태를 잃어버렸다고 해도, 키-값 분산저장소에 저장되어 있는 로그 엔트리를 독출하여 서비스 상태를 복구할 수 있다.As described above, the present invention selects a new leader server from among the plurality of servers that are synchronizing the state through the key-value distributed storage and allows the new leader server to continue the service. Even if the service is continuously resumed or all servers lose the service state, the service state can be restored by reading the log entry stored in the key-value distributed storage.

본 발명에서 제안하는 서비스 복제 기법은, 사용자 요청의 저장 및 상태 동기화를 수행한다.The service replication scheme proposed in the present invention performs storage and state synchronization of user requests.

먼저 사용자 요청의 저장은, 리더 응용서비스가 블록체인 응용서비스의 사용자 요청을 ETCD에 저장하는 작업으로, 리더 응용서비스는 사용자 요청을 받으면 처리 및 응답을 보류하고 즉시 사용자 요청을 ETCD에 저장한다. 리더 응용서비스가 사용자 요청을 ETCD에 저장하는 과정은 같다.First, the storage of user request is the operation of the reader application service to store the user request of the blockchain application service in the ETCD. When the reader application service receives a user request, it suspends processing and response, and immediately stores the user request in the ETCD. The process for the reader application service to save the user request to the ETCD is the same.

(ⅰ) 사용자 요청에 대한 응답을 동기화 작업에서 수행하기 위하여 사용자가 보낸 요청에 현재 리더 응용서비스의 고유한 식별 값을 저장하고 요청 연결을 커넥션 풀에 저장하여 응답을 보류한다.(i) In order to perform a response to a user request in the synchronization operation, the unique identification value of the current reader application service is stored in the request sent by the user, and the request connection is stored in the connection pool to hold the response.

(ⅱ) 사용자 요청을 직렬화 및 압축하여 ETCD에 저장할 수 있는 형태로 만든다.(ii) Serialize and compress user requests into a form that can be stored in ETCD.

(ⅲ) 사용자 요청을 저장할 Request Log Entry의 인덱스(현재 Log Size의 값 + 1)를 설정하고 ETCD에 사용자 요청을 저장한다.(iii) Set the index of the Request Log Entry to store the user request (the value of the current log size + 1) and save the user request in the ETCD.

(ⅳ) 저장된 사용자 요청 처리 상태를 나타내는 Response State는, 저장된 Request Log Entry의 인덱스를 키(Key)로 하고, 미처리 상태를 나타내는 코드 0을 값(Value)으로 하여 저장한다.(iv) Response State indicating the stored user request processing state is stored with the index of the stored Request Log Entry as the key and code 0 indicating the unprocessed state as the value.

리더 응용 서비스에 의해 사용자 요청에 대한 저장 작업이 완료되면 ETCD에서 로그 사이즈 업데이트 이벤트가 발생하고, 이를 감지한 리더 응용 서비스는 ETCD 내에 미처리된 사용자 요청을 처리한다. 리더 응용 서비스가 미처리된 사용자 요청 처리 과정은 다음과 같다.When the storage operation for the user request is completed by the reader application service, a log size update event occurs in the ETCD, and the reader application service detects this and processes the unprocessed user request in the ETCD. The process of processing a user request that is not processed by the reader application service is as follows.

(1) ETCD 내에 Log Size의 값과 리더 응용 서비스의 Latest processed index의 값을 리드한다.(1) Read the Log Size value and the Latest processed index value of the reader application service in the ETCD.

(2) Latest processed index와 Log Size의 값이 서로 같다면 해당 작업에 대해 종료한다. 그렇지 않으면 3)의 과정으로 넘어간다.(2) If the values of Latest processed index and Log Size are the same, the corresponding job is terminated. Otherwise, go to step 3).

(3) (리드한 Latest processed index의 값 +1)를 현재 처리 인덱스로 응용 서비스 내에 설정하고, 현재 처리 인덱스에 해당하는 Request Log Entry를 리드한다(3) (Leaded Latest processed index value +1) is set as the current processing index in the application service, and the Request Log Entry corresponding to the current processing index is read

(4) 리드한 Request Log Entry가 로그용이라면, (5) 과정으로 넘어간다. 그렇지 않다면 해당 Request Log Entry를 처리하고, 처리 결과에 대해 현재 인덱스에 해당하는 Response state에 기록한다.(4) If the requested Request Log Entry is for logging, go to (5). Otherwise, it processes the Request Log Entry and records the processing result in the Response state corresponding to the current index.

(5) 리더 응용 서비스가 인덱스가 0인 Response state의 값을 업데이트하여 ETCD 내에 사용자 요청 처리 완료에 대한 이벤트를 발생시킨다. (5) The reader application service updates the value of the response state whose index is 0 to generate an event for the completion of user request processing in the ETCD.

(6) Latest processed index의 값을 현재 처리 인덱스로 수정하고 2)의 과정으로 넘어간다.(6) Modify the latest processed index value to the current processed index and proceed to step 2).

리더 응용 서비스에 의해 저장된 사용자 요청 처리 완료에 대한 업데이트 이벤트가 발생하고, 이 이벤트를 감지한 팔로워(리더를 제외한) 응용 서비스들은 리더 응용 서비스의 상태를 동기화 위한 작업을 수행한다. 처리를 수행하는 과정은 다음과 같다.An update event for the completion of user request processing stored by the reader application service occurs, and the follower (except the leader) application services that detect this event perform a task to synchronize the status of the reader application service. The process of performing the processing is as follows.

(1) ETCD 내에 Log Size의 값과 리더 응용 서비스의 Latest processed index의 값을 리드한다.(1) Read the Log Size value and the Latest processed index value of the reader application service in the ETCD.

(2) Latest processed index와 Log Size의 값이 서로 같다면 해당 작업에 대해 종료한다. 그렇지 않으면 3)의 과정으로 넘어간다.(2) If the values of Latest processed index and Log Size are the same, the corresponding job is terminated. Otherwise, go to step 3).

(3) (리드한 Latest processed index의 값 +1)를 현재 처리 인덱스로 응용 서비스 내에 설정하고, 현재 처리 인덱스에 해당하는 Response state를 리드한다(3) (Leaded Latest processed index value +1) is set as the current processing index in the application service, and the response state corresponding to the current processing index is read

(4) 리드한 Response state의 값이 리더 응용 서비스에 의해 성공적인 처리를 나타내는 정수 값인 1이라면 (5)의 과정을 수행한다. 만약 아니라면 (6)의 과정으로 넘어간다.(4) If the value of the read response state is 1, which is an integer value indicating successful processing by the reader application service, the process of (5) is performed. If not, go to step (6).

(5) 현재 처리 인덱스의 해당하는 Request log entry의 값을 리드하여 해당 응용 서비스의 상태를 변경시킨다.(5) Read the value of the request log entry corresponding to the current processing index and change the status of the corresponding application service.

(6) Latest processed index의 값을 현재 처리 인덱스로 수정하고 2)의 과정으로 넘어간다.(6) Modify the latest processed index value to the current processed index and proceed to step 2).

또한, 상태 동기화는 실패나 장애로 인해 재시작하거나 리더 서버가 변경된 경우 응용서비스가 최신 상태를 따라갈 수 있게 동기화 하는 작업으로 구체적인 과정은 같다.In addition, state synchronization is a task that synchronizes application services to keep up with the latest state when restarting or changing the reader server due to failure or failure, and the specific process is the same.

(ⅰ) ETCD 내에서 Log Size의 업데이트 이벤트가 발생하여 응용서비스에서 감지하거나 응용서비스가 재시작할 때 현재 Log Size의 값을 ETCD에서 읽어온다.(i) When the log size update event occurs in the ETCD and the application service detects it or the application service restarts, the current log size value is read from the ETCD.

(ⅱ) 응용서비스 내에서 현재 동기화의 작업이 수행되고 있지 않고 응용서비스의 Latest Processed Index의 값이 가져온 Log size의 값보다 작다면 (1)~(9)의 과정을 수행한다.(ii) If synchronization is not currently being performed within the application service and the value of the Latest Processed Index of the application service is smaller than the value of the imported log size, the process of (1)~(9) is performed.

(1) 현재 Log Size의 값과 Latest Processed Index의 값을 해당 응용 서비스로 리드한다.(1) The current Log Size value and the Latest Processed Index value are read to the corresponding application service.

(2) Latest processed Index의 값이 Log Size보다 작다면 3)의 과정을 수행한다. 만약 두개의 값이 같다면 전체 과정을 종료한다.(2) If the value of Latest processed Index is smaller than Log Size, perform the process of 3). If the two values are the same, the whole process is terminated.

(3) (Latest processed Index의 값+1)에 해당하는 값을 응용 서비스 내에서 현재 처리 인덱스로 설정하고, ETCD에 저장된 해당 인덱스의 Response state 값을 해당 응용 서비스로 리드한다. (3) The value corresponding to (Value of the Latest processed Index+1) is set as the current processing index in the application service, and the Response state value of the corresponding index stored in the ETCD is read to the corresponding application service.

(4) (3)에서 리드된 Response state 값이 저장된 사용자 요청이 리더에 의해 실패를 나타내는 정수 값 -1이거나 미처리 상태를 나타내는 9 라면 (8) 과정으로 넘어간다.(4) If the user request in which the response state value read in (3) is stored is -1, an integer value indicating failure by the reader, or 9 indicating an unprocessed state, proceed to step (8).

(5) (3)에서 리드된 Response state 값이 저장된 사용자 요청이 리더에 의해 성공적으로 처리 되었음을 나타내는 정수 값 1이라면, 현재 처리 인덱스에 해당하는 Request Log Entry를 ETCD에서 가져와 응용 서비스에서 처리하고 (8) 과정으로 넘어간다.(5) If the value of the response state read in (3) is an integer value 1 indicating that the stored user request has been successfully processed by the reader, the Request Log Entry corresponding to the current processing index is fetched from the ETCD and processed by the application service (8 ) to the process.

(6) (3)에서 리드된 Response state 값이 미처리에 해당하는 정수 값 0이라면 해당 응용서비스의 상태가 리더인지를 확인한다. 만약 리더라면 (7) 과정으로 넘어가고 아니라면 (8)과정으로 넘어간다.(6) If the value of the response state read in (3) is an integer value 0 corresponding to unprocessed, it is checked whether the state of the corresponding application service is the leader. If it is a leader, go to step (7), otherwise go to step (8).

(7) [현재 처리 인덱스, Log Size의 값] 범위에 해당하는 모든 Response State의 값을 ETCD 내에서 단순 로그용을 나타내는 9로 수정하고(7) Modify all Response State values within the range of [Current Processing Index, Log Size] to 9 indicating simple log use within the ETCD,

해당 응용 서비스의 Latest processed index의 값을 Log size의 값으로 수정한 후 9)과정으로 넘어간다. After changing the value of the Latest processed index of the corresponding application service to the value of Log size, proceed to step 9).

(8) 응용서비스의 Latest Processed Index의 값을 현재 인덱스로 업데이트하고 2)의 과정으로 되돌아간다.(8) Update the Latest Processed Index value of the application service to the current index and return to the process of 2).

(9) 해당 작업을 종료한다.(9) Terminate the work.

본 발명에서 제안하는 서비스 복제 기법이 적용된 블록체인 응용서비스의 견고한 실행을 지원하기 위해, 이더리움 스마트 컨트랙트를 이용하여 서비스 레지스트리를 설계함으로써, 분산 환경에서 블록체인 응용서비스가 해킹 및 각종 재난 상황에서도 안정적으로 실행되도록 할 수 있다. 이러한 이더리움 스마트 컨트랙트로 설계된 서비스 레지스트리의 구조를 도 2에 도시한다.In order to support the robust execution of the blockchain application service to which the service replication technique proposed in the present invention is applied, by designing a service registry using an Ethereum smart contract, the blockchain application service is stable even in hacking and various disaster situations in a distributed environment. can be made to run as The structure of a service registry designed with such an Ethereum smart contract is shown in FIG. 2 .

도 2는 본 발명의 일실시예에 따른 블록체인 응용서비스의 복제 실행 시스템에서, 서비스 레지스트리의 구조를 도시한 도면이다.2 is a diagram showing the structure of a service registry in a system for executing replication of a block chain application service according to an embodiment of the present invention.

도 2를 참조하면, 서비스 레지스트리(Service Registry) 내 "register()"는 서비스 관리자가 중요한 서비스 정보를 서비스 레지스트리 내에 저장하는 기능을 하는 함수이다.Referring to FIG. 2 , "register()" in the service registry is a function that allows the service manager to store important service information in the service registry.

상기 서비스 정보는 서비스 스트럭트(Service Struct)의 형태로 저장되며, 서비스의 ID(service id), 접근 위치(service current location), 제공자(company) name, service managers, managers contact), 서비스 상태(service state) 등으로 구성될 수 있다. 이들 정보는 고유한 서비스 ID와 키-값 형태로 매핑되어, 서비스 레지스트리 내에서 서비스들의 정보가 저장되어 있는 서비스 리스트(service List)에 저장된다.The service information is stored in the form of a service struct, service ID (service id), access location (service current location), provider (company) name, service managers, managers contact), service state ( service state) and the like. This information is mapped to a unique service ID and key-value form, and is stored in a service list in which service information is stored in the service registry.

또한 서비스 레지스트리 내 "Update_*()"는 이미 저장되어 있는 서비스의 정보를 변경하는 기능을 하는 함수로서, 이 함수를 실행하기 전에, 서비스 관리자인지 검증하기 위해 "onlyManagers()"를 선행으로 실행하여야 한다.In addition, "Update_*()" in the service registry is a function that changes the information of the service that is already stored. do.

서비스 레지스트리 내 함수들은 서비스 레지스트리에 서비스 정보를 등록한 서비스 관리자 만이 사용할 수 있으며, 이러한 서비스 레지스트리를 활용한 서비스 복제 기법이 도 3에 도시되어 있다.Functions in the service registry can only be used by a service administrator who has registered service information in the service registry, and a service replication technique using such a service registry is shown in FIG. 3 .

도 3는, 도 2에 도시된 서비스 레지스트리를 이용한 블록체인 응용서비스의 복제 기법을 도시한 도면이다.FIG. 3 is a diagram illustrating a replication technique of a blockchain application service using the service registry shown in FIG. 2 .

본 발명에서 제안하는 서비스 복제 기법이 적용된 블록체인 응용서비스의 사용자(Client)는 도 2에 도시된 서비스 레지스트리를 이용하면 재난 상태에서도 서비스의 접근 위치를 확인할 수 있다.A user (Client) of the blockchain application service to which the service replication technique proposed in the present invention is applied can check the access location of the service even in a disaster state by using the service registry shown in FIG. 2 .

이를 도 3를 참조하여 구체적으로 설명하면, 기존 리더 응용서비스(Old leader)가 장애나 결함과 같은 이유로 중지될 경우, 나머지 응용서비스들 중에서 사용자에게 서비스를 제공할 새로운 리더(New leader)가 선출되고, 새로운 리더 응용서비스는 도 2의 서비스 레지스트리에 등록된 해당 서비스의 접근 위치를 자신의 위치로 수정한다.If this is described in detail with reference to FIG. 3, when the existing leader application service (Old leader) is stopped for reasons such as failure or defect, a new leader who will provide a service to the user among the remaining application services is elected and , the new reader application service modifies the access location of the corresponding service registered in the service registry of FIG. 2 to its own location.

서비스의 접근 위치에 대한 수정이 완료되면, 서비스 레지스트리는 서비스 접근 위치가 변경된 서비스 ID 및 위치를 알려주는 NewLocation 이벤트를 서비스 사용자에게 전달한다.When the modification of the access location of the service is completed, the service registry transmits a NewLocation event that notifies the service ID and location of the changed service access location to the service user.

상기 이벤트를 통해 서비스 사용자는 새로운 서비스 접근 위치를 확인할 수 있으며, 상기 이벤트를 받지 못한 서비스 사용자의 경우, 서비스 레지스트리 내 getServiceLocation() 기능을 이용해 새로운 서비스 접근 위치를 얻어낼 수도 있다.The service user can check the new service access location through the event, and in the case of the service user who has not received the event, the new service access location can be obtained by using the getServiceLocation() function in the service registry.

모든 응용서비스의 실패하거나, 현재 서비스 접근 위치에서 지속적으로 서비스를 제공 받지 못할 경우, 서비스 사용자는 도 3에 있는 서비스 관리자(Managers)에게 복구 요청을 보내는 sendClaim() 함수를 통해 실패한 서비스에 대한 복구 요청을 전송할 수 있다.If all application services fail or if the service is not continuously provided at the current service access location, the service user requests recovery of the failed service through the sendClaim() function that sends a recovery request to the service managers in FIG. can be transmitted.

서비스 레지스트리에서 sendClaim() 함수가 실행되면 서비스 ID와 현재 실패한 서비스 접근 위치 정보가 담긴 Claim 이벤트가 발생하고, 서비스 레지스트리에서 Claim 이벤트를 구독한 서비스 관리자는, 실패한 응용서비스에 대한 정확한 위치를 신속하게 파악할 수 있게 된다.When the sendClaim() function is executed in the service registry, a Claim event containing the service ID and current failed service access location information occurs. be able to

도 4는 본 발명의 일실시예에 따른 블록체인 응용서비스의 복제 실행 시스템에서, 복제한 블록체인 응용서비스가 동작하는 환경을 도시한 도면이다.4 is a diagram illustrating an environment in which the duplicated blockchain application service operates in the system for executing the replication of the blockchain application service according to an embodiment of the present invention.

도 4에 도시된 것처럼, 본 발명의 블록체인 응용서비스의 실행 시스템은 6개의 독립적인 노드(N1 내지 N6)로 구성된 분산 환경에서, 각 노드에 ETCD를 마련하여, 이더리움(Ethereum) 블록체인 응용서비스를 복제 실행한다. 도시된 것처럼 이더리움 블록체인은 6개 노드로 구성된 프라이빗 체인(Private blockchain)일 수 있다.As shown in FIG. 4, the execution system of the blockchain application service of the present invention provides an ETCD to each node in a distributed environment composed of six independent nodes (N1 to N6), thereby applying an Ethereum blockchain application. Duplicate the service. As shown, the Ethereum blockchain can be a private chain consisting of 6 nodes.

이때 이더리움 블록체인에 배포된 서비스 레지스트리(Service registry)는, 클라이언트에 NewLocation 이벤트를 전달하여 새로운 서비스 접근 위치를 제공하는데 이용될 수 있다.At this time, the service registry deployed on the Ethereum blockchain can be used to provide a new service access location by sending a NewLocation event to the client.

이러한 본 발명에 의해서는, 네트워크 장애에도 모든 응용서비스의 상태를 성공적으로 동기화할 수 있고, 서비스를 제공하는 리더 응용서비스의 실패에도 새로운 리더의 선출 및 서비스 레지스트리를 통해 다시 서비스를 제공할 수 있게 되므로, 블록체인 응용서비스의 견고한 실행을 보장할 수 있다.According to the present invention, it is possible to successfully synchronize the status of all application services even in the event of a network failure, and to provide services again through the election of a new leader and the service registry even when the leader application service providing the service fails. , it can ensure the robust execution of blockchain application services.

다시 말하면 본 발명에 따른 블록체인 응용서비스의 실행 시스템은 블록체인 응용서비스의 견고한 실행을 지원하기 위한 서비스 복제 기법과, 서비스 레지스트리를 제안한다.In other words, the execution system of the blockchain application service according to the present invention proposes a service replication technique and a service registry to support the robust execution of the blockchain application service.

구체적으로 블록체인 응용서비스의 실행 시스템은 키-값 분산저장소를 이용하여 블록체인 응용서비스를 다중으로 복제하여 실행하고, 이더리움 블록체인의 스마트 컨트랙트로 개발된 서비스 레지스트리를 이용하여 재난 사태에도 서비스 정보를 관리, 서비스에 대한 유용한 정보 및 복구 요청 기능을 지원하도록 할 수 있다. 이를 통해 장애나 결함에 의한 서비스 실패에서도 서비스를 제공할 수 있는 새로운 노드에 대한 정보를 복원하여 서비스가 지속적으로 제공되도록 할 수 있다.Specifically, the execution system of the blockchain application service uses the key-value distributed storage to duplicate and execute the blockchain application service, and service information even in a disaster situation using the service registry developed with the smart contract of the Ethereum blockchain management, useful information about services, and support for recovery request functions. In this way, even in the event of a service failure due to a failure or defect, information on a new node that can provide a service can be restored so that the service can be continuously provided.

본 명세서에서 "블록체인 응용서비스"는 2세대 블록체인 이더리움의 스마트 컨트랙트 기반을 둔 탈중앙화 응용서비스를 지칭하고, 이더리움 블록체인 응용서비스 제공을 위한 프레임워크는 클라이언트와 서버로 구성될 수 있다.In this specification, "blockchain application service" refers to a decentralized application service based on the smart contract of the second-generation blockchain Ethereum, and the framework for providing the Ethereum blockchain application service can be composed of a client and a server. .

여기서 클라이언트는, 사용자에게 블록체인의 스마트 컨트랙트를 호출하고 실행할 수 있는 정보와 인터페이스를 제공하는 역할을 하고, 서버는, 사용자에게 클라이언트를 전달 및 기존의 중앙 집권식 서버 형태의 서비스를 제공하는 역할을 한다.Here, the client plays a role in providing information and interfaces for users to call and execute smart contracts on the blockchain, and the server serves to deliver the client to the user and provide services in the form of a conventional centralized server. do.

본 프레임워크에서는 기존의 블록체인 응용서비스 보다 견고한 실행을 보장하기 위해 Raft 기반으로 동작하는 분산저장소인 ETCD를 이용해 서버를 복제 실행한다.In this framework, the server is replicated using ETCD, a distributed storage operating based on Raft, to ensure more robust execution than the existing blockchain application service.

ETCD는, 분산 시스템 또는 시스템 클러스터에서 데이터를 안정적으로 저장할 수 있는 오픈 소스 분산 키-값 키-값 분산저장소로서, 합의 알고리즘인 Raft 기반으로 분산 환경에서 로그 일치 작업을 수행하는 강력한 리더를 선출하여 분산 그룹들이 동일한 로그를 가질 수 있도록 한다.ETCD is an open source distributed key-value key-value distributed repository that can reliably store data in a distributed system or cluster of systems. Based on Raft, a consensus algorithm, a strong leader is elected and distributed Allow groups to have the same log.

앞서 제공하는 기능을 통해, 데이터를 Key-Value 로그 엔트리 형태로 ETCD에 저장할 수 있으며, 이 시스템에서 ETCD에서 저장되는 Key-Value 엔트리의 종류는 사용자 요청을 로그화한 로그 엔트리(Request log entry), 로그 사이즈(Log size), 응답 상태(Response state), 최근 처리 인덱스(Latest processed indexes)와 같은 4가지의 Key-Value 엔트리가 있다.Through the function provided above, data can be stored in the ETCD in the form of a key-value log entry, and the types of key-value entries stored in the ETCD in this system are: There are four key-value entries such as log size, response state, and latest processed indexes.

- Request log entry: ETCD에 인덱스 형태로 저장한 사용자 요청- Request log entry: A user request stored in the ETCD in the form of an index

- Log size : ETCD에 Request log entry의 총 개수- Log size: Total number of request log entries in ETCD

- Response state : Request log entry의 처리 결과- Response state: processing result of Request log entry

- Latest processed indexes: 각 서버가 최근에 처리한 Request log entry의 인덱스를 기록한 키-값 리스트- Latest processed indexes: A key-value list that records the index of the request log entry that each server recently processed.

다음으로, ETCD에 저장된 Key-Value 엔트리의 값이 변경될 때마다 발생하는 이벤트를 구독하는 기능을 이용할 수 있다. 일례로 이 시스템에 각 서버는 Log size와 Key가 "RS/0"인 Response State의 업데이트 이벤트를 구독한다.Next, a function of subscribing to an event that occurs whenever the value of the Key-Value entry stored in the ETCD is changed can be used. For example, each server in this system subscribes to the update event of Response State with Log size and Key "RS/0".

또한 ETCD를 구성하는 멤버 상태 정보를 확인할 수 있는 기능을 이용할 수 있다.In addition, a function to check the member status information constituting the ETCD can be used.

실행된 서버는 사용자에게 서비스를 제공하고 사용자 요청을 ETCD에 저장하기 위한 리더 서버를 선출한다. 이때 서버는 ETCD에서 제공하는 멤버들의 상태 정보를 확인할 수 있는 기능을 통해 자신과 연결된 ETCD의 상태가 리더인지를 지속적으로 확인하고, 만일 서버에 연결된 ETCD의 상태가 리더라면 해당 서버도 리더 서버가 된다.The running server elects a leader server to serve users and store user requests in the ETCD. At this time, the server continuously checks whether the status of the ETCD connected to itself is a leader through the function to check the status information of members provided by the ETCD, and if the status of the ETCD connected to the server is the leader, the server becomes the leader .

블록체인 응용서비스의 복제 실행 시스템은 클라이언트로부터의 사용자 요청을 먼저 키-값 분산저장소에 저장한 이후에 처리하도록 함으로써, 재난 상태를 대비한 안정적인 실행을 보장할 수 있다.The replication execution system of the blockchain application service can ensure stable execution in preparation for disaster conditions by first storing the user request from the client in the key-value distributed storage and then processing it.

이를 위해, 블록체인 응용서비스의 복제 실행 시스템은 로그 일치 작업을 수행하는 키-값 분산저장소를 이용하여 분산 환경에서 블록체인 응용서비스를 복제 실행하도록 하고, 스마트 컨트랙트를 이용하여 설계한 서비스 레지스트리를 사용해서 서비스의 접근 위치를 수정하거나, 수정된 서비스의 접근 위치를 확인할 수 있게 하여, 서비스 재개했을 때 리더 서버가 변경되더라도 블록체인 응용서비스를 안정적으로 제공할 수 있다.To this end, the replication execution system of the blockchain application service replicates the blockchain application service in a distributed environment using a key-value distributed storage that performs log matching, and uses a service registry designed using a smart contract. Thus, it is possible to modify the access location of the service or to check the access location of the modified service, so that even if the leader server is changed when the service is resumed, the blockchain application service can be provided stably.

또한 서비스 재개했을 때 키-값 분산저장소에 로그화하여 기 저장된 사용자 요청 중, 서비스 실패로 미처리된 사용자 요청이 존재하는지 판단할 수 있도록, 블록체인 응용서비스의 복제 실행 시스템은, 키-값 분산저장소에 현재 저장된 로그 엔트리의 총 개수에 관한 로그 사이즈(N)를, 최근 처리된 사용자 요청의 저장 위치에 관한 최근 처리 인덱스(M)와 비교할 수 있다.In addition, when the service is resumed, the replication execution system of the blockchain application service is a key-value distributed storage system so that it can be determined whether there is an unprocessed user request due to a service failure among pre-stored user requests by logging into the key-value distributed storage. The log size (N) regarding the total number of log entries currently stored in . may be compared with the recent processing index (M) regarding the storage location of the recently processed user request.

로그 사이즈와 최근 처리 인덱스와 일치하지 않을 경우(M<N), 블록체인 응용서비스의 복제 실행 시스템은 최근 처리 인덱스(M)의 다음 인덱스(M+1)에 저장된 사용자 요청을, 미처리된 요청으로서 ETCD로부터 추출하여 처리하고, 처리에 따라 최근 처리 인덱스(M)를 1 증가시킬 수 있다.If the log size and the recent processing index do not match (M<N), the replication execution system of the blockchain application service considers the user request stored in the next index (M+1) of the most recent processing index (M) as an unprocessed request. It is processed by extracting from the ETCD, and according to the processing, the recent processing index (M) may be increased by 1.

증가된 최근 처리 인덱스가 로그 사이즈와 일치하게 되면(M+1=N), 블록체인 응용서비스의 복제 실행 시스템은 리더 서버의 상태가 최신 상태인 것으로 판단할 수 있다.When the increased recent processing index matches the log size (M+1=N), the replication execution system of the blockchain application service can determine that the status of the leader server is up to date.

따라서 본 발명에 의해서는, 키-값 분산저장소의 일례인 ETCD를 이용한 지속적인 동기화를 통해, 복제된 응용서비스가 실행되는 서버들을 최신 상태로 복구시킬 수 있으므로, 네트워크 장애와 같은 재난 상황이 발생되더라도 부작용을 최소화하여 서비스를 안정적으로 제공할 수 있다.Therefore, according to the present invention, through continuous synchronization using ETCD, which is an example of a key-value distributed storage, the servers running the replicated application service can be restored to the latest state, so even if a disaster situation such as a network failure occurs, there is no side effect. service can be provided stably by minimizing

도 5는 본 발명의 일실시예에 따른 블록체인 응용서비스의 복제 실행 시스템의 구성을 도시한 블록도이다.5 is a block diagram showing the configuration of a replication execution system of a block chain application service according to an embodiment of the present invention.

도 5를 참조하면, 본 발명의 일실시예에 따른 블록체인 응용서비스의 복제 실행 시스템(500)은 판단부(510), 저장부(520) 및 처리부(530)를 포함하여 구성할 수 있다. 본 발명의 일실시예에 따른 블록체인 응용서비스의 복제 실행 시스템(500)은 인식부(540), 등록부(550), 및 갱신부(560)를 각각 추가하여 구성할 수 있다.Referring to FIG. 5 , the replication execution system 500 of the block chain application service according to an embodiment of the present invention may include a determination unit 510 , a storage unit 520 , and a processing unit 530 . The replication execution system 500 of the block chain application service according to an embodiment of the present invention may be configured by adding a recognition unit 540 , a registration unit 550 , and an update unit 560 , respectively.

판단부(510)는 클라이언트로부터, 블록체인 응용서비스와 연관된 사용자 요청이 수신됨에 따라, 상기 사용자 요청의 헤더 내에, 서버의 상태 변경, 서버의 상태 유지 및 로그용 기록 중 어느 하나와 연관된 값이 포함되어 있는지 확인하고, 상기 값이 포함되어 있으면, 상기 사용자 요청이 저장 조건을 만족하는 것으로 확인한다.The determination unit 510 includes, in the header of the user request, a value associated with any one of server status change, server status maintenance, and log recording as a user request related to the block chain application service is received from the client. is checked, and if the value is included, it is confirmed that the user request satisfies the storage condition.

만일 어느 하나의 값도 포함되어 있지 않으면, 판단부(510)는 상기 사용자 요청이 상기 저장 조건을 만족하지 않는 것으로 확인하고, 상기 리더 서버에 의한 상기 사용자 요청의 처리를 거절할 수 있다.If none of the values is included, the determination unit 510 may determine that the user request does not satisfy the storage condition, and reject the processing of the user request by the reader server.

실시예에 따라, 블록체인 응용서비스의 복제 실행 시스템(500)은 인식부(540) 및 등록부(550)를 더 포함한다.According to an embodiment, the replication execution system 500 of the blockchain application service further includes a recognition unit 540 and a registration unit 550 .

인식부(540)는, 등록부(550)에 의해 블록체인(502)에 등록된 리더 ID를 리드하고, 상기 리더 ID에 의해 식별되는 서버를, 상기 블록체인 응용서비스를 실행하는 복수의 서버(571, 572)를 대표하는 리더 서버로서 인식한다.The recognition unit 540 reads a reader ID registered in the block chain 502 by the registration unit 550, and identifies a server identified by the reader ID, a plurality of servers 571 executing the block chain application service. , 572) as a representative leader server.

이때 판단부(510)는 상기 리더 ID에 의해 식별되는 서버가, 상기 사용자 요청이 전달된 서버와 일치하는지 확인하고, 일치하지 않으면, 인식부(540)는 상기 사용자 요청이 전달된 서버를, 상기 복수의 서버를 대표하는 새로운 리더 서버로서 인식할 수 있다. 이 경우 등록부(550)는 블록체인(502)에 등록된 상기 리더 ID를 갱신할 수 있다.At this time, the determination unit 510 checks whether the server identified by the reader ID matches the server to which the user request is transmitted, and if not, the recognition unit 540 determines the server to which the user request is transmitted, It can be recognized as a new leader server representing a plurality of servers. In this case, the registration unit 550 may update the reader ID registered in the block chain 502 .

실시예에 따라, 인식부(540)는 상기 사용자 요청이 전달된 서버를, 상기 복수의 서버를 대표하는 리더 서버로서 인식하고, 등록부(550)는 블록체인에 등록된 리더 ID를 갱신할 수 있다(새로운 리더 서버의 등록).According to an embodiment, the recognition unit 540 recognizes the server to which the user request is transmitted as a leader server representing the plurality of servers, and the registration unit 550 may update the leader ID registered in the block chain. (Registration of a new leader server).

저장부(520)는 상기 블록체인 응용서비스를 실행하는 복수의 서버(571, 572)에 각각 연결되는 키-값 분산저장소(581, 582) 중, 리더 서버와 연결된 제1 키-값 분산저장소(581)로부터, 저장된 로그 엔트리의 총 개수에 관한 로그 사이즈를 리드하고, 상기 로그 사이즈를 이용하여, 상기 사용자 요청의 저장 위치를 계산하고, 상기 사용자 요청을, 로그 엔트리로서 상기 저장 위치에 연관시켜 상기 제1 키-값 분산저장소(581)에 저장한다.The storage unit 520 includes a first key-value distributed storage ( 581), read the log size in terms of the total number of stored log entries, use the log size to calculate the storage location of the user request, and associate the user request with the storage location as a log entry. It is stored in the first key-value distributed storage 581 .

실시예에 따라, 블록체인 응용서비스의 복제 실행 시스템(500)은 갱신부(560)를 더 포함한다.According to an embodiment, the replication execution system 500 of the blockchain application service further includes an update unit 560 .

갱신부(560)는 상기 사용자 요청이 상기 제1 키-값 분산저장소(581)에 저장 됨에 따라, 상기 제1 키-값 분산저장소(581)에 기록된 상기 로그 사이즈를 증가시키고, 상기 복수의 서버(571, 572) 중 상기 리더 서버를 제외한 서버로, 상기 로그 사이즈의 증가를 알리는 업데이트 이벤트를 발생한다.The update unit 560 increases the log size recorded in the first key-value distributed storage 581 as the user request is stored in the first key-value distributed storage 581, and the plurality of An update event notifying an increase in the log size is generated among the servers 571 and 572 except for the reader server.

저장부(520)는 상기 업데이트 이벤트를 감지한 서버에 연결되는 제2 키-값 분산저장소(582)에, 상기 사용자 요청을 복사하여, 상기 제1 및 제2 키-값 분산저장소(581, 582) 간 일치 작업을 수행할 수 있다.The storage unit 520 copies the user request to a second key-value distributed storage 582 connected to a server that has detected the update event, and the first and second key-value distributed storage 581 and 582 ) can be matched.

처리부(530)는 상기 제1 키-값 분산저장소(581)에 저장한 상기 사용자 요청을 상기 리더 서버를 통해 처리하여, 상기 클라이언트에 응답한다.The processing unit 530 processes the user request stored in the first key-value distributed storage 581 through the reader server, and responds to the client.

일례로, 처리부(530)는 상기 업데이트 이벤트의 발생에 따라, 상기 리더 서버를 통해 상기 제1 키-값 분산저장소(581)에 저장한 상기 사용자 요청을 처리할 수 있다.For example, the processing unit 530 may process the user request stored in the first key-value distributed storage 581 through the reader server according to the occurrence of the update event.

또한, 처리부(530)는 상기 사용자 요청의 처리 결과가 상기 클라이언트로 전송되면, 상기 리더 서버를 제외한 서버를 통해, 상기 제2 키-값 분산저장소(582)에 복사된 상기 사용자 요청을 처리하여, 상기 복수의 서버(571, 572) 간 상태 동기화를 수행할 수 있다.In addition, when the processing result of the user request is transmitted to the client, the processing unit 530 processes the user request copied to the second key-value distribution storage 582 through a server other than the reader server, State synchronization between the plurality of servers 571 and 572 may be performed.

실시예에 따라 처리부(530)는 상기 사용자 요청이 최신 상태의 리더 서버에서 처리되도록 하기 위해, 판단부(510)를 통해 리더 서버의 상태를 판단, 전환할 수 있다.According to an embodiment, the processing unit 530 may determine and switch the status of the reader server through the determination unit 510 so that the user request is processed by the reader server in the latest state.

구체적으로 판단부(510)는 상기 리더 서버에 의해 최근 처리된 사용자 요청의 저장 위치를 기록한 최근 처리 인덱스를, 상기 제1 키-값 분산저장소로부터 리드하고, 상기 로그 사이즈(N)가 상기 최근 처리 인덱스(M) 보다 클 경우, 상기 리더 서버가 최신 상태가 아닌 것으로 판단하고, 상기 제1 키-값 분산저장소로부터, 상기 최근 처리 인덱스(M)의 이후에 저장된 사용자 요청을 추출하고, 상기 추출한 사용자 요청 중, 상기 리더 서버에 의해 처리가 안된 사용자 요청을 로그용으로 전환하거나, 또는 상기 리더 서버에 의해 처리가 안된 사용자 요청을 상기 리더 서버에 반영하고, 상기 최근 처리 인덱스를 '1'씩 증가시키고, 증가되는 상기 최근 처리 인덱스가, 상기 로그 사이즈와 일치할 경우, 상기 리더 서버를 최신 상태로 판단할 수 있다.Specifically, the determination unit 510 reads a recent processing index that records a storage location of a user request recently processed by the reader server, from the first key-value distribution storage, and the log size (N) is the latest processing index. If it is greater than the index (M), it is determined that the reader server is not up-to-date, and from the first key-value distributed storage, the user request stored after the latest processing index (M) is extracted, and the extracted user During the request, a user request that has not been processed by the reader server is converted to a log, or a user request that has not been processed by the reader server is reflected to the reader server, and the recent processing index is incremented by '1' , when the increased recent processing index coincides with the log size, it is possible to determine the reader server as the latest state.

이처럼 본 발명에 의하면, 클라이언트로부터의 사용자 요청을 키-값 분산저장소에 저장한 이후에 리더 서버에 의해 처리하도록 하고, 재난 상태로 인해 현재 서비스를 제공하는 리더 서버가 실행되지 않을 때, 상태를 동기화하고 있던 복수의 서버 중에 새로운 리더 서버를 키-값 분산저장소를 통해 선출하고 그 새로운 리더 서버가 서비스를 이어 나가도록 함으로써, 장애나 결함 속에서도 복사된 서버로 대처하여 지속적으로 서비스를 재개하거나, 모든 서버가 서비스 상태를 잃어버렸다고 해도, 키-값 분산저장소에 저장되어 있는 로그 엔트리를 독출하여 서비스 상태를 복구할 수 있다.As described above, according to the present invention, the user request from the client is stored in the key-value distributed storage and then processed by the reader server, and when the reader server providing the current service is not running due to a disaster state, the status is synchronized A new leader server is selected from among the plurality of servers in operation through the key-value distributed storage, and the new leader server continues the service, so that even in the event of a failure or defect, the copied server responds to a duplicate server and resumes service continuously, or all servers Even if the service state is lost, the service state can be restored by reading the log entry stored in the key-value distributed storage.

이하, 도 6 내지 도 10에서는 본 발명의 실시 예들에 따른 블록체인 응용서비스의 복제 실행 시스템(500)의 작업 흐름을 상세히 설명한다.Hereinafter, the workflow of the replication execution system 500 of the block chain application service according to embodiments of the present invention will be described in detail with reference to FIGS. 6 to 10 .

도 6 내지 도 10은 본 발명의 일실시예에 따른 블록체인 응용서비스의 복제 실행 방법의 순서를 도시한 흐름도이다.6 to 10 are flowcharts illustrating a sequence of a method for executing replication of a block chain application service according to an embodiment of the present invention.

본 실시예들에 따른 블록체인 응용서비스의 복제 실행 방법은, 상술한 블록체인 응용서비스의 복제 실행 시스템(500)에 의해 수행될 수 있다.The replication execution method of the block chain application service according to the present embodiments may be performed by the above-described block chain application service replication execution system 500 .

도 6에는 클라이언트로부터 수신된 사용자 요청을 리더 서버에 의해 처리하기에 앞서, 분산저장소(ETCD)에 저장하고, 사용자 요청의 저장위치(N+1)를, 분산저장소(ETCD)의 로그 사이즈(N)를 이용하여 계산하는 실시예가 도시된다.In FIG. 6, the user request received from the client is stored in the distributed storage (ETCD) before processing by the reader server, the storage location (N+1) of the user request, and the log size (N) of the distributed storage (ETCD) ), an example of calculating using ) is shown.

본 실시예에서는 일단 수신된 사용자 요청을 로그화하여 분산저장소에 순차적으로 저장한 이후에 리더 서버에서 처리하도록 함으로써, 블록체인 응용서비스의 안정적인 제공이 가능해진다.In this embodiment, once received user requests are logged and stored sequentially in a distributed storage, and then processed by the reader server, stable provision of blockchain application services becomes possible.

사용자 요청의 처리가 중도에 실패하고 서비스 재개되었을 때, 미처리된 사용자 요청은 새로운 리더 서버에서 단순 로그용으로 보관될 수 있다(해당 사용자 요청의 인덱스에 관련있는 latests processed index의 값을 9[로그용]으로 변경).When the processing of a user request fails and the service is resumed, the unprocessed user request can be stored for a simple log in the new reader server (set the value of the latests processed index related to the index of the user request to 9 [for log ]).

도 6을 참조하면, 단계(610 내지 620)에서, 블록체인 응용서비스의 복제 실행 시스템(500)은 클라이언트로부터, 블록체인 응용서비스와 연관된 사용자 요청이 수신됨에 따라, 상기 사용자 요청이 저장 조건을 만족하는지 확인한다.Referring to FIG. 6 , in steps 610 to 620, the block chain application service replication execution system 500 receives a user request related to the block chain application service from the client, and the user request satisfies the storage condition. make sure you do

상기 저장 조건을 만족하는 경우, 단계(630 내지 640)에서 블록체인 응용서비스의 복제 실행 시스템(500)은 상기 리더 서버와 연결된 제1 키-값 분산저장소로부터, 저장된 로그 엔트리의 총 개수에 관한 로그 사이즈(N)를 리드하고, 상기 로그 사이즈를 이용하여, 상기 제1 키-값 분산저장소에 추가될 로그 엔트리의 저장 위치(N+1)를 계산하고, 상기 사용자 요청을, 상기 추가될 로그 엔트리로서 상기 저장 위치(N+1)와 연관시켜서 상기 제1 키-값 분산저장소에 저장한다.If the storage condition is satisfied, the block chain application service replication execution system 500 in steps 630 to 640 logs the total number of stored log entries from the first key-value distributed storage connected to the reader server. Read the size (N), use the log size to calculate a storage location (N+1) of the log entry to be added to the first key-value distributed storage, and send the user request to the log entry to be added. is stored in the first key-value distributed storage in association with the storage location (N+1) as .

단계(650 내지 660)에서 블록체인 응용서비스의 복제 실행 시스템(500)은 기 제1 키-값 분산저장소에 저장한 상기 사용자 요청을 상기 리더 서버를 통해 처리하여, 상기 클라이언트에 응답한다.In steps 650 to 660, the block chain application service replication execution system 500 processes the user request stored in the first key-value distributed storage through the reader server, and responds to the client.

도 7에는, 사용자 요청을 처리하는 동안, 해킹이나 재난이 발생하여, 재난 사태로 인해 현재 서비스를 제공하는 리더 서버가 실패할 경우, 새로운 리더 서비스에 의해 서비스가 재개되었을 때, 분산저장소로부터 기존 리더에 의해 처리된 사용자 요청을 사용하여 현재 리더의 상태에 반영하고, 미처리된 사용자 요청의 상태를 로그용으로 전환하여 리더가 최신상태가 되는 실시예가 도시된다.In FIG. 7 , when hacking or a disaster occurs while processing a user request, when the reader server that provides the current service fails due to a disaster, when the service is resumed by a new reader service, the existing reader from the distributed storage An embodiment is shown in which the status of the current reader is reflected by using the user request processed by , and the status of the unprocessed user request is converted to a log so that the reader is updated.

이를 위해 본 실시예에서는 최근 처리된 사용자 요청의 저장 위치(최근 처리 인덱스)와 분산저장소(ETCD)의 로그 사이즈(N)를 비교하여, 리더 서버가 분산저장소(ETCD)에 저장된 모든 사용자 요청을 처리한 최신의 상태인지 확인하고, 최신 상태가 아닐 경우 분산저장소(ETCD) 내 미처리된 사용자 요청을 처리하도록 하여 최신 상태로 변경, 유지할 수 있다.To this end, in this embodiment, the reader server processes all user requests stored in the distributed storage (ETCD) by comparing the storage location (recent processing index) of the recently processed user requests and the log size (N) of the distributed storage (ETCD). You can check if it is up-to-date, and if it is not, you can change and maintain it up-to-date by processing unprocessed user requests in the distributed storage (ETCD).

도 7을 참조하면, 단계(710)에서 재난 사태로 인해 현재 서비스를 제공하는 리더 서버의 실패가 발생하는지 확인한다.Referring to FIG. 7 , in step 710 , it is checked whether a failure of the reader server currently providing a service occurs due to a disaster.

상기 단계(710)에서의 확인 결과, 실패하지 않은 경우, 블록체인 응용서비스의 복제 실행 시스템(500)은 도 6의 단계(660)로 이동하여, 클라이언트에 처리 결과를 전송한다.As a result of the check in step 710, if there is no failure, the replication execution system 500 of the block chain application service moves to step 660 of FIG. 6 and transmits the processing result to the client.

또는 상기 단계(710)에서의 확인 결과, 실패한 경우, 단계(720 내지 730)에서 블록체인 응용서비스의 복제 실행 시스템(500)은 재개 명령에 따라, 리더 서버에서의 최근 처리 인덱스(M)와 로그 사이즈(N)를 리드하고, 이 둘을 비교한다. 블록체인 응용서비스의 복제 실행 시스템(500)은 최근 처리 인덱스(M)가 로그 사이즈(N) 보다 작은지 비교한다.Or, if it fails as a result of the check in step 710, the replication execution system 500 of the block chain application service in steps 720 to 730 according to the resume command, the latest processing index (M) and log in the leader server Read the size (N) and compare the two. The replication execution system 500 of the blockchain application service compares whether the recent processing index (M) is smaller than the log size (N).

상기 단계(730)에서의 확인 결과, 최근 처리 인덱스(M)가 로그 사이즈(N) 보다 작은 경우, 단계(740 내지 750)에서 블록체인 응용서비스의 복제 실행 시스템(500)은 리더 서버가 최신 상태가 아닌 것으로 판단하고, 리더 서버의 ETCD로부터 인덱스 [M+1]에 저장된 사용자 요청을 추출하고, 추출된 사용자 요청이 미처리 상태인지 확인한다.As a result of the check in step 730, if the recent processing index (M) is smaller than the log size (N), the replication execution system 500 of the block chain application service in steps 740 to 750 indicates that the reader server is up-to-date. is not determined, extracts the user request stored in the index [M+1] from the ETCD of the reader server, and checks whether the extracted user request is in an unprocessed state.

상기 단계(750)에서 미처리 상태로 확인되면, 단계(760, 780)에서 블록체인 응용서비스의 복제 실행 시스템(500)은 미처리된 사용자 요청의 상태를 로그용으로 상태 변경하고, 최근 처리 인덱스(M)을 '1'씩 증가한다.If the unprocessed state is confirmed in step 750, the replication execution system 500 of the block chain application service in steps 760 and 780 changes the state of the unprocessed user request to log, and the latest processing index (M) ) is increased by '1'.

또는, 상기 단계(750)에서 미처리 상태가 아닌 것으로 확인되면, 단계(770, 780)에서 블록체인 응용서비스의 복제 실행 시스템(500)은 처리된 사용자 요청을 현재의 리더 서버의 상태에 반영하고, 최근 처리 인덱스(M)을 '1'씩 증가한다.Alternatively, if it is confirmed that it is not in the unprocessed state in the step 750, the replication execution system 500 of the block chain application service in the steps 770 and 780 reflects the processed user request to the status of the current leader server, The recent processing index (M) is increased by '1'.

블록체인 응용서비스의 복제 실행 시스템(500)은 다시 단계(730)로 이동하여, 단계(780)에서 증가된 최근 처리 인덱스(M)가 여전히 로그 사이즈(N) 보다 작은지 확인한다.The replication execution system 500 of the blockchain application service moves back to step 730 and checks whether the recent processing index (M) increased in step 780 is still smaller than the log size (N).

상기 단계(730)에서의 확인 결과, 증가된 최근 처리 인덱스(M)가 로그 사이즈(N) 보다 여전히 작으면, 블록체인 응용서비스의 복제 실행 시스템(500)은 단계(740 내지 780)을 다시 수행한다.As a result of checking in step 730, if the increased recent processing index M is still smaller than the log size N, the block chain application service replication execution system 500 performs steps 740 to 780 again. do.

또는 상기 단계(730)에서의 확인 결과, 증가된 최근 처리 인덱스(M)가 로그 사이즈(N)와 일치할 경우, 블록체인 응용서비스의 복제 실행 시스템(500)은 단계(790)로 이동하여, 리더 서버를 최신 상태로 판단한다.Or, as a result of checking in step 730, if the increased recent processing index (M) matches the log size (N), the replication execution system 500 of the blockchain application service moves to step 790, The reader server is judged to be up-to-date.

이후 블록체인 응용서비스의 복제 실행 시스템(500)은 도 6의 시작 단계로 이동한다.Thereafter, the replication execution system 500 of the blockchain application service moves to the starting stage of FIG. 6 .

도 8에는, 리더 서버와 연결된 분산저장소(ETCD)에 사용자 요청이 저장 됨에 따라, 업데이트 이벤트 발생을 통해 로그 사이즈를 갱신을 알리고, 리더 서버에 의해 사용자 요청이 처리 됨에 따라, 리더 서버의 상태 변경을 알림으로써, 분산저장소 간 로그 일치 작업 및 서버들 간 상태 동기화를 수행하는 실시예가 도시된다.In FIG. 8, as a user request is stored in a distributed storage (ETCD) connected to the reader server, the log size is updated through an update event, and as the user request is processed by the reader server, the status of the reader server is changed. As a reminder, an embodiment of performing log matching between distributed repositories and state synchronization between servers is shown.

이처럼 본 실시예에서는 로그 일치 작업을 수행하는 분산저장소(ETCD)를 이용한 주기적인 상태 동기화를 실시하여, 블록체인 응용서비스를 복제 실행하는 분산된 서버들을 항상 최신의 상태로 유지, 복구할 수 있으므로, 재난 상황에서도 안정적인 서비스 제공이 가능해진다.As such, in this embodiment, periodic state synchronization using a distributed storage (ETCD) that performs log matching is performed, so that distributed servers that replicate block chain application services can always be maintained and restored in the latest state, It is possible to provide stable service even in a disaster situation.

도 8을 참조하면, 도 6의 단계(640)에서 사용자 요청이 리더 서버와 연결된 제1 ETCD에 저장됨에 따라, 상기 사용자 요청은, 단계(810)에서 ETCD 내에서 Raft 알고리즘에 따라 팔로우 서버와 연결된 제2 ETCD에 복사된다. 본 단계는 리더인 제1 ETCD 내의 로그 엔트리를 기준으로, ETCD 내부적으로 로그 일치 작업이 자동으로 실시되는 과정을 나타낼 수 있다.Referring to FIG. 8 , as the user request is stored in the first ETCD connected to the reader server in step 640 of FIG. 6 , the user request is connected to the follow server according to the Raft algorithm in the ETCD in step 810 . It is copied to the second ETCD. This step may represent a process in which a log matching operation is automatically performed internally in the ETCD based on a log entry in the first ETCD, which is the leader.

단계(820)에서 블록체인 응용서비스의 복제 실행 시스템(500)은 상기 사용자 요청의 저장 및 복사에 따라, 제1 ETCD 및 제2 ETCD 각각의 로그 엔트리의 총 개수가 1개씩 늘어나면, ETCD의 로그 사이즈를 N에서 N+1로 갱신한다.In step 820, the block chain application service replication execution system 500 increases the total number of log entries of each of the first ETCD and the second ETCD by one according to the storage and copying of the user request, the ETCD log Update the size from N to N+1.

단계(830)에서 블록체인 응용서비스의 복제 실행 시스템(500)은 업데이트 이벤트의 발생을 통해, 팔로우 서버로, 갱신된 로그 사이즈의 값(N+1)을 알린다.In step 830, the replication execution system 500 of the blockchain application service notifies the follow server of the updated log size value (N+1) through the occurrence of an update event.

단계(840)에서 블록체인 응용서비스의 복제 실행 시스템(500)은 리더 서버에 의해 사용자 요청이 처리되었는지, 즉 상기 사용자 요청을 처리한 결과가 클라이언트에 응답되었는지 확인한다.In step 840, the replication execution system 500 of the block chain application service checks whether the user request is processed by the reader server, that is, whether the result of processing the user request is responded to the client.

상기 단계(840)에서 사용자 요청이 처리된 것으로 확인되면, 단계(850 내지 860)에서 블록체인 응용서비스의 복제 실행 시스템(500)은 팔로우 서버를 통해서도, 복사된 사용자 요청을 처리하여 리더 서버의 최신 상태에 동기화 하고, 팔로우 서버에서의 최근 처리 인덱스(M)를 '1' 증가시킨다.If it is confirmed that the user request has been processed in step 840, the replication execution system 500 of the block chain application service in steps 850 to 860 processes the copied user request also through the follow server to obtain the latest version of the leader server. Synchronize with the state, and increase the recent processing index (M) in the follow server by '1'.

이처럼 본 발명에 따르면, 팔로우 서버를 리더 서버의 상태에 따라가도록 주기적으로 상태 동기화 함으로써, 리더 서버와 마찬가지로 팔로우 서버도 항상 최신 상태를 유지하도록 할 수 있다.As described above, according to the present invention, by periodically synchronizing the status of the follow server to follow the status of the leader server, it is possible to keep the follow server up to date like the leader server.

도 9는, 도 6의 단계(620)에서 클라이언트로부터 수신되는 사용자 요청이 선정된 저장 조건을 만족하는지 확인하는 실시예를 구체화한 도면이다.FIG. 9 is a detailed diagram of an embodiment of confirming whether a user request received from a client satisfies a predetermined storage condition in step 620 of FIG. 6 .

본 실시예에서는 사용자 요청의 저장 조건을, 사용자 요청을 수신한 서버가 리더 서버이면서, 수신된 사용자 요청의 헤더 내에 'Stateful', 'Stateless' 및 'Successful_TX' 중 어느 하나의 값이 있는 것으로 선정함으로써, 서버의 상태 변경이나 서버의 상태 유지, 또는 로그용 기록에 관련된 사용자 요청을 분산저장소(ETCD)에 저장하고, 이와 관련되지 않은 사용자 요청을 분산저장소(ETCD)에 저장하지 않고 바로 처리하도록 하고 있다.In this embodiment, by selecting the storage condition of the user request that the server receiving the user request is a leader server, any one of 'Stateful', 'Stateless' and 'Successful_TX' is present in the header of the received user request. , user requests related to server state changes, server state maintenance, or log records are stored in the distributed storage (ETCD), and user requests not related to these are processed immediately without storing in the distributed storage (ETCD). .

이처럼 본 실시예에 의하면, 블록체인 응용서비스의 데이터 신뢰성에 영향을 주는 중요도가 높은 사용자 요청이 선별적으로 저장되도록 하여, 분산저장소(ETCD)가 무방비하게 커지는 것을 방지할 수 있다.As described above, according to this embodiment, user requests with high importance affecting data reliability of blockchain application services are selectively stored, thereby preventing the distributed storage (ETCD) from growing defenselessly.

도 9를 참조하면, 단계(910)에서 블록체인 응용서비스의 복제 실행 시스템(500)은 클라이언트로부터 사용자 요청이 수신되면, 해당 사용자 요청으로부터 헤더를 추출한다.Referring to FIG. 9 , in step 910 , when a user request is received from a client, the block chain application service replication execution system 500 extracts a header from the user request.

단계(920 내지 940)에서, 블록체인 응용서비스의 복제 실행 시스템(500)은 추출한 헤더 내에, 서버의 상태 변경에 관한 값('Stateful'), 서버의 상태 유지에 관한 값('Stateless') 및 로그용 기록에 관한 값('Successful_TX'), 'Successful_TX' 중 어느 하나의 값이 포함되어 있으면, 도 6의 단계(630)로 이동하여, 상기 사용자 요청의 저장위치를 계산한다.In steps 920 to 940, the replication execution system 500 of the blockchain application service, in the extracted header, a value related to the server's state change ('Stateful'), a value related to maintaining the server's state ('Stateless'), and If any one of the log record value ('Successful_TX') and 'Successful_TX' is included, the process moves to step 630 of FIG. 6 to calculate the storage location of the user request.

만일 어느 하나의 값도 헤더 내에 없으면, 단계(950)에서 블록체인 응용서비스의 복제 실행 시스템(500)은 리더 서버에 의한 상기 사용자 요청의 처리를 거절한다.If none of the values is in the header, in step 950 , the replication execution system 500 of the block chain application service rejects the processing of the user request by the reader server.

실시예에 따른 방법은 다양한 컴퓨터 수단을 통하여 수행될 수 있는 프로그램 명령 형태로 구현되어 컴퓨터 판독 가능 매체에 기록될 수 있다. 상기 컴퓨터 판독 가능 매체는 프로그램 명령, 데이터 파일, 데이터 구조 등을 단독으로 또는 조합하여 포함할 수 있다. 상기 매체에 기록되는 프로그램 명령은 실시예를 위하여 특별히 설계되고 구성된 것들이거나 컴퓨터 소프트웨어 당업자에게 공지되어 사용 가능한 것일 수도 있다. 컴퓨터 판독 가능 기록 매체의 예에는 하드 디스크, 플로피 디스크 및 자기 테이프와 같은 자기 매체(magnetic media), CD-ROM, DVD와 같은 광기록 매체(optical media), 플롭티컬 디스크(floptical disk)와 같은 자기-광 매체(magneto-optical media), 및 롬(ROM), 램(RAM), 플래시 메모리 등과 같은 프로그램 명령을 저장하고 수행하도록 특별히 구성된 하드웨어 장치가 포함된다. 프로그램 명령의 예에는 컴파일러에 의해 만들어지는 것과 같은 기계어 코드뿐만 아니라 인터프리터 등을 사용해서 컴퓨터에 의해서 실행될 수 있는 고급 언어 코드를 포함한다. 상기된 하드웨어 장치는 실시예의 동작을 수행하기 위해 하나 이상의 소프트웨어 모듈로서 작동하도록 구성될 수 있으며, 그 역도 마찬가지이다.The method according to the embodiment may be implemented in the form of program instructions that can be executed through various computer means and recorded in a computer-readable medium. The computer-readable medium may include program instructions, data files, data structures, etc. alone or in combination. The program instructions recorded on the medium may be specially designed and configured for the embodiment, or may be known and available to those skilled in the art of computer software. Examples of the computer-readable recording medium include magnetic media such as hard disks, floppy disks and magnetic tapes, optical media such as CD-ROMs and DVDs, and magnetic such as floppy disks. - includes magneto-optical media, and hardware devices specially configured to store and carry out program instructions, such as ROM, RAM, flash memory, and the like. Examples of program instructions include not only machine language codes such as those generated by a compiler, but also high-level language codes that can be executed by a computer using an interpreter or the like. The hardware devices described above may be configured to operate as one or more software modules to perform the operations of the embodiments, and vice versa.

소프트웨어는 컴퓨터 프로그램(computer program), 코드(code), 명령(instruction), 또는 이들 중 하나 이상의 조합을 포함할 수 있으며, 원하는 대로 동작하도록 처리 장치를 구성하거나 독립적으로 또는 결합적으로(collectively) 처리 장치를 명령할 수 있다. 소프트웨어 및/또는 데이터는, 처리 장치에 의하여 해석되거나 처리 장치에 명령 또는 데이터를 제공하기 위하여, 어떤 유형의 기계, 구성요소(component), 물리적 장치, 가상 장치(virtual equipment), 컴퓨터 저장 매체 또는 장치, 또는 전송되는 신호 파(signal wave)에 영구적으로, 또는 일시적으로 구체화(embody)될 수 있다. 소프트웨어는 네트워크로 연결된 컴퓨터 시스템 상에 분산되어서, 분산된 방법으로 저장되거나 실행될 수도 있다. 소프트웨어 및 데이터는 하나 이상의 컴퓨터 판독 가능 기록 매체에 저장될 수 있다.The software may comprise a computer program, code, instructions, or a combination of one or more thereof, which configures a processing device to operate as desired or is independently or collectively processed You can command the device. The software and/or data may be any kind of machine, component, physical device, virtual equipment, computer storage medium or device, to be interpreted by or to provide instructions or data to the processing device. , or may be permanently or temporarily embody in a transmitted signal wave. The software may be distributed over networked computer systems, and stored or executed in a distributed manner. Software and data may be stored in one or more computer-readable recording media.

이상과 같이 실시예들이 비록 한정된 도면에 의해 설명되었으나, 해당 기술분야에서 통상의 지식을 가진 자라면 상기를 기초로 다양한 기술적 수정 및 변형을 적용할 수 있다. 예를 들어, 설명된 기술들이 설명된 방법과 다른 순서로 수행되거나, 및/또는 설명된 시스템, 구조, 장치, 회로 등의 구성요소들이 설명된 방법과 다른 형태로 결합 또는 조합되거나, 다른 구성요소 또는 균등물에 의하여 대치되거나 치환되더라도 적절한 결과가 달성될 수 있다.As described above, although the embodiments have been described with reference to the limited drawings, those skilled in the art may apply various technical modifications and variations based on the above. For example, the described techniques are performed in a different order than the described method, and/or the described components of the system, structure, apparatus, circuit, etc. are combined or combined in a different form than the described method, or other components Or substituted or substituted by equivalents may achieve an appropriate result.

그러므로, 다른 구현들, 다른 실시예들 및 특허청구범위와 균등한 것들도 후술하는 청구범위의 범위에 속한다.Therefore, other implementations, other embodiments, and equivalents to the claims are also within the scope of the following claims.

500: 블록체인 응용서비스의 복제 실행 시스템
501: 클라이언트
502: 블록체인
510: 판단부
520: 저장부
530: 처리부
540: 인식부
550: 등록부
560: 갱신부
571, 572: 서버
581, 582: 키-값 분산저장소
500: Replication execution system of blockchain application service
501: client
502: Blockchain
510: judgment unit
520: storage
530: processing unit
540: recognition unit
550: register
560: update
571, 572: server
581, 582: key-value distributed storage

Claims (15)

클라이언트로부터, 블록체인 응용서비스와 연관된 사용자 요청이 수신됨에 따라,
상기 사용자 요청의 헤더 내에, 서버의 상태 변경, 서버의 상태 유지 및 로그용 기록 중 어느 하나와 연관된 값이 포함되어 있는지 확인하는 단계;
상기 값이 포함되어 있으면, 상기 사용자 요청이 저장 조건을 만족하는 것으로 확인하는 단계;
상기 블록체인 응용서비스를 실행하는 복수의 서버에 각각 연결되는 키-값 분산저장소 중, 리더 서버와 연결된 제1 키-값 분산저장소로부터, 저장된 로그 엔트리의 총 개수에 관한 로그 사이즈(N)를 리드하는 단계;
상기 리더 서버에 의해 최근 처리된 사용자 요청의 저장 위치를 기록한 최근 처리 인덱스(M)를, 상기 제1 키-값 분산저장소로부터 리드하는 단계;
상기 로그 사이즈(N)가, 상기 최근 처리 인덱스(M) 보다 클 경우, 상기 리더 서버가 최신 상태가 아닌 것으로 판단하는 단계;
상기 제1 키-값 분산저장소로부터, 상기 최근 처리 인덱스(M)의 이후에 저장된 사용자 요청을 추출하는 단계;
상기 추출한 사용자 요청 중, 상기 리더 서버에 의해 처리가 안된 사용자 요청을 로그용으로 전환하거나, 또는 상기 리더 서버에 의해 처리가 안된 사용자 요청을 상기 리더 서버에 반영하고, 상기 최근 처리 인덱스(M)를 '1'씩 증가시키는 단계;
증가되는 상기 최근 처리 인덱스가, 상기 로그 사이즈(N)와 일치할 경우, 상기 리더 서버를 최신 상태로 판단하는 단계;
상기 리더 서버가 최신 상태로 판단됨에 따라,
상기 로그 사이즈(N)를 이용하여, 상기 사용자 요청의 저장 위치를 계산하는 단계;
상기 사용자 요청을, 로그 엔트리로서 상기 저장 위치에 연관시켜 상기 제1 키-값 분산저장소에 저장하는 단계; 및
상기 제1 키-값 분산저장소에 저장한 상기 사용자 요청을, 최신 상태의 상기 리더 서버를 통해 처리하여, 상기 클라이언트에 응답하는 단계
를 포함하는 블록체인 응용서비스의 복제 실행 방법.
As a user request related to the blockchain application service is received from the client,
checking whether the header of the user request includes a value associated with any one of server status change, server status maintenance, and log recording;
if the value is included, confirming that the user request satisfies a storage condition;
The log size (N) for the total number of stored log entries is read from the first key-value distributed storage connected to the reader server among the key-value distributed storage connected to the plurality of servers running the blockchain application service. to do;
reading a recent processing index (M) in which a storage location of a user request recently processed by the reader server is recorded, from the first key-value distributed storage;
determining that the reader server is not up-to-date when the log size (N) is larger than the recent processing index (M);
extracting, from the first key-value distributed storage, a user request stored after the recent processing index (M);
Among the extracted user requests, a user request that has not been processed by the reader server is converted to a log, or a user request that has not been processed by the reader server is reflected to the reader server, and the latest processing index (M) incrementing by '1';
determining the reader server as the latest state when the increased recent processing index coincides with the log size (N);
As the leader server is determined to be up-to-date,
calculating a storage location of the user request by using the log size (N);
storing the user request in the first key-value distributed repository associating the user request to the storage location as a log entry; and
responding to the client by processing the user request stored in the first key-value distributed storage through the up-to-date reader server
A method for executing replication of blockchain application services, including
제1항에 있어서,
상기 사용자 요청이 상기 제1 키-값 분산저장소에 저장 됨에 따라,
상기 제1 키-값 분산저장소에 기록된 상기 로그 사이즈를 증가시키는 단계;
상기 복수의 서버 중 상기 리더 서버를 제외한 서버로, 상기 로그 사이즈의 증가를 알리는 업데이트 이벤트를 발생하는 단계; 및
상기 업데이트 이벤트를 감지한 서버에 연결되는 제2 키-값 분산저장소에, 상기 사용자 요청을 복사하여, 상기 제1 및 제2 키-값 분산저장소 간 일치 작업을 수행하는 단계
를 더 포함하는 블록체인 응용서비스의 복제 실행 방법.
According to claim 1,
As the user request is stored in the first key-value distributed storage,
increasing the log size recorded in the first key-value distributed storage;
generating an update event notifying an increase in the log size to a server other than the reader server among the plurality of servers; and
Copying the user request to a second key-value distributed storage connected to a server that has detected the update event, and performing a matching operation between the first and second key-value distributed storage
A replication execution method of the blockchain application service further comprising a.
제2항에 있어서,
상기 업데이트 이벤트의 발생에 따라, 상기 리더 서버를 통해 상기 제1 키-값 분산저장소에 저장한 상기 사용자 요청을 처리하는 단계; 및
상기 사용자 요청의 처리 결과가 상기 클라이언트로 전송되면,
상기 리더 서버를 제외한 서버를 통해, 상기 제2 키-값 분산저장소에 복사된 상기 사용자 요청을 처리하여, 상기 복수의 서버 간 상태 동기화를 수행하는 단계
를 더 포함하는 블록체인 응용서비스의 복제 실행 방법.
3. The method of claim 2,
processing the user request stored in the first key-value distributed storage through the reader server according to the occurrence of the update event; and
When the processing result of the user request is transmitted to the client,
performing state synchronization between the plurality of servers by processing the user request copied to the second key-value distributed storage through a server other than the reader server
A replication execution method of the blockchain application service further comprising a.
제1항에 있어서,
블록체인에 등록된 리더 ID를 리드하는 단계; 및
상기 리더 ID에 의해 식별되는 서버를, 상기 복수의 서버를 대표하는 리더 서버로서 인식하는 단계
를 더 포함하는 블록체인 응용서비스의 복제 실행 방법.
According to claim 1,
reading the leader ID registered in the block chain; and
Recognizing the server identified by the reader ID as a reader server representing the plurality of servers
A replication execution method of the blockchain application service further comprising a.
제1항에 있어서,
상기 사용자 요청이 전달된 서버를, 상기 복수의 서버를 대표하는 리더 서버로서 인식하는 단계; 및
블록체인에 등록된 리더 ID를 갱신하는 단계
를 더 포함하는 블록체인 응용서비스의 복제 실행 방법.
According to claim 1,
recognizing the server to which the user request is transmitted as a reader server representing the plurality of servers; and
Steps to renew the leader ID registered in the blockchain
A replication execution method of the blockchain application service further comprising a.
삭제delete 제1항에 있어서,
상기 값이 포함되어 있지 않으면, 상기 사용자 요청이 상기 저장 조건을 만족하지 않는 것으로 확인하는 단계; 및
상기 리더 서버에 의한 상기 사용자 요청의 처리를 거절하는 단계
를 더 포함하는 블록체인 응용서비스의 복제 실행 방법.
According to claim 1,
if the value is not included, confirming that the user request does not satisfy the storage condition; and
Rejecting the processing of the user request by the reader server
A replication execution method of the blockchain application service further comprising a.
제1항 내지 제5항, 제7항 중 어느 한 항의 방법을 실행시키기 위한 프로그램을 기록한 컴퓨터 판독 가능한 기록매체.A computer-readable recording medium in which a program for executing the method of any one of claims 1 to 5 and 7 is recorded. 클라이언트로부터, 블록체인 응용서비스와 연관된 사용자 요청이 수신됨에 따라, 상기 사용자 요청의 헤더 내에, 서버의 상태 변경, 서버의 상태 유지 및 로그용 기록 중 어느 하나와 연관된 값이 포함되어 있는지 확인하고, 상기 값이 포함되어 있으면, 상기 사용자 요청이 저장 조건을 만족하는 것으로 확인하는 판단부;
상기 블록체인 응용서비스를 실행하는 복수의 서버에 각각 연결되는 키-값 분산저장소 중, 리더 서버와 연결된 제1 키-값 분산저장소로부터, 저장된 로그 엔트리의 총 개수에 관한 로그 사이즈(N)를 리드하고, 상기 로그 사이즈(N)를 이용하여, 상기 사용자 요청의 저장 위치를 계산하고, 상기 사용자 요청을, 로그 엔트리로서 상기 저장 위치에 연관시켜 상기 제1 키-값 분산저장소에 저장하는 저장부; 및
상기 제1 키-값 분산저장소에 저장한 상기 사용자 요청을 상기 리더 서버를 통해 처리하여, 상기 클라이언트에 응답하는 처리부
를 포함하고,
상기 판단부는,
상기 리더 서버에 의해 최근 처리된 사용자 요청의 저장 위치를 기록한 최근 처리 인덱스(M)를, 상기 제1 키-값 분산저장소로부터 리드하고,
상기 로그 사이즈(N)가, 상기 최근 처리 인덱스(M) 보다 클 경우, 상기 리더 서버가 최신 상태가 아닌 것으로 판단하고, 상기 제1 키-값 분산저장소로부터, 상기 최근 처리 인덱스(M)의 이후에 저장된 사용자 요청을 추출하고,
상기 추출한 사용자 요청 중, 상기 리더 서버에 의해 처리가 안된 사용자 요청을 로그용으로 전환하거나, 또는 상기 리더 서버에 의해 처리가 안된 사용자 요청을 상기 리더 서버에 반영하고, 상기 최근 처리 인덱스(M)를 '1'씩 증가시키고, 증가되는 상기 최근 처리 인덱스가, 상기 로그 사이즈(N)와 일치할 경우, 상기 리더 서버를 최신 상태로 판단하고,
상기 리더 서버가 최신 상태로 판단됨에 따라,
상기 저장부는,
상기 사용자 요청을, 상기 로그 사이즈(N)를 이용하여 계산된 상기 사용자 요청의 저장 위치에 연관시켜, 로그 엔트리로서 상기 제1 키-값 분산저장소에 저장하고,
상기 처리부는,
상기 제1 키-값 분산저장소에 저장한 상기 사용자 요청을, 최신 상태의 상기 리더 서버를 통해 처리하는
블록체인 응용서비스의 복제 실행 시스템.
As a user request related to the blockchain application service is received from the client, it is checked whether a value associated with any one of server status change, server status maintenance, and log record is included in the header of the user request, and the a determination unit that confirms that the user request satisfies a storage condition if the value is included;
The log size (N) for the total number of stored log entries is read from the first key-value distributed storage connected to the reader server among the key-value distributed storage connected to the plurality of servers running the blockchain application service. a storage unit for calculating a storage location of the user request by using the log size (N) and storing the user request in the first key-value distributed storage by associating the user request with the storage location as a log entry; and
A processing unit responding to the client by processing the user request stored in the first key-value distributed storage through the reader server
including,
The judging unit,
Reading a recent processing index (M) recording a storage location of a user request recently processed by the reader server, from the first key-value distributed storage,
When the log size (N) is larger than the recent processing index (M), it is determined that the reader server is not up-to-date, and from the first key-value distribution storage, after the latest processing index (M) extract the user request stored in
Among the extracted user requests, a user request that has not been processed by the reader server is converted to a log, or a user request that has not been processed by the reader server is reflected to the reader server, and the latest processing index (M) Incremented by '1', and when the incremented latest processing index matches the log size (N), it is determined that the reader server is up-to-date;
As the leader server is determined to be up-to-date,
The storage unit,
associating the user request with a storage location of the user request calculated using the log size N, and storing it in the first key-value distributed storage as a log entry;
The processing unit,
processing the user request stored in the first key-value distributed storage through the up-to-date reader server
A replication execution system of blockchain application services.
제9항에 있어서,
상기 블록체인 응용서비스의 복제 실행 시스템은,
상기 사용자 요청이 상기 제1 키-값 분산저장소에 저장 됨에 따라,
상기 제1 키-값 분산저장소에 기록된 상기 로그 사이즈를 증가시키고, 상기 복수의 서버 중 상기 리더 서버를 제외한 서버로, 상기 로그 사이즈의 증가를 알리는 업데이트 이벤트를 발생하는 갱신부
를 더 포함하고,
상기 저장부는,
상기 업데이트 이벤트를 감지한 서버에 연결되는 제2 키-값 분산저장소에, 상기 사용자 요청을 복사하여, 상기 제1 및 제2 키-값 분산저장소 간 일치 작업을 수행하는
블록체인 응용서비스의 복제 실행 시스템.
10. The method of claim 9,
The replication execution system of the blockchain application service is,
As the user request is stored in the first key-value distributed storage,
An update unit that increases the log size recorded in the first key-value distributed storage and generates an update event for notifying an increase in the log size to a server other than the leader server among the plurality of servers
further comprising,
The storage unit,
Copying the user request to a second key-value distributed storage connected to a server that has detected the update event, and performing a matching operation between the first and second key-value distributed storage
A replication execution system of blockchain application services.
제10항에 있어서,
상기 처리부는,
상기 업데이트 이벤트의 발생에 따라, 상기 리더 서버를 통해 상기 제1 키-값 분산저장소에 저장한 상기 사용자 요청을 처리하고,
상기 사용자 요청의 처리 결과가 상기 클라이언트로 전송되면,
상기 리더 서버를 제외한 서버를 통해, 상기 제2 키-값 분산저장소에 복사된 상기 사용자 요청을 처리하여, 상기 복수의 서버 간 상태 동기화를 수행하는
블록체인 응용서비스의 복제 실행 시스템.
11. The method of claim 10,
The processing unit,
processing the user request stored in the first key-value distributed storage through the reader server according to the occurrence of the update event;
When the processing result of the user request is transmitted to the client,
Process the user request copied to the second key-value distributed storage through a server other than the reader server to perform state synchronization between the plurality of servers
A replication execution system of blockchain application services.
제9항에 있어서,
상기 블록체인 응용서비스의 복제 실행 시스템은,
등록부에 의해 블록체인에 등록된 리더 ID를 리드하고, 상기 리더 ID에 의해 식별되는 서버를, 상기 복수의 서버를 대표하는 리더 서버로서 인식하는 인식부
를 더 포함하는 블록체인 응용서비스의 복제 실행 시스템.
10. The method of claim 9,
The replication execution system of the blockchain application service is,
A recognition unit that reads a reader ID registered in the block chain by the registration unit, and recognizes a server identified by the reader ID as a leader server representing the plurality of servers
A replication execution system of the blockchain application service further comprising a.
제9항에 있어서,
상기 블록체인 응용서비스의 복제 실행 시스템은,
상기 사용자 요청이 전달된 서버를, 상기 복수의 서버를 대표하는 리더 서버로서 인식하고, 등록부를 통해, 블록체인에 등록된 리더 ID를 갱신하는 인식부
를 더 포함하는 블록체인 응용서비스의 복제 실행 시스템.
10. The method of claim 9,
The replication execution system of the blockchain application service is,
A recognition unit that recognizes the server to which the user request is transmitted as a leader server representing the plurality of servers, and updates the leader ID registered in the block chain through the registration unit
A replication execution system of the blockchain application service further comprising a.
삭제delete 제9항에 있어서,
상기 판단부는,
상기 값이 포함되어 있지 않으면, 상기 사용자 요청이 상기 저장 조건을 만족하지 않는 것으로 확인하고, 상기 리더 서버에 의한 상기 사용자 요청의 처리를 거절하는
블록체인 응용서비스의 복제 실행 시스템.
10. The method of claim 9,
The judging unit,
If the value is not included, confirming that the user request does not satisfy the storage condition, and rejecting the processing of the user request by the reader server
A replication execution system of blockchain application services.
KR1020200036888A 2020-03-26 2020-03-26 Method and system for replicating blockchain application service KR102294048B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020200036888A KR102294048B1 (en) 2020-03-26 2020-03-26 Method and system for replicating blockchain application service

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020200036888A KR102294048B1 (en) 2020-03-26 2020-03-26 Method and system for replicating blockchain application service

Publications (1)

Publication Number Publication Date
KR102294048B1 true KR102294048B1 (en) 2021-08-25

Family

ID=77494981

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020200036888A KR102294048B1 (en) 2020-03-26 2020-03-26 Method and system for replicating blockchain application service

Country Status (1)

Country Link
KR (1) KR102294048B1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102672013B1 (en) * 2022-03-14 2024-06-04 계명대학교 산학협력단 Blockchain data storage method and storage management device for service provision

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
"A brief overview of the Raft algorithm", https://blog.carlosgaldino.com/a-brief-overview-of-the-raft-algorithm.html(2016.07.11.)* *
"Build and run a smart contract on a Hyperledger Fabric network with the Raft ordering service", https://github.com/IBM/raft-fabric-sample(2020.03.19)* *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102672013B1 (en) * 2022-03-14 2024-06-04 계명대학교 산학협력단 Blockchain data storage method and storage management device for service provision

Similar Documents

Publication Publication Date Title
CN103226502B (en) A kind of data calamity is for control system and data reconstruction method
US7882079B2 (en) Database system configured for automatic failover with user-limited data loss
TW497071B (en) Method and apparatus for managing clustered computer systems
US5884328A (en) System and method for sychronizing a large database and its replica
US8255369B2 (en) Automatic failover configuration with lightweight observer
US8417670B1 (en) Dynamic membership management in a distributed system
US7734596B2 (en) Automatic failover configuration with redundant abservers
US7725766B2 (en) System for synchronizing replicas of a database
US8306947B2 (en) Replication of operations on objects distributed in a storage system
CN101933014B (en) System and method for replication and synchronisation
US20150347250A1 (en) Database management system for providing partial re-synchronization and partial re-synchronization method of using the same
CN102656565A (en) Failover and recovery for replicated data instances
US11269927B2 (en) Transactional replicator
WO2021103499A1 (en) Multi-active data center-based traffic switching method and device
US20030050930A1 (en) Method and apparatus for lockstep data replication
CN106339278A (en) Data backup and recovery method for network file system
US11537314B1 (en) Resynchronization of individual volumes of a consistency group (CG) within a cross-site storage solution while maintaining synchronization of other volumes of the CG
JP2007518195A (en) Cluster database using remote data mirroring
US20230004465A1 (en) Distributed database system and data disaster backup drilling method
US8458803B2 (en) Global account lockout (GAL) and expiration using an ordered message service (OMS)
KR102294048B1 (en) Method and system for replicating blockchain application service
JP2004272318A (en) System changeover system, processing method therefor, and processing program therefor
KR20160025995A (en) Cluster management method and data storage system for watching state and changing form of cluster having fault tolerance
CN114442947B (en) Cross-domain bucket deleting method, system, terminal and storage medium
CN117874145A (en) Strong agreement method, device, equipment and storage medium for master-slave database

Legal Events

Date Code Title Description
E701 Decision to grant or registration of patent right
GRNT Written decision to grant