KR20190139006A - Distributed Messaging System and Method for Dynamic Partitioning in Distributed Messaging System - Google Patents

Distributed Messaging System and Method for Dynamic Partitioning in Distributed Messaging System Download PDF

Info

Publication number
KR20190139006A
KR20190139006A KR1020180065462A KR20180065462A KR20190139006A KR 20190139006 A KR20190139006 A KR 20190139006A KR 1020180065462 A KR1020180065462 A KR 1020180065462A KR 20180065462 A KR20180065462 A KR 20180065462A KR 20190139006 A KR20190139006 A KR 20190139006A
Authority
KR
South Korea
Prior art keywords
consumer
partition
partitions
messages
assigned
Prior art date
Application number
KR1020180065462A
Other languages
Korean (ko)
Other versions
KR102124897B1 (en
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 KR1020180065462A priority Critical patent/KR102124897B1/en
Publication of KR20190139006A publication Critical patent/KR20190139006A/en
Application granted granted Critical
Publication of KR102124897B1 publication Critical patent/KR102124897B1/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/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]
    • H04L67/16
    • H04L67/2804
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/51Discovery or management thereof, e.g. service location protocol [SLP] or web services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/561Adding application-functional data or data for application control, e.g. adding metadata

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Library & Information Science (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

Disclosed in the present invention are a distributed messaging system and a dynamic partitioning method in the distributed messaging system. According to an embodiment of the present invention, the dynamic partitioning method in the distributed messaging system may comprise the steps of: determining whether a consumer having no allocated partition exists among a plurality of consumers; equally dividing messages remaining in a first partition in half among the plurality of partitions, creating two new partitions, and storing the equally divided messages in the two new partitions, respectively; allocating the two new partitions to the consumer having no allocated partition and a consumer that was assigned to the first partition, respectively; and updating metadata including list information about partitions and mapping information between each consumer and partitions assigned to each consumer.

Description

분산 메시지 시스템 및 분산 메시지 시스템에서의 동적 파티셔닝 방법 {Distributed Messaging System and Method for Dynamic Partitioning in Distributed Messaging System}Distributed Partitioning System and Method for Dynamic Partitioning in Distributed Messaging System

본 발명은 분산 메시지 시스템 및 분산 메시지 시스템에서의 메시지 처리 방법에 관한 것으로서, 보다 상세하게는, 분산 메시지 시스템에서 메시지를 동적으로 파티셔닝하는 방법 및 이러한 방법이 적용된 분산 메시지 시스템에 관한 것이다.The present invention relates to a distributed message system and a message processing method in a distributed message system, and more particularly, to a method for dynamically partitioning a message in a distributed message system and a distributed message system to which the method is applied.

분산 메시지 시스템(distributed messaging system)은 다양한 형태의 분산 컴퓨터 시스템 및 플랫폼에서 메시지들을 효과적으로 전달하기 위해 고안되었으며, 현재 오픈 소스 기반의 여러 솔루션들 존재한다. 구체적인 솔루션의 예로는, ActiveMQ, Kafka, RabbitMQ 등을 들 수 있다.Distributed messaging systems are designed to effectively deliver messages in various forms of distributed computer systems and platforms, and there are currently several open source based solutions. Examples of specific solutions include ActiveMQ, Kafka, RabbitMQ, and the like.

이 중에서 아파치 카프카(Apache kafka)는 기존의 중앙 집중적인 아키텍처(centralized architecture)에 기반한 다른 솔루션들과는 달리 완전 분산(fully-distributed) 형태의 메시지 시스템을 구현하고 있다. 이러한 아파치 카프카에 의하면, 다수의 컨슈머(consumer)들이 전통적인 큐 방식으로 메시지들을 공유할 수 있고, 특정 토픽(topic)을 중심으로 퍼블리시-서브스크라이브(publish-subcribe) 형태로 다중 메시지를 전달하는 것도 가능하다. Among these, Apache kafka implements a fully-distributed message system, unlike other solutions based on existing centralized architectures. According to this Apache Kafka, multiple consumers can share messages in a traditional queue manner and deliver multiple messages in a publish-subcribe form around a specific topic. It is possible.

기존의 아파치 카프카와 같은 완전 분산(fully-distributed) 형태의 메시지 시스템은 병렬성(parallelism)을 극대화하기 위해 하나의 메시지 파티션에 대해 하나의 컨슈머(consumer)만 접근하도록 구성된다. 또한, 기존의 완전 분산 형태의 메시지 시스템은 전체 메시지들을 다수의 파티션들로 분할하고 이들을 여러 서버에 나누어 저장하기 위해 정적 분할(static partitioning) 기법(scheme)을 사용한다. 즉, 기존의 완전 분산 형태의 메시지 시스템은 전체 메시지들을 동일하게 나누어서 각 파티션들에 저장한다. 이러한 정적 분할 방식은 각 컨슈머들의 처리 성능에 차이가 없고, 전체 메시지 크기만이 전체 시스템의 성능에 영향을 미친다고 가정하고 있다. 그러나, 컨슈머들의 처리 성능에는 차이가 있을 수 있고, 단순히 메시지를 전달하는 것 뿐 아니라 대규모 태스크들로 구성된 MTC(Many-Task Computing)에 있어서, 정적 분할 방식은 심각한 로드 밸런싱 문제를 야기할 수 있다. A fully-distributed message system, such as the traditional Apache Kafka, is configured to access only one consumer to one message partition in order to maximize parallelism. In addition, existing fully distributed message systems use a static partitioning scheme to partition the entire message into multiple partitions and store them across multiple servers. In other words, the existing fully distributed message system divides all the messages equally and stores them in each partition. This static partitioning method assumes that there is no difference in processing performance of each consumer, and that only the overall message size affects the performance of the entire system. However, there may be differences in the processing power of consumers, and for not only delivering messages but also for many-task computing (MTC) consisting of large tasks, static partitioning can cause serious load balancing problems.

또한, 메시지 하나가 실제 연산을 수행하는 태스크로 활용되는 경우, 각각의 태스크가 실행되는 시간에는 편차가 있을 수 있다. 따라서, 다른 컨슈머들보다 일찍 담당 파티션에 대한 처리를 끝내는 컨슈머가 생겨날 수 있다. 이러한 경우, 전체적으로 처리해야 하는 파티션에 비해 컨슈머의 수가 더 많아지므로, 카프카(Kafka)와 같은 완전 분산 형태의 메시지 시스템은, 재분배(re-balancing) 작업을 통해 전체 메시지 파티션들을 재분배하는 작업을 수행한다. 그러나, 이러한 재분배 작업이 일어나는 동안에는 메시지 처리가 불가능한 문제가 있다. 특히, 새롭게 메시지 처리 작업에 참여하는 컨슈머들의 수가 많아지거나, 다른 컨슈머들보다 먼저 메시지 처리를 완료한 컨슈머들의 수가 많아질수록 재분배 작업이 많이 또는 오래 수행되어야 하므로, 전체적인 시스템 성능에 심각한 악영향을 미칠 수 있다.In addition, when one message is used as a task for performing an actual operation, there may be a deviation in time at which each task is executed. Thus, a consumer may end up processing the responsible partition earlier than other consumers. In this case, the number of consumers is larger than the partitions to be processed as a whole, so a fully distributed message system such as Kafka performs redistribution of all message partitions through re-balancing. . However, there is a problem that message processing is impossible while such a redistribution operation takes place. In particular, as the number of consumers newly participating in the message processing task or the number of consumers who finished processing the message before other consumers increases, the redistribution work must be performed more or longer, which may seriously affect the overall system performance. have.

본 발명은, 상기와 같은 문제점을 인식하여 창안된 것으로서, 기존의 완전 분산(fully-distributed) 형태의 메시지 시스템과 같이 병렬성을 극대화하면서도, 시스템 성능을 높일 수 있는 완전 분산 형태의 메시지 시스템을 제공하는 것을 목적으로 한다.The present invention has been made in view of the above problems, and provides a fully distributed message system that can increase system performance while maximizing parallelism as in a fully-distributed message system. For the purpose of

또한, 본 발명은, 각각의 메시지 처리에 소요되는 시간이 다양한 경우(예컨대, MTC(Many-Task Computing) 과학 응용 처리), 완전 분산 형태의 메시지 시스템에서 최소한의 노력으로 메시지 파티션을 동적으로 분할함으로써 로드 밸런싱을 개선하고 전체적인 시스템 성능 향상에 기여할 수 있는 알고리즘을 제공하는 것을 목적으로 한다. In addition, the present invention can be achieved by dynamically partitioning message partitions with minimal effort in a fully distributed message system, when the time required to process each message varies (e.g., many-task computing scientific applications). The goal is to provide algorithms that can improve load balancing and contribute to overall system performance.

상기 목적을 달성하기 위해 본 발명의 일 측면에 따른 분산 메시지 시스템이 개시된다. In order to achieve the above object, a distributed message system according to an aspect of the present invention is disclosed.

(1) 본 발명의 일 실시예에 다른 분산 메시지 시스템은, 메시지들을 분할 저장하는 복수의 파티션들; 복수의 컨슈머들을 포함하는 컨슈머 그룹 - 하나의 파티션에 저장된 메시지들은 상기 컨슈머 그룹에 포함된 하나의 컨슈머에 의해 처리되고; 및 상기 복수의 파티션들에 대한 리스트 정보, 및 각 컨슈머와 상기 각 컨슈머에 할당된 파티션 간의 매핑 정보를 포함하는 메타 데이터를 관리하는 메시지 파티셔닝 모듈;을 포함할 수 있다.(1) Another distributed message system according to an embodiment of the present invention includes: a plurality of partitions for dividing and storing messages; A consumer group comprising a plurality of consumers, wherein messages stored in one partition are processed by one consumer included in the consumer group; And a message partitioning module that manages metadata including list information about the plurality of partitions and mapping information between each consumer and partitions assigned to each consumer.

(2) 상기 (1) 에 있어서, 상기 메시지 파티셔닝 모듈은, 동적 재분배 오퍼레이션이 수행될 때 마다 상기 메타 데이터를 업데이트할 수 있다.(2) In (1), the message partitioning module can update the metadata each time a dynamic redistribution operation is performed.

(3) 상기 (2) 에 있어서, 상기 동적 재분배 오퍼레이션은, 소정 주기에 따라, 또는 상기 컨슈머 그룹에 변화가 발생할 때 마다 수행될 수 있다.(3) In (2), the dynamic redistribution operation can be performed according to a predetermined period or whenever a change occurs in the consumer group.

(4) 상기 (3) 에 있어서, 상기 컨슈머 그룹에 변화가 발생하는 경우는, 상기 컨슈머 그룹에 새로운 컨슈머가 참여하는 경우, 상기 복수의 컨슈머들 중 적어도 하나의 컨슈머가 자신에게 할당된 파티션에 저장된 메시지를 모두 처리한 경우, 및 상기 복수의 컨슈머들 중 적어도 하나의 컨슈머가 자신에게 할당된 파티션에 저장된 메시지를 처리하지 못하고 종료된 경우 중 어느 하나일 수 있다.(4) In (3), when a change occurs in the consumer group, when a new consumer participates in the consumer group, at least one consumer among the plurality of consumers is stored in a partition assigned to the consumer group. It may be one of the case where all messages are processed and at least one of the plurality of consumers is terminated without processing the message stored in the partition allocated to the consumer.

(5) 상기 (2) 내지 (4) 중 어느 하나에 있어서, 상기 동적 재분배 오퍼레이션은 상기 메시지 파티셔닝 모듈에 의해 수행되는 것으로서: 상기 복수의 컨슈머들 중에서 할당된 파티션이 없는 컨슈머가 존재하는지 판단하는 프로세스; 복수의 파티션들 중에서 제1 파티션에 남아 있는 메시지들을 반으로 균등 분할하고, 2개의 신규 파티션을 생성하여 상기 균등 분할된 메시지들을 상기 2개의 신규 파티션에 각각 저장하는 프로세스; 및 상기 할당된 파티션이 없는 컨슈머와, 상기 제1 파티션에 할당되었던 컨슈머에 상기 2개의 신규 파티션을 각각 할당하는 프로세스; 를 포함할 수 있다.(5) The process according to any one of (2) to (4), wherein the dynamic redistribution operation is performed by the message partitioning module: a process of determining whether there is a consumer without an assigned partition among the plurality of consumers. ; Equally dividing the messages remaining in the first partition among the plurality of partitions in half, creating two new partitions, and storing the equally divided messages in the two new partitions, respectively; Allocating the two new partitions to a consumer without the assigned partition and a consumer that has been assigned to the first partition; It may include.

(6) 상기 (5) 에 있어서, 상기 판단하는 프로세스 이전에, 상기 메타 데이터를 생성하는 프로세스;를 더 포함할 수 있다.(6) In the above (5), the process of generating the metadata before the determining process may further include.

(7) 상기 (5) 및 (6) 중 어느 하나에 있어서, 상기 제1 파티션은 상기 복수의 파티션들 중에서 처리되어야 할 메시지들이 가장 많이 남은 파티션일 수 있다.(7) In any one of (5) and (6), the first partition may be a partition having the most messages to be processed among the plurality of partitions.

(8) 상기 (5) 내지 (7) 중 어느 하나에 있어서, 상기 판단하는 프로세스 이후에, 상기 제1 파티션에 남아 있는 메시지의 수를 임계값과 비교하는 프로세스; 를 더 포함할 수 있다.(8) the process according to any one of (5) to (7), wherein after the determining, comparing the number of messages remaining in the first partition with a threshold; It may further include.

(9) 상기 (1) 내지 (8) 중 어느 하나에 있어서, 상기 메타 데이터는, 상기 복수의 컨슈머들에 대한 리스트 정보를 더 포함할 수 있다.(9) In any one of (1) to (8), the metadata may further include list information about the plurality of consumers.

상기 목적을 달성하기 위해 본 발명의 다른 측면에 따른 동적 파티셔닝 방법이 개시된다.In order to achieve the above object, a dynamic partitioning method according to another aspect of the present invention is disclosed.

(10) 본 발명의 일 실시예에 따른 동적 파티셔닝 방법은, 복수의 컨슈머들 중에서 할당된 파티션이 없는 컨슈머가 존재하는지 판단하는 단계; 복수의 파티션들 중에서 제1 파티션에 남아 있는 메시지들을 반으로 균등 분할하고, 2개의 신규 파티션을 생성하여 상기 균등 분할된 메시지들을 상기 2개의 신규 파티션에 각각 저장하는 단계; 상기 할당된 파티션이 없는 컨슈머와, 상기 제1 파티션에 할당되었던 컨슈머에 상기 2개의 신규 파티션을 각각 할당하는 단계; 및 파티션들에 대한 리스트 정보 및 각 컨슈머와 상기 각 컨슈머에 할당된 파티션 간의 매핑 정보를 포함하는 메타 데이터를 업데이트하는 단계; 를 포함할 수 있다.(10) A dynamic partitioning method according to an embodiment of the present invention includes: determining whether a consumer having no partition assigned among a plurality of consumers exists; Equally dividing the messages remaining in the first partition among the plurality of partitions in half, creating two new partitions, and storing the evenly divided messages in the two new partitions, respectively; Allocating the two new partitions to the consumer without the assigned partition and the consumer that was assigned to the first partition; And updating metadata including list information about partitions and mapping information between each consumer and partitions assigned to each consumer; It may include.

(11) 상기 (10) 에 있어서, 상기 판단하는 단계 이전에, 상기 메타 데이터를 생성하는 단계;를 더 포함할 수 있다.(11) In the above (10), before the determining step, generating the metadata; may further include.

(12) 상기 (10) 및 (11) 중 어느 하나에 있어서, 상기 메타 데이터는, 상기 복수의 컨슈머들에 대한 리스트 정보를 더 포함할 수 있다.(12) In any one of (10) and (11), the metadata may further include list information on the plurality of consumers.

(13) 상기 (10) 내지 (12) 중 어느 하나에 있어서, 상기 제1 파티션은 상기 복수의 파티션들 중에서 처리되어야 할 메시지들이 가장 많이 남은 파티션일 수 있다.(13) In any one of (10) to (12), the first partition may be a partition having the most messages to be processed among the plurality of partitions.

(14) 상기 (10) 내지 (13) 중 어느 하나에 있어서, 상기 판단하는 단계 이후에, 상기 제1 파티션에 남아 있는 메시지의 수를 임계값과 비교하는 단계; 를 더 포함할 수 있다.(14) the method according to any one of (10) to (13), after the determining, comparing the number of messages remaining in the first partition with a threshold; It may further include.

상기 목적을 달성하기 위해 본 발명의 또 다른 측면에 따른 동적 파티셔닝 방법을 수행하도록 프로그래밍된 프로그램을 저장하는 저장매체가 개시된다.A storage medium for storing a program programmed to perform a dynamic partitioning method according to another aspect of the present invention for achieving the above object is disclosed.

(15) 본 발명의 일 실시예에 따른 동적 파티셔닝 방법을 수행하도록 프로그래밍된 프로그램을 저장하는 저장매체는 복수의 컨슈머들 중에서 할당된 파티션이 없는 컨슈머가 존재하는지 판단하는 단계; 복수의 파티션들 중에서 제1 파티션에 남아 있는 메시지들을 반으로 균등 분할하고, 2개의 신규 파티션을 생성하여 상기 균등 분할된 메시지들을 상기 2개의 신규 파티션에 각각 저장하는 단계; 상기 할당된 파티션이 없는 컨슈머와, 상기 제1 파티션에 할당되었던 컨슈머에 상기 2개의 신규 파티션을 각각 할당하는 단계; 및 파티션들에 대한 리스트 정보 및 각 컨슈머와 상기 각 컨슈머에 할당된 파티션 간의 매핑 정보를 포함하는 메타 데이터를 업데이트하는 단계;를 수행하도록 프로그래밍된 프로그램을 저장하는 저장매체일 수 있다.(15) A storage medium storing a program programmed to perform a dynamic partitioning method according to an embodiment of the present invention comprises the steps of determining whether there is a consumer without a partition assigned among the plurality of consumers; Equally dividing the messages remaining in the first partition in half among a plurality of partitions, creating two new partitions, and storing the equally divided messages in the two new partitions, respectively; Allocating the two new partitions to the consumer without the assigned partition and the consumer that was assigned to the first partition; And updating meta data including list information about partitions and mapping information between each consumer and partitions assigned to each consumer; and a storage medium storing a program programmed to be performed.

본 발명에 따르면, 완전 분산 형태의 메시지 시스템의 장점인 병렬성 극대화를 유지하면서도, 동적 파티셔닝 기법을 통해 이 기종(heterogeneous) 워크로드로 인한 로드 밸런싱 문제를 해결할 수 있다. According to the present invention, while maintaining the maximization of parallelism, which is an advantage of the fully distributed message system, the dynamic balancing technique can solve the load balancing problem caused by the heterogeneous workload.

또한, 본 발명에 따르면, 재분배(re-balancing) 작업으로 인한 오버헤드를 줄일 수 있다. In addition, according to the present invention, the overhead due to re-balancing operation can be reduced.

도 1은 완전 분산 형태의 메시지 시스템을 나타낸 도면이다.
도 2는 본 발명의 일 실시예에 따른 메시지 파티션 재분배 알고리즘을 나타내는 순서도이다.
도 3은 본 발명의 다른 실시예에 따른 메시지 파티션 재분배 알고리즘을 나타낸 순서도이다.
1 is a diagram illustrating a message system in a fully distributed form.
2 is a flowchart illustrating a message partition redistribution algorithm according to an embodiment of the present invention.
3 is a flowchart illustrating a message partition redistribution algorithm according to another embodiment of the present invention.

도 1은 완전 분산 형태의 메시지 시스템을 나타낸 도면이다. 1 is a diagram illustrating a message system in a fully distributed form.

도 1을 참조하면, 카프카 클러스터(Kafka cluster) 및 컨슈머 그룹들(Consumer Group)이 도시되어 있다. Referring to FIG. 1, a Kafka cluster and consumer groups are shown.

카프카 클러스터(10)는, 메시지들을 분산 처리하는 요소(element)로서, 하나의 이상의 서버들을 포함할 수 있다. 카프카 클러스터는 다수의 서버들에 메시지들을 분할하여 저장할 수 있다. 전체 메시지들은 소정 개수의 파티션들(Partitions:p0, p1, p2, p3)로 분할되고, 파티션들은 복수의 서버들(Server 1, Server 2)에 나누어 저장될 수 있다. 이와 같이 다수의 서버들이 메시지 파티션들을 분할하여 저장함으로써 대규모 메시지 처리 요청을 효율적으로 처리할 수 있다. 여기서, 서버는 메시지를 분산 처리하는 구성으로서, 브로커라고 지칭될 수도 있다.Kafka cluster 10 may include one or more servers as an element for distributing messages. A Kafka cluster can split and store messages on multiple servers. The entire messages may be divided into a predetermined number of partitions (Partitions: p0, p1, p2, and p3), and the partitions may be divided and stored in a plurality of servers (Server 1 and Server 2). As such, multiple servers divide and store message partitions to efficiently handle large message processing requests. Here, the server is a configuration for distributing the message, may be referred to as a broker.

컨슈머 그룹(20)은 하나 이상의 컨슈머를 포함할 수 있다. 전술한 파티션은, 컨슈머 그룹에 속하는 하나의(single) 컨슈머를 통해서만 접근 가능하게 구성되어 병렬성을 극대화할 수 있다. 즉, 도 1에서, 컨슈머 그룹 A(consumer group A)에 포함된 컨슈머(c1)와 컨슈머(c2)는 각각 p0, p3 파티션과, p1, p2 파티션을 전담하고, 컨슈머 그룹 B(consumer group B) 에 포함된 컨슈머 c3, c4, c5, c6는 각각 p0, p3, p1, p2를 전담할 수 있다. 바꾸어 말하면, p0, p3 파티션은 컨슈머 그룹 A(consumer group A)에 포함된 컨슈머(c1)에 할당되고, p1, p2 파티션은 컨슈머 그룹 A(consumer group A)에 포함된 컨슈머(c2)에 할당될 수 있다.The consumer group 20 may include one or more consumers. The aforementioned partition can be configured to be accessible only through a single consumer belonging to the consumer group, thereby maximizing parallelism. That is, in FIG. 1, the consumer c1 and the consumer c2 included in the consumer group A are dedicated to the p0, p3 partitions, and the p1 and p2 partitions, respectively, and the consumer group B Consumers c3, c4, c5, and c6 contained in can be dedicated to p0, p3, p1, p2, respectively. In other words, the partitions p0 and p3 are assigned to the consumer c1 contained in the consumer group A, and the partitions p1 and p2 are assigned to the consumer c2 contained in the consumer group A. Can be.

메시지 파티셔닝 모듈(미도시)은 상기 메시지 시스템에 포함된 요소(element)로서, 후술할 메타 데이터 관리와 관련된 동작을 수행할 수 있다. 구체적으로, 상기 메시지 파티셔닝 모듈(미도시)은 메타 데이터 생성 및 업데이트 동작을 수행할 수 있다. 또한, 상기 메시지 파티셔닝 모듈은 후술할 메시지 파티션 재분배 알고리즘의 각 단계를 수행할 수 있다. 한편, 상기 메시지 파티셔닝 모듈은 상기 메시지 시스템 내의 프로세서일 수 있다. 상기 메시지 파티셔닝 모듈은 구현 형태에 따라 하나의 프로세서로 구현되는 것도 가능하고, 다수의 프로세서로 구현되어, 각 프로세서가 재분배 알고리즘의 일부 단계 또는 각 단계의 일부 동작을 수행할 수도 있다.The message partitioning module (not shown) is an element included in the message system and may perform an operation related to metadata management, which will be described later. In detail, the message partitioning module (not shown) may perform metadata generation and update operations. In addition, the message partitioning module may perform each step of the message partition redistribution algorithm, which will be described later. Meanwhile, the message partitioning module may be a processor in the message system. The message partitioning module may be implemented by one processor according to an implementation form, or implemented by a plurality of processors, and each processor may perform some steps or some operations of each step of the redistribution algorithm.

먼저, 각 메시지 파티션 별로, 처리된 메시지의 수와, 남은 메시지의 수가 메타 데이터로 관리될 수 있다.First, for each message partition, the number of processed messages and the number of remaining messages may be managed as metadata.

여기서, 메타 데이터는, 각 메시지 파티션 별로, 처리된 메시지의 수(number), 남은 메시지의 수(number) 및 총 메시지 수(number) 중 적어도 하나를 포함할 수 있다. 일 실시예에서, 상기 메타 데이터는 오프셋 정보를 포함할 수 있다. 여기서, 오프셋 정보는 각 메시지 파티션의 총 메시지 수와, 처리된 메시지 수의 오프셋이거나, 각 메시지 파티션의 총 메시지 수와, 남은 메시지 수의 오프셋일 수 있다.Here, the meta data may include at least one of a number of processed messages, a number of remaining messages, and a total number of messages for each message partition. In one embodiment, the metadata may include offset information. Here, the offset information may be an offset of the total number of messages in each message partition and the number of processed messages or an offset of the total number of messages in each message partition and the number of remaining messages.

또한, 컨슈머들에게 파티션들을 동적으로 재분배하는 프로세스는 주기적으로 호출될 수 있다.In addition, the process of dynamically redistributing partitions to consumers can be called periodically.

이때, 완전 분산(fully-distributed) 형태의 메시지 시스템이 갖는 병렬성을 유지하기 위해, 하나의 파티션은, 하나의 컨슈머 그룹 내 오직 하나의 컨슈머를 통해 처리될 수 있다. At this time, in order to maintain the parallelism of a fully-distributed message system, one partition may be processed through only one consumer in one consumer group.

각 컨슈머들과, 각 컨슈머들에 할당되어 처리되고 있는 메시지 파티션들에 대한 매핑 정보도 메타 데이터로 관리될 수 있다.The mapping information for each consumer and message partitions allocated to each consumer and being processed may also be managed as metadata.

이하, 도 1에 도시된 완전 분산 형태의 메시지 시스템을 기반으로 컨슈머 풀(consumer pool)에 변화가 발생한 경우 동적으로 파티션을 분할하는 기법(scheme)을 설명한다. 여기서, 컨슈머 풀(consumer pool)은 전술한 컨슈머 그룹(consumer group)과 동일한 의미로 사용될 수 있다.Hereinafter, a scheme of dynamically partitioning a partition when a change occurs in a consumer pool based on the fully distributed message system illustrated in FIG. 1 will be described. Here, the consumer pool may be used as the same meaning as the consumer group described above.

여기서, 컨슈머 풀(consumer pool)에 변화가 있는 경우로는 크게 3가지 경우가 있을 수 있다. 첫째, 컨슈머 풀에 신규 컨슈머가 참여하는 경우가 있다. 둘째, 컨슈머 풀에 속하는 컨슈머들 중에서 하나 이상의 컨슈머가 할당된 파티션에 대한 처리를 먼저 완료한 경우가 있을 수 있다. 셋째, 컨슈머 풀에 속하는 컨슈머들 중에서 하나 이상의 컨슈머가 담당 파티션에 대한 처리를 끝내지 못하고 종료된 경우(failure)가 있을 수 있다. Here, there are three cases in which there is a change in the consumer pool. First, new consumers may participate in the consumer pool. Second, there may be a case where one or more consumers among the consumers belonging to the consumer pool have completed processing on the assigned partition first. Third, there may be a case in which one or more consumers among the consumers belonging to the consumer pool have failed to finish processing for the responsible partition and are terminated.

도 2는 본 발명의 일 실시예에 따른 메시지 파티션 재분배 알고리즘을 나타내는 순서도이다.2 is a flowchart illustrating a message partition redistribution algorithm according to an embodiment of the present invention.

도 2에 도시된 알고리즘을 설명하기에 앞서, 해당 알고리즘이 적용되는 분산 메시지 시스템의 구성을 설명한다. 분산 메시지 시스템에는 N개의 파티션들이 존재하고, M개의 컨슈머들이 존재할 수 있다. 여기서, M개의 컨슈머들은 하나의 컨슈머 그룹에 속한다. Prior to describing the algorithm illustrated in FIG. 2, the configuration of a distributed message system to which the algorithm is applied will be described. There may be N partitions and M consumers in a distributed message system. Here, M consumers belong to one consumer group.

메시지 파티셔닝 모듈에 의해 관리되는 메타 데이터는 리스트 정보와, 매핑 정보를 포함할 수 있다. 여기서, 리스트 정보는 상기 N개의 파티션들의 리스트 정보, 상기 M개의 컨슈머들에 대한 리스트 정보를 포함할 수 있고, 상기 매핑 정보는 상기 N개의 파티션들과, 상기 M개의 컨슈머들 사이의 매핑 정보를 의미할 수 있다.Meta data managed by the message partitioning module may include list information and mapping information. Here, the list information may include list information of the N partitions and list information of the M consumers, and the mapping information means mapping information between the N partitions and the M consumers. can do.

상기 N개의 파티션들의 리스트 정보는 P = {p0, p1,…, pi, …, pN}으로 표현될 수 있고, 상기 M개의 컨슈머들의 리스트 정보는 C = {c0, c1, …, cj, …, cM}으로 표현될 수 있다. 상기 매핑 정보는 각 파티션에 대해 어떤 컨슈머가 할당되어 있는지를 나타내는 형태로 표현될 수 있다. 대안적으로, 상기 매핑 정보는 각 컨슈머에 대해 어떤 파티션이 할당되어 있는지를 나타내는 형태로 표현될 수도 있다. 일 실시예에서, 상기 매핑 정보는 AllocPatition[N] 배열일 수 있다. 상기 AllocPatition[N] 배열은 임의의 파티션 pi가 어떤 컨슈머에 할당되어 있는지를 나타낼 수 있다. 여기서, P와 C는 모두 active한 상태를 의미한다. 즉, 이미 처리가 끝난 파티션이나 종료된 컨슈머는 관리되지 않고, 리스트에서 제외될 수 있다.The list information of the N partitions is P = {p0, p1,... , pi,… , pN}, and the list information of the M consumers is C = {c0, c1,... , cj,… , cM}. The mapping information may be expressed in a form indicating which consumer is allocated to each partition. Alternatively, the mapping information may be expressed in a form indicating which partition is allocated to each consumer. In one embodiment, the mapping information may be an AllocPatition [N] array. The AllocPatition [N] array may indicate to which consumer an arbitrary partition pi is assigned. Here, P and C are both active. That is, partitions that have already been processed or consumers that have been terminated are not managed and can be excluded from the list.

도 2를 참조하면, 먼저, 메시지 파티셔닝 모듈은 컨슈머들 중에서 할당된 파티션이 없는 컨슈머(cx)가 존재하는지 판단한다(단계 201). 여기서, 할당된 파티션이 없는 컨슈머(cx)는, 해당 컨슈머 그룹에 새롭게 참여하는 컨슈머이거나, 담당했던 파티션에 대한 처리를 완료한 컨슈머일 수 있다. 만약, 할당된 파티션이 없는 컨슈머(cx)가 존재하지 않는 경우, 즉 모든 컨슈머들이 각각 담당한 파티션을 처리하고 있는 경우, 이번 주기의 동적 재분배 알고리즘은 종료된다.Referring to FIG. 2, first, the message partitioning module determines whether there is a consumer cx without an assigned partition among consumers (step 201). Here, the consumer (cx) having no assigned partition may be a consumer newly participating in the corresponding consumer group or a consumer who has completed processing for the partition in charge. If there is no consumer (cx) without an assigned partition, that is, if all consumers are handling their respective partitions, the dynamic redistribution algorithm of this cycle is terminated.

할당된 파티션이 없는 컨슈머가 존재하는 경우, 메시지 파티셔닝 모듈이 파티션들(P) 중에서 처리해야 할 메시지들이 가장 많이 남아있는 파티션(pk)을 선택한다(단계 203). If there is a consumer without an assigned partition, the message partitioning module selects the partition pk which has the most messages to be processed among the partitions P (step 203).

메시지 파티셔닝 모듈은 상기 파티션(pk)에 남아있는 메시지의 수를 임계값(threshold)와 비교한다(단계 205). 만약, 상기 파티션(pk)에 남아있는 메시지의 수가 임계값(threshold) 보다 작은 경우(일 실시예에서, 같은 경우도 포함할 수 있음), 이번 주기의 동적 재분배 알고리즘은 종료된다. 여기서, 상기 임계값(threshold)은 남아있는 메시지들을 나누어도 충분히 워크로드를 구성할 수 있는 메시지들의 수를 기준으로 설정될 수 있다.The message partitioning module compares the number of messages remaining in the partition pk with a threshold (step 205). If the number of messages remaining in the partition pk is smaller than a threshold (which may include the same case in one embodiment), the dynamic redistribution algorithm of this period is terminated. Here, the threshold may be set based on the number of messages that can form a workload enough to divide the remaining messages.

상기 파티션(pk)에 남아있는 메시지의 수가 임계값(threshold)보다 큰 경우(일 실시예에서, 같은 경우도 포함할 수 있음), 메시지 파티셔닝 모듈은 처리해야 할 메시지들이 가장 많이 남은 파티션(pk)을 처리하는 컨슈머(cl)의 동작을 정지(hold)하고, 상기 파티션(pk)에 남아있는 메시지들을 균등하게 분할한다(단계 205). 일 실시예에서, 메시지 파티셔닝 모듈은 상기 파티션(pk)에 남아있는 메시지들을 두 개의 균등한 파티션들(pd1, pd2)로 분할할 수 있다. 상기 파티션(pk)에서 기존에 처리한 메시지들은 완료된 메시지들이므로, 메시지 파티셔닝 모듈은 해당 파티션(pk)을 종료 처리한다.If the number of messages remaining in the partition (pk) is greater than a threshold (which may include the same case in one embodiment), the message partitioning module determines that the partition (pk) has the most remaining messages to process. The operation of the consumer cl which processes the data is held, and the messages remaining in the partition pk are equally divided (step 205). In one embodiment, the message partitioning module may split the messages remaining in the partition pk into two equal partitions pd1 and pd2. Since the messages previously processed in the partition pk are completed messages, the message partitioning module terminates the partition pk.

메시지 파티셔닝 모듈은 새롭게 생성된 메시지 파티션들(pd1, pd2)을 기존의 pk를 처리하던 컨슈머(cl)와, 할당된 파티션이 없는 컨슈머(cx)에 재분배(re-balancing)한다(단계 209). The message partitioning module re-balances the newly created message partitions pd1 and pd2 to a consumer cl that has processed the existing pk and a consumer cx that does not have an assigned partition (step 209).

메시지 파티셔닝 모듈은, 메타 데이터(리스트 정보 및 매핑 정보)를 업데이트 한다(단계 211). The message partitioning module updates the meta data (list information and mapping information) (step 211).

이로서, 동적 재분배 알고리즘의 한 주기가 완료되고, 다음 주기의 동적 재분배 알고리즘이 반복될 수 있다. 즉, 도 2는 동적 재분배 알고리즘의 한 주기를 나타낸 것으로서, 동적 재분배 알고리즘은 주기적으로 반복될 수 있다. As such, one cycle of the dynamic redistribution algorithm can be completed, and the next dynamic redistribution algorithm can be repeated. That is, FIG. 2 shows one period of the dynamic redistribution algorithm, and the dynamic redistribution algorithm may be repeated periodically.

이러한 동적 재분배 알고리즘에 따르면, 신규 가용 컨슈머(newly available consumer)에게 파티션을 분배할 수 있다. 특히, 가장 큰 메시지 파티션부터 순차적으로 분할이 이루어지므로, 재분배 주기가 짧아지는 것을 최소화할 수 있다. 한편, 이러한 동적 재분배 알고리즘은 일회적인 것이 아니라 주기적으로 수행되므로 시시각각으로 변화하는 컨슈머에 대한 워크 로드를 반영할 수 있다. According to this dynamic redistribution algorithm, partitions can be distributed to newly available consumers. In particular, since the partition is sequentially performed from the largest message partition, the redistribution period can be minimized. On the other hand, the dynamic redistribution algorithm is not one-time, but periodically, it can reflect the workload for the consumer changes every moment.

도 3은 본 발명의 다른 실시예에 따른 메시지 파티션 재분배 알고리즘을 나타낸 순서도이다.3 is a flowchart illustrating a message partition redistribution algorithm according to another embodiment of the present invention.

도 3은 메시지를 처리하던 컨슈머들 중에서 하나 이상의 컨슈머가 담당 파티션에 대한 처리를 끝내지 못하고 종료된 경우의 동적 재분배 알고리즘을 나타낸다. 3 illustrates a dynamic redistribution algorithm when one or more consumers among the consumers who have processed the message have not finished processing the responsible partition.

먼저, 메시지 파티셔닝 모듈은 기존의 메시지를 처리하던 컨슈머들 중 어느 하나의 컨슈머(Cf)가 예기치 못한 상황으로 종료(failure)되었는지 판단한다(단계 301). 일 실시예에서, 상기 단계 301의 판단 방법(scheme)은, 소정 시간동안 컨슈머가 처리하는 메시지의 수가 임계값 보다 작은지 여부로 판단할 수 있다. First, the message partitioning module determines whether the consumer Cf of the consumers who have processed the existing message has failed due to an unexpected situation (step 301). In an embodiment, the determination method of step 301 may determine whether the number of messages processed by the consumer for a predetermined time is smaller than a threshold value.

기존의 메시지를 처리하던 컨슈머들 중 어느 하나의 컨슈머(Cf)가 예기치 못한 상황으로 종료(failure)되는 이벤트가 발생하면, 메시지 파티셔닝 모듈은 종료된 컨슈머(cf)가 처리하던 파티션(pa)에서 처리되지 않고 남은 메시지들을 이용하여 신규 파티션(pb)를 생성한다(단계 303). 즉, 메시지 파티셔닝 모듈은 남은 메시지들로 구성된 신규 파티션(pb)을 생성한다. 한편, 기존의 파티션(pa)은 종료 처리될 수 있다. 일 실시예에서, 메시지 파티셔닝 모듈은 기존의 파티션(pa)을 종료 처리할 수 있다.If an event occurs in which one of the consumers (Cf) of the consumers handling the existing message fails due to an unexpected situation, the message partitioning module is processed in the partition (pa) that was processed by the terminated consumer (cf). A new partition pb is created using the remaining messages (step 303). That is, the message partitioning module creates a new partition pb composed of the remaining messages. Meanwhile, the existing partition pa may be terminated. In one embodiment, the message partitioning module may terminate the existing partition pa.

메시지 파티셔닝 모듈은 생성된 신규 파티션(pb)을 할당된 파티션이 없는 컨슈머(cx)에 할당한다(단계 305). The message partitioning module assigns the created new partition pb to the consumer cx that has no partition assigned (step 305).

도 3을 통해 설명한 컨슈머 종료(failure) 이벤트는 컨슈머들의 메시지 처리 동작 중에 발생할 수 있는 이벤트이다. 즉, 도 2에서 설명한 동적 재분배 알고리즘의 주기가 반복되는 과정 중에 발생할 수 있다. 컨슈머 종료 이벤트가 발생한 경우, 메시지 파티셔닝 모듈은 신규 파티션을 생성하고, 단계 201에 이르기 까지 대기할 수 있다. 즉, 도 3의 단계 305는 도 2의 단계 201 및 단계 203을 의미할 수 있다.The consumer failure event described with reference to FIG. 3 is an event that may occur during the message processing operation of consumers. That is, it may occur during the process of repeating the cycle of the dynamic redistribution algorithm described in FIG. When a consumer termination event occurs, the message partitioning module may create a new partition and wait until step 201. That is, step 305 of FIG. 3 may mean step 201 and step 203 of FIG. 2.

한편, 도 2 및 도 3을 통해 설명된 각 단계들은 선택적으로 통합되거나 분할될 수도 있다.Meanwhile, each of the steps described with reference to FIGS. 2 and 3 may be selectively integrated or divided.

이하, 도 2 및 도 3을 통해 설명한 동적 파티션 분할 과정에 따른 구체적인 예시를 설명한다. Hereinafter, specific examples of the dynamic partition partitioning process described with reference to FIGS. 2 and 3 will be described.

본 예시에서, 5개의 파티션들(p0, p1, p2, p3, p4)이 존재하고, 5개의 컨슈머들(c0, c1, c2, c3, c4)이 존재하며, 총 100,000개의 메시지들을 처리한다고 가정한다. 이때, 5개의 파티션들(p0, p1, p2, p3, p4)에는 각각 20,000개의 메시지들이 분배된다. 각 컨슈머는 하나의 파티션을 처리하도록 구성된다. 편의상, c0는 p0를 처리하고, c1은 p1을 처리하며, c2는 p2를 처리하고, c3는 p3를 처리하며, c4는 p4를 처리한다고 가정한다. In this example, assume that there are five partitions (p0, p1, p2, p3, p4), five consumers (c0, c1, c2, c3, c4) and handle a total of 100,000 messages. do. At this time, 20,000 messages are distributed to the five partitions p0, p1, p2, p3, and p4. Each consumer is configured to handle one partition. For convenience, assume that c0 processes p0, c1 processes p1, c2 processes p2, c3 processes p3, and c4 processes p4.

이 경우, 메타데이터는, 리스트 정보로서, 파티션 리스트 정보인 P = {p0, p1, p2, p3, p4}와, 컨슈머 리스트 정보인 C = {c0, c1, c2, c3, c4}를 포함할 수 있고, {c0, p0}, {c1, p1}, {c2, p2}, {c3, p3}, {c4, p4}인 매핑 정보 AllocPatition[4]를 포함할 수 있다.(후술하는 표 1 참조)In this case, the metadata may include, as list information, partition list information P = {p0, p1, p2, p3, p4} and consumer list information C = {c0, c1, c2, c3, c4}. And mapping information AllocPatition [4] which is {c0, p0}, {c1, p1}, {c2, p2}, {c3, p3}, {c4, p4}. Reference)

이때, 임의의 시점에서, 컨슈머(c4)가 다른 컨슈머들 보다 먼저 자신에게 할당된 2만개의 메시지들을 모두 처리하였고, 해당 시점에서 파티션(p2)에 가장 많은 수의 메시지들이 남아 있고, 해당 시점에서 파티션(p2)에 남아 있는 메시지들의 수가 1만개라고 가정한다. 또한, 임계값은 6천이라고 가정하여, 해당 시점에서 파티션(p2)에 남아 있는 메시지들의 수가 임계값 보다 큰 경우를 가정한다. At this point in time, the consumer c4 has processed all 20,000 messages assigned to it before other consumers, at which point the largest number of messages remain in the partition p2, and at that time Assume that the number of messages remaining in partition p2 is 10,000. In addition, it is assumed that the threshold value is 6,000, and it is assumed that the number of messages remaining in the partition p2 at this time point is larger than the threshold value.

이 경우, 메시지 파티셔닝 모듈은 파티션(p2)을 처리하던 컨슈머(c2)의 동작을 일시 정지하고(holding), 2개의 새로운 파티션들(p5, p6)을 생성한 후, 파티션(p2)에 남아 있는 1만개의 메시지를 5000개씩으로 분할하여 새로운 파티션들(p5, p6)에 각각 할당한다. 그리고, 메시지 파티셔닝 모듈은 새로운 파티션들(p5, p6)을 각각 기존의 파티션(p2)을 처리하던 컨슈머(c2)와, 자신에게 할당된 메시지들을 모두 처리하여 할당된 파티션이 없는 컨슈머(c4)에게 재분배한다. In this case, the message partitioning module holds the operation of the consumer c2 that was processing the partition p2, creates two new partitions p5 and p6, and then remains in the partition p2. 10,000 messages are divided into 5000 partitions and allocated to new partitions p5 and p6, respectively. In addition, the message partitioning module processes the new partitions p5 and p6 to the consumer c2 that has processed the existing partition p2, and to the consumer c4 that has no partition assigned by processing all of the messages assigned to it. Redistribute.

한편, 메시지 파티셔닝 모듈은 메타 데이터를 업데이트한다. 기존에 존재하던 파티션(p2)에 포함된 메시지들은 모두 처리되었고, 기존에 존재하던 파티션(p4)는 새로운 파티션들로 분할되었으므로, p2와, p4는 파티션 리스트에서 삭제되고, 새로운 파티션인 p5, p6가 파티션 리스트에 추가된다. 그리고, 기존의 파티션(p2)을 처리하던 컨슈머(c2)와, 자신에게 할당된 메시지들을 모두 처리하여 할당된 파티션이 없는 컨슈머(c4)에 대한 파티션 매핑 정보도 업데이트 된다.Meanwhile, the message partitioning module updates the metadata. The messages contained in the existing partition (p2) were all processed, and the existing partition (p4) was divided into new partitions, so p2 and p4 were deleted from the partition list, and the new partitions p5 and p6. Is added to the partition list. In addition, the partition mapping information for the consumer c2 that has been processing the existing partition p2 and the consumer c4 having no partition assigned by processing all of the messages assigned thereto are also updated.

결과적으로, 업데이트된 메타 데이터는, 리스트 정보로서, 파티션 리스트 정보인 P = {p0, p1, p3, p5, p6}와, 컨슈머 리스트 정보인 C = {c0, c1, c2, c3, c4}를 포함할 수 있고, {c0, p0}, {c1, p1}, {c2, p5}, {c3, p3}, {c4, p6}인 매핑 정보 AllocPatition[4]를 포함할 수 있다.As a result, the updated metadata includes, as list information, P = {p0, p1, p3, p5, p6}, which is partition list information, and C = {c0, c1, c2, c3, c4}, which is consumer list information. And may include mapping information AllocPatition [4] which is {c0, p0}, {c1, p1}, {c2, p5}, {c3, p3}, {c4, p6}.

아래 표는 재분배 전 후의 메타 데이터 정보를 비교한 것이다.The table below compares metadata information before and after redistribution.

Figure pat00001
Figure pat00001

전술한 예시는, 컨슈머가 자신이 담당한 파티션에 대한 처리를 완료하여 컨슈머 풀에 변화가 발생한 경우에 대한 것이나, 신규 컨슈머가 컨슈머 풀에 참여한 경우 또는 컨슈머가 담당 파티션에 대한 처리를 끝내지 못하고 종료(failure)된 경우에도 유사하게 적용될 수 있다. The above example is for a case where a consumer completes the processing of the partition in charge of the consumer and a change occurs in the consumer pool, or when a new consumer joins the consumer pool, or when the consumer does not finish the processing for the partition in question. In case of failure, the same applies.

전술한 예시에서 볼 수 있듯이, 처리되어야 할 메시지가 많이 남은 파티션을 분할하게 되면, 로드 밸런싱을 개선할 수 있을 뿐만 아니라, 재분배 주기가 짧아지는 것을 최소화할 수 있다. 재분배 작업이 일어나는 동안에는 메시지 처리가 불가능하므로, 재분배 주기가 길어지도록 유도하면 재분배 작업으로 인해 시스템 성능이 낮아지는 것을 방지할 수 있다.As can be seen from the above examples, partitioning a partition having many messages to be processed can not only improve load balancing, but also minimize the redistribution period. Message processing is not possible while redistribution occurs, so prolonging the redistribution cycle can prevent redistribution from slowing system performance.

한편, 전술한 예시에서, 특정 시점에 파티션(p2)에 남아 있는 메시지들의 수가 1만개이고, 임계값은 6천이다. 이 상황은 파티션에 남아 있는 메시지들의 수가 임계값보다 큰 경우로서, 남아 있는 메시지들을 나누어도 충분한 워크로드를 구성할 수 있는 경우이다. 이와 달리, 남아 있는 메시지의 수가 충분하지 않다면, 파티션을 분할하는 것이 큰 의미가 없을 수 있다. 오히려, 남아 있는 메시지의 수가 충분하지 않은 경우, 파티션을 분할하는 것은 재분배 동작으로 인해 시스템 성능을 저해할 수 있다. 전술한 예시는, 남아 있는 메시지들의 수가 소정 임계값을 넘지 않는 경우, 동적 분할을 수행하지 않도록 구성되어 시스템 성능이 낮아지는 것을 방지할 수 있다. On the other hand, in the above example, the number of messages remaining in the partition p2 at a specific time point is 10,000, and the threshold is 6,000. This situation is when the number of messages remaining in the partition is larger than the threshold value, in which case the remaining messages can constitute sufficient workload. Alternatively, partitioning a partition may not make much sense if the number of messages remaining is not sufficient. Rather, partitioning partitions can hinder system performance due to redistribution if there are not enough messages left. The above-described example can be configured not to perform dynamic partitioning when the number of remaining messages does not exceed a predetermined threshold to prevent system performance from being lowered.

본 발명에 따르면, 완전 분산 형태의 메시지 시스템의 장점인 병렬성 극대화를 유지하면서도, 동적 파티셔닝 기법을 통해 이(異) 기종 워크로드로 인한 로드 밸런싱 문제를 해결할 수 있다. 또한, 본 발명에 따르면, 재분배(re-balancing) 작업으로 인한 오버헤드를 줄일 수 있다. According to the present invention, while maintaining the maximization of parallelism, which is an advantage of a fully distributed message system, a load balancing problem caused by heterogeneous workloads can be solved through a dynamic partitioning technique. In addition, according to the present invention, the overhead due to re-balancing operation can be reduced.

향후 IoT(Internet of Things)의 발전과 함께 다양한 형태의 메시지들이 분산 메시지 시스템을 통해서 연동되면 정적 파티셔닝 기법으로 인한 로드 밸런싱 문제가 지속적으로 발생할 수 있다. 본 발명에 따르면, 비교적 최소한의 노력으로 동적 파티셔닝 기법을 구현함으로써, 분산 메시지 시스템이 고성능 메시지 처리 성능을 유지하는데 큰 도움을 줄 수 있다. With the development of the Internet of Things (IoT) in the future, when various types of messages are linked through a distributed message system, load balancing problems due to static partitioning techniques may continue to occur. According to the present invention, by implementing a dynamic partitioning technique with relatively minimal effort, a distributed message system can greatly help maintain high performance message processing performance.

전술한 본 발명의 일 실시예에 따른 메시지 재분배 알고리즘의 각 단계는 소프트웨어로 프로그래밍될 수 있으며, 프로그래밍된 프로그램은 저장매체에 저장될 수 있다. Each step of the message redistribution algorithm according to an embodiment of the present invention described above may be programmed in software, and the programmed program may be stored in a storage medium.

모듈, 유닛 또는 장치를 구성하는 각 구성요소는 메모리(또는 저장 유닛)에 저장된 연속된 수행과정들을 실행하는 프로세서들일 수 있다. 전술한 실시예에 기술된 각 단계들은 하드웨어/프로세서들에 의해 수행될 수 있다. 전술한 실시예에 기술된 각 구성단위들은 하드웨어/프로세서로서 동작할 수 있다. 또한, 본 발명이 제시하는 방법들은 코드로서 실행될 수 있다. 이 코드는 프로세서가 읽을 수 있는 저장매체에 쓰여질 수 있고, 따라서 장치(apparatus)가 제공하는 프로세서에 의해 읽혀질 수 있다. Each component constituting a module, unit or device may be processors that execute successive procedures stored in a memory (or storage unit). Each of the steps described in the above embodiments may be performed by hardware / processors. Each of the structural units described in the above embodiments may operate as a hardware / processor. In addition, the methods proposed by the present invention can be executed as code. This code can be written to a processor readable storage medium and thus read by a processor provided by an apparatus.

설명의 편의를 위하여 각 도면을 나누어 설명하였으나, 각 도면에 서술되어 있는 실시예들을 병합하여 새로운 실시예를 구현하도록 설계하는 것도 가능하다. 그리고, 통상의 기술자의 필요에 따라, 이전에 설명된 실시 예들을 실행하기 위한 프로그램이 기록되어 있는 컴퓨터에서 판독 가능한 기록 매체를 설계하는 것도 본 발명의 권리범위에 속한다.For convenience of description, the drawings are divided and described, but the embodiments described in each drawing may be merged to implement a new embodiment. And, according to the needs of those skilled in the art, it is also within the scope of the present invention to design a computer-readable recording medium on which a program for executing the previously described embodiments is recorded.

본 발명에 따른 장치 및 방법은 상술한 바와 같이 설명된 실시 예들의 구성과 방법이 한정되게 적용될 수 있는 것이 아니라, 상술한 실시 예들은 다양한 변형이 이루어질 수 있도록 각 실시 예들의 전부 또는 일부가 선택적으로 조합되어 구성될 수도 있다.Apparatus and method according to the present invention is not limited to the configuration and method of the embodiments described as described above, the above-described embodiments may be selectively all or part of each embodiment so that various modifications can be made It may be configured in combination.

한편, 본 발명이 제안하는 방법을 네트워크 디바이스에 구비된, 프로세서가 읽을 수 있는 기록매체에, 프로세서가 읽을 수 있는 코드로서 구현하는 것이 가능하다. 프로세서가 읽을 수 있는 기록매체는 프로세서에 의해 읽혀질 수 있는 데이터가 저장되는 모든 종류의 기록장치를 포함한다. 프로세서가 읽을 수 있는 기록 매체의 예로는 ROM, RAM, CD-ROM, 자기 테이프, 플로피디스크, 광 데이터 저장장치 등이 있다. 또한, 프로세서가 읽을 수 있는 기록매체는 네트워크로 연결된 컴퓨터 시스템에 분산되어, 분산방식으로 프로세서가 읽을 수 있는 코드가 저장되고 실행될 수 있다.On the other hand, it is possible to implement the method proposed by the present invention as a processor-readable code in a processor-readable recording medium provided in a network device. The processor-readable recording medium includes all kinds of recording devices that store data that can be read by the processor. Examples of the processor-readable recording medium include ROM, RAM, CD-ROM, magnetic tape, floppy disk, optical data storage device, and the like. The processor-readable recording medium can also be distributed over network coupled computer systems so that the processor-readable code is stored and executed in a distributed fashion.

또한, 이상에서는 본 발명의 바람직한 실시 예에 대하여 도시하고 설명하였지만, 본 발명은 상술한 특정의 실시 예에 한정되지 아니하며, 청구범위에서 청구하는 본 발명의 요지를 벗어남이 없이 당해 발명이 속하는 기술분야에서 통상의 지식을 가진 자에 의해 다양한 변형실시가 가능한 것은 물론이고, 이러한 변형실시들은 본 발명의 기술적 사상이나 전망으로부터 개별적으로 이해돼서는 안 될 것이다.In addition, although the preferred embodiment of the present invention has been shown and described above, the present invention is not limited to the above-described specific embodiment, the technical field to which the invention belongs without departing from the spirit of the invention claimed in the claims. Of course, various modifications can be made by those skilled in the art, and these modifications should not be individually understood from the technical spirit or the prospect of the present invention.

그리고, 당해 명세서에서는 물건 발명과 방법 발명이 모두 설명되고 있으며, 필요에 따라 양 발명의 설명은 보충적으로 적용될 수가 있다.In addition, in this specification, both the object invention and the method invention are described, and description of both invention can be supplementally applied as needed.

본 발명의 사상이나 범위를 벗어나지 않고 본 발명에서 다양한 변경 및 변형이 가능함은 당업자에게 이해된다. 따라서, 본 발명은 첨부된 청구항 및 그 동등 범위 내에서 제공되는 본 발명의 변경 및 변형을 포함하는 것으로 의도된다.It is understood by those skilled in the art that various changes and modifications can be made in the present invention without departing from the spirit or scope of the invention. Accordingly, it is intended that the present invention cover the modifications and variations of this invention provided they come within the scope of the appended claims and their equivalents.

본 명세서에서 장치 및 방법 발명이 모두 언급되고, 장치 및 방법 발명 모두의 설명은 서로 보완하여 적용될 수 있다.Reference is made herein to both apparatus and method inventions, and the descriptions of both apparatus and method inventions may be complementary to one another.

10: 카프카 클러스터
20: 컨슈머 그룹
10: Kafka Cluster
20: Consumer Group

Claims (15)

메시지들을 분할 저장하는 복수의 파티션들;
복수의 컨슈머들을 포함하는 컨슈머 그룹,
하나의 파티션에 저장된 메시지들은 상기 컨슈머 그룹에 포함된 하나의 컨슈머에 의해 처리되고; 및
상기 복수의 파티션들에 대한 리스트 정보, 및 각 컨슈머와 상기 각 컨슈머에 할당된 파티션 간의 매핑 정보를 포함하는 메타 데이터를 관리하는 메시지 파티셔닝 모듈; 을 포함하는 분산 메시지 시스템.
A plurality of partitions for separately storing messages;
A consumer group comprising a plurality of consumers,
Messages stored in one partition are processed by one consumer included in the consumer group; And
A message partitioning module for managing metadata including list information on the plurality of partitions and mapping information between each consumer and partitions assigned to each consumer; Distributed message system comprising a.
제 1 항에 있어서,
상기 메시지 파티셔닝 모듈은, 동적 재분배 오퍼레이션이 수행될 때 마다 상기 메타 데이터를 업데이트하는 것을 특징으로 하는 분산 메시지 시스템.
The method of claim 1,
And wherein said message partitioning module updates said metadata each time a dynamic redistribution operation is performed.
제 2 항에 있어서,
상기 동적 재분배 오퍼레이션은, 소정 주기에 따라, 또는 상기 컨슈머 그룹에 변화가 발생할 때 마다 수행되는 것을 특징으로 하는 분산 메시지 시스템.
The method of claim 2,
The dynamic redistribution operation is performed according to a predetermined period or whenever a change occurs in the consumer group.
제 3 항에 있어서,
상기 컨슈머 그룹에 변화가 발생하는 경우는,
상기 컨슈머 그룹에 새로운 컨슈머가 참여하는 경우, 상기 복수의 컨슈머들 중 적어도 하나의 컨슈머가 자신에게 할당된 파티션에 저장된 메시지를 모두 처리한 경우, 및 상기 복수의 컨슈머들 중 적어도 하나의 컨슈머가 자신에게 할당된 파티션에 저장된 메시지를 처리하지 못하고 종료된 경우 중 어느 하나인 것을 특징으로 하는 분산 메시지 시스템.
The method of claim 3, wherein
If a change occurs in the consumer group,
When a new consumer joins the consumer group, when at least one consumer of the plurality of consumers has processed all the messages stored in the partition assigned to the consumer group, and at least one consumer among the plurality of consumers The distributed message system, characterized in that any one of the cases terminated without processing a message stored in the assigned partition.
제 2 항에 있어서,
상기 동적 재분배 오퍼레이션은 상기 메시지 파티셔닝 모듈에 의해 수행되는 것으로서:
상기 복수의 컨슈머들 중에서 할당된 파티션이 없는 컨슈머가 존재하는지 판단하는 프로세스;
복수의 파티션들 중에서 제1 파티션에 남아 있는 메시지들을 반으로 균등 분할하고, 2개의 신규 파티션을 생성하여 상기 균등 분할된 메시지들을 상기 2개의 신규 파티션에 각각 저장하는 프로세스; 및
상기 할당된 파티션이 없는 컨슈머와, 상기 제1 파티션에 할당되었던 컨슈머에 상기 2개의 신규 파티션을 각각 할당하는 프로세스; 를 포함하는 것을 특징으로 하는 분산 메시지 시스템.
The method of claim 2,
The dynamic redistribution operation is performed by the message partitioning module:
Determining whether there is a consumer without an assigned partition among the plurality of consumers;
Equally dividing the messages remaining in the first partition among the plurality of partitions in half, creating two new partitions, and storing the equally divided messages in the two new partitions, respectively; And
Allocating the two new partitions to the consumer without the assigned partition and the consumer assigned to the first partition; Distributed message system comprising a.
제 5 항에 있어서,
상기 판단하는 프로세스 이전에, 상기 메타 데이터를 생성하는 프로세스;를 더 포함하는 것을 특징으로 하는 분산 메시지 시스템.
The method of claim 5,
And before the determining, the process of generating the metadata.
제 5 항에 있어서,
상기 제1 파티션은 상기 복수의 파티션들 중에서 처리되어야 할 메시지들이 가장 많이 남은 파티션인 것을 특징으로 하는 분산 메시지 시스템.
The method of claim 5,
And the first partition is a partition having the most messages to be processed among the plurality of partitions.
제 5 항에 있어서,
상기 판단하는 프로세스 이후에, 상기 제1 파티션에 남아 있는 메시지의 수를 임계값과 비교하는 프로세스; 를 더 포함하는 것을 특징으로 하는 분산 메시지 시스템.
The method of claim 5,
After the determining process, comparing the number of messages remaining in the first partition with a threshold; Distributed message system further comprises.
제 1 항에 있어서,
상기 메타 데이터는, 상기 복수의 컨슈머들에 대한 리스트 정보를 더 포함하는 것을 특징으로 하는 분산 메시지 시스템.
The method of claim 1,
The metadata further includes list information for the plurality of consumers.
복수의 컨슈머들 중에서 할당된 파티션이 없는 컨슈머가 존재하는지 판단하는 단계;
복수의 파티션들 중에서 제1 파티션에 남아 있는 메시지들을 반으로 균등 분할하고, 2개의 신규 파티션을 생성하여 상기 균등 분할된 메시지들을 상기 2개의 신규 파티션에 각각 저장하는 단계;
상기 할당된 파티션이 없는 컨슈머와, 상기 제1 파티션에 할당되었던 컨슈머에 상기 2개의 신규 파티션을 각각 할당하는 단계; 및
파티션들에 대한 리스트 정보 및 각 컨슈머와 상기 각 컨슈머에 할당된 파티션 간의 매핑 정보를 포함하는 메타 데이터를 업데이트하는 단계; 를 포함하는
분산 메시지 시스템에서의 동적 파티셔닝 방법.
Determining whether there is a consumer without an assigned partition among the plurality of consumers;
Equally dividing the messages remaining in the first partition among the plurality of partitions in half, creating two new partitions, and storing the evenly divided messages in the two new partitions, respectively;
Allocating the two new partitions to the consumer without the assigned partition and the consumer that was assigned to the first partition; And
Updating metadata including list information about partitions and mapping information between each consumer and partitions assigned to each consumer; Containing
Dynamic Partitioning Method in Distributed Message Systems.
제 10 항에 있어서,
상기 판단하는 단계 이전에, 상기 메타 데이터를 생성하는 단계;를 더 포함하는 것을 특징으로 하는 분산 메시지 시스템에서의 동적 파티셔닝 방법.
The method of claim 10,
And before the determining, generating the metadata. The method of claim 1, further comprising generating metadata.
제 10 항에 있어서,
상기 메타 데이터는, 상기 복수의 컨슈머들에 대한 리스트 정보를 더 포함하는 것을 특징으로 하는 분산 메시지 시스템에서의 동적 파티셔닝 방법.
The method of claim 10,
The metadata further comprises list information for the plurality of consumers.
제 10 항에 있어서,
상기 제1 파티션은 상기 복수의 파티션들 중에서 처리되어야 할 메시지들이 가장 많이 남은 파티션인 것을 특징으로 하는 분산 메시지 시스템에서의 동적 파티셔닝 방법.
The method of claim 10,
And wherein the first partition is a partition having the most remaining messages to be processed among the plurality of partitions.
제 10 항에 있어서,
상기 판단하는 단계 이후에, 상기 제1 파티션에 남아 있는 메시지의 수를 임계값과 비교하는 단계; 를 더 포함하는 것을 특징으로 하는 분산 메시지 시스템에서의 동적 파티셔닝 방법.
The method of claim 10,
After the determining, comparing the number of messages remaining in the first partition with a threshold; Dynamic partitioning method in a distributed message system, characterized in that it further comprises.
복수의 컨슈머들 중에서 할당된 파티션이 없는 컨슈머가 존재하는지 판단하는 단계;
복수의 파티션들 중에서 제1 파티션에 남아 있는 메시지들을 반으로 균등 분할하고, 2개의 신규 파티션을 생성하여 상기 균등 분할된 메시지들을 상기 2개의 신규 파티션에 각각 저장하는 단계;
상기 할당된 파티션이 없는 컨슈머와, 상기 제1 파티션에 할당되었던 컨슈머에 상기 2개의 신규 파티션을 각각 할당하는 단계; 및
파티션들에 대한 리스트 정보 및 각 컨슈머와 상기 각 컨슈머에 할당된 파티션 간의 매핑 정보를 포함하는 메타 데이터를 업데이트하는 단계; 를 수행하도록 프로그래밍된 프로그램을 저장하는 저장매체.
Determining whether there is a consumer without an assigned partition among the plurality of consumers;
Equally dividing the messages remaining in the first partition among the plurality of partitions in half, creating two new partitions, and storing the evenly divided messages in the two new partitions, respectively;
Allocating the two new partitions to the consumer without the assigned partition and the consumer that was assigned to the first partition; And
Updating metadata including list information about partitions and mapping information between each consumer and partitions assigned to each consumer; A storage medium that stores a program that is programmed to run.
KR1020180065462A 2018-06-07 2018-06-07 Distributed Messaging System and Method for Dynamic Partitioning in Distributed Messaging System KR102124897B1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
KR1020180065462A KR102124897B1 (en) 2018-06-07 2018-06-07 Distributed Messaging System and Method for Dynamic Partitioning in Distributed Messaging System

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
KR1020180065462A KR102124897B1 (en) 2018-06-07 2018-06-07 Distributed Messaging System and Method for Dynamic Partitioning in Distributed Messaging System

Publications (2)

Publication Number Publication Date
KR20190139006A true KR20190139006A (en) 2019-12-17
KR102124897B1 KR102124897B1 (en) 2020-06-22

Family

ID=69056807

Family Applications (1)

Application Number Title Priority Date Filing Date
KR1020180065462A KR102124897B1 (en) 2018-06-07 2018-06-07 Distributed Messaging System and Method for Dynamic Partitioning in Distributed Messaging System

Country Status (1)

Country Link
KR (1) KR102124897B1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20210085993A (en) * 2019-12-31 2021-07-08 건국대학교 산학협력단 Message storing method based on distributed storage and appratus therefor

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR102484737B1 (en) * 2021-10-29 2023-01-05 한국전자기술연구원 Method for selecting distributed message buffer partition of data in mobile IoT environment

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170272516A1 (en) * 2016-03-17 2017-09-21 International Business Machines Corporation Providing queueing in a log streaming messaging system
US20170310628A1 (en) * 2016-04-21 2017-10-26 Confluent, Inc. Distributed message queue stream verification
US20170357703A1 (en) * 2013-11-11 2017-12-14 Amazon Technologies, Inc. Dynamic partitioning techniques for data streams

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170357703A1 (en) * 2013-11-11 2017-12-14 Amazon Technologies, Inc. Dynamic partitioning techniques for data streams
US20170272516A1 (en) * 2016-03-17 2017-09-21 International Business Machines Corporation Providing queueing in a log streaming messaging system
US20170310628A1 (en) * 2016-04-21 2017-10-26 Confluent, Inc. Distributed message queue stream verification

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Apache kafka. ‘Kafka 1.1 Documentation’(2018.05.30.) [URL: https://web.archive.org/web/20180530163522/https://kafka.apache.org/documentation/#log]* *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20210085993A (en) * 2019-12-31 2021-07-08 건국대학교 산학협력단 Message storing method based on distributed storage and appratus therefor

Also Published As

Publication number Publication date
KR102124897B1 (en) 2020-06-22

Similar Documents

Publication Publication Date Title
CN109582455B (en) Multithreading task processing method and device and storage medium
US20160117186A1 (en) Dynamic scaling of management infrastructure in virtual environments
US9921870B2 (en) System and method for supporting a scalable thread pool in a distributed data grid
JP6190389B2 (en) Method and system for performing computations in a distributed computing environment
US7574708B2 (en) Mechanism for enabling the distribution of operating system resources in a multi-node computer system
US8312462B2 (en) Reducing remote memory accesses to shared data in a multi-nodal computer system
US8910176B2 (en) System for distributed task dispatch in multi-application environment based on consensus for load balancing using task partitioning and dynamic grouping of server instance
Minhas et al. Elastic scale-out for partition-based database systems
US20160048415A1 (en) Systems and Methods for Auto-Scaling a Big Data System
US20170024251A1 (en) Scheduling method and apparatus for distributed computing system
US10356150B1 (en) Automated repartitioning of streaming data
US20230244694A1 (en) Database system, computer program product, and data processing method
JP2015506523A (en) Dynamic load balancing in a scalable environment
CN104679594B (en) A kind of middleware distributed computing method
US7266540B2 (en) Mechanism for dynamic workload rebalancing in a multi-nodal computer system
US20110208872A1 (en) Dynamic partitioning of data for data-parallel applications
CN102981929A (en) Management method and system for disk mirror images
US10733024B2 (en) Task packing scheduling process for long running applications
KR102124897B1 (en) Distributed Messaging System and Method for Dynamic Partitioning in Distributed Messaging System
CN104702691A (en) Distributed load balancing method and device
He et al. Design and implementation of a massively parallel version of DIRECT
CN115237580A (en) Intelligent calculation-oriented flow parallel training self-adaptive adjustment system and method
US20210390405A1 (en) Microservice-based training systems in heterogeneous graphic processor unit (gpu) cluster and operating method thereof
US8316375B2 (en) Load-balancing of processes based on inertia
Tavakoli et al. Log-assisted straggler-aware I/O scheduler for high-end computing

Legal Events

Date Code Title Description
A201 Request for examination
E902 Notification of reason for refusal
E90F Notification of reason for final refusal
E701 Decision to grant or registration of patent right
GRNT Written decision to grant