KR102124897B1 - 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
KR102124897B1
KR102124897B1 KR1020180065462A KR20180065462A KR102124897B1 KR 102124897 B1 KR102124897 B1 KR 102124897B1 KR 1020180065462 A KR1020180065462 A KR 1020180065462A KR 20180065462 A KR20180065462 A KR 20180065462A KR 102124897 B1 KR102124897 B1 KR 102124897B1
Authority
KR
South Korea
Prior art keywords
partition
consumer
partitions
messages
assigned
Prior art date
Application number
KR1020180065462A
Other languages
Korean (ko)
Other versions
KR20190139006A (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

Abstract

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

Figure 112018055889200-pat00003
Figure 112018055889200-pat00003

Description

분산 메시지 시스템 및 분산 메시지 시스템에서의 동적 파티셔닝 방법 {Distributed Messaging System and Method for Dynamic Partitioning in Distributed Messaging System}Distributed messaging 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 system (distributed messaging system) is designed to effectively deliver messages in various types of distributed computer systems and platforms, there are currently a number of 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 them, Apache kafka implements a fully-distributed message system unlike other solutions based on the existing centralized architecture. According to this Apache Kafka, multiple consumers can share messages in a traditional queuing method, and it is also possible to 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 existing Apache Kafka is configured to access only one consumer for a single message partition to maximize parallelism. In addition, the existing fully distributed message system uses a static partitioning scheme to divide the entire messages into multiple partitions and store them in multiple servers. That is, the existing fully distributed message system divides all 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 total message size affects the performance of the entire system. However, there may be a difference in the processing performance of the consumers, and in the case of not only delivering a message, but also a large-task composed of large-scale tasks (Many-Task Computing), the static partitioning method may cause a serious load balancing problem.

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

본 발명은, 상기와 같은 문제점을 인식하여 창안된 것으로서, 기존의 완전 분산(fully-distributed) 형태의 메시지 시스템과 같이 병렬성을 극대화하면서도, 시스템 성능을 높일 수 있는 완전 분산 형태의 메시지 시스템을 제공하는 것을 목적으로 한다.The present invention was created by recognizing the problems described above, and provides a fully distributed message system that maximizes parallelism and improves system performance, such as a conventional fully-distributed message system. It is aimed at.

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

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

(1) 본 발명의 일 실시예에 다른 분산 메시지 시스템은, 메시지들을 분할 저장하는 복수의 파티션들; 복수의 컨슈머들을 포함하는 컨슈머 그룹 - 하나의 파티션에 저장된 메시지들은 상기 컨슈머 그룹에 포함된 하나의 컨슈머에 의해 처리되고; 및 상기 복수의 파티션들에 대한 리스트 정보, 및 각 컨슈머와 상기 각 컨슈머에 할당된 파티션 간의 매핑 정보를 포함하는 메타 데이터를 관리하는 메시지 파티셔닝 모듈;을 포함할 수 있다.(1) A distributed message system according to an embodiment of the present invention includes: a plurality of partitions that divide and store 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 that manages metadata including list information for the plurality of partitions and mapping information between each consumer and a partition allocated to each consumer.

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

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

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

(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: determining whether there is a consumer without a partition assigned among the plurality of consumers. ; A process of 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; And a process of 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 meta data before the determining process; may further include.

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

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

(9) 상기 (1) 내지 (8) 중 어느 하나에 있어서, 상기 메타 데이터는, 상기 복수의 컨슈머들에 대한 리스트 정보를 더 포함할 수 있다.(9) In any one of (1) to (8), the meta data may further include list information for 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 without a partition assigned among a plurality of consumers exists; Equally dividing the messages remaining in the first partition in half among the plurality of partitions, and creating two new partitions to store the evenly divided messages in the two new partitions, respectively; Allocating the two new partitions to a consumer without the assigned partition and to a consumer that has been assigned to the first partition; And updating the metadata including list information about partitions and mapping information between each consumer and a partition allocated to each consumer; It may include.

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

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

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

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

상기 목적을 달성하기 위해 본 발명의 또 다른 측면에 따른 동적 파티셔닝 방법을 수행하도록 프로그래밍된 프로그램을 저장하는 저장매체가 개시된다.To achieve the above object, a storage medium storing a program programmed to perform a dynamic partitioning method according to another aspect of the present invention 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: determining whether a consumer without a partition assigned among a plurality of consumers exists; Equally dividing the messages remaining in the first partition in half among the plurality of partitions, and creating two new partitions to store the evenly divided messages in the two new partitions, respectively; Allocating the two new partitions to a consumer without the assigned partition and to a consumer that has been assigned to the first partition; And updating meta data including list information about partitions and mapping information between each consumer and a partition allocated to each consumer. It may be a storage medium that stores a program programmed to perform.

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

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

도 1은 완전 분산 형태의 메시지 시스템을 나타낸 도면이다.
도 2는 본 발명의 일 실시예에 따른 메시지 파티션 재분배 알고리즘을 나타내는 순서도이다.
도 3은 본 발명의 다른 실시예에 따른 메시지 파티션 재분배 알고리즘을 나타낸 순서도이다.
1 is a view showing a fully distributed message system.
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 view showing a fully distributed message system.

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

카프카 클러스터(10)는, 메시지들을 분산 처리하는 요소(element)로서, 하나의 이상의 서버들을 포함할 수 있다. 카프카 클러스터는 다수의 서버들에 메시지들을 분할하여 저장할 수 있다. 전체 메시지들은 소정 개수의 파티션들(Partitions:p0, p1, p2, p3)로 분할되고, 파티션들은 복수의 서버들(Server 1, Server 2)에 나누어 저장될 수 있다. 이와 같이 다수의 서버들이 메시지 파티션들을 분할하여 저장함으로써 대규모 메시지 처리 요청을 효율적으로 처리할 수 있다. 여기서, 서버는 메시지를 분산 처리하는 구성으로서, 브로커라고 지칭될 수도 있다.The Kafka cluster 10 may include one or more servers as an element for distributing and processing messages. The Kafka cluster can store messages in multiple servers. The entire messages are divided into a predetermined number of partitions (Partitions: p0, p1, p2, p3), and the partitions can be divided and stored in a plurality of servers (Server 1, Server 2). In this way, a large number of servers can efficiently process large-scale message processing requests by dividing and storing message partitions. Here, the server is a configuration for processing distributed messages, and 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 above-described partition is configured to be accessible only through a single consumer belonging to the consumer group to maximize 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 partition, and the p1, p2 partition, respectively, and the consumer group B (consumer group B). Consumers c3, c4, c5, and c6 included in p0, p3, p1, and p2, respectively, may be dedicated. In other words, the p0 and p3 partitions are allocated to the consumer (c1) included in the consumer group A, and the p1 and p2 partitions are allocated to the consumer (c2) included in the consumer group A (consumer group A). Can be.

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

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

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

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

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

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

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

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

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

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

메시지 파티셔닝 모듈에 의해 관리되는 메타 데이터는 리스트 정보와, 매핑 정보를 포함할 수 있다. 여기서, 리스트 정보는 상기 N개의 파티션들의 리스트 정보, 상기 M개의 컨슈머들에 대한 리스트 정보를 포함할 수 있고, 상기 매핑 정보는 상기 N개의 파티션들과, 상기 M개의 컨슈머들 사이의 매핑 정보를 의미할 수 있다.The 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 refers to 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 assigned to each partition. Alternatively, the mapping information may be expressed in a form indicating which partition is allocated for each consumer. In one embodiment, the mapping information may be an AllocPatition[N] array. The AllocPatition[N] array may indicate which consumer is assigned an arbitrary partition pi. Here, both P and C mean an active state. That is, an already processed partition or an ended consumer is 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 a consumer (cx) having no partition assigned among consumers exists (step 201). Here, the consumer (cx) without the 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 processing a partition in charge of each, the dynamic redistribution algorithm of this cycle ends.

할당된 파티션이 없는 컨슈머가 존재하는 경우, 메시지 파티셔닝 모듈이 파티션들(P) 중에서 처리해야 할 메시지들이 가장 많이 남아있는 파티션(pk)을 선택한다(단계 203). If a consumer without an assigned partition exists, the message partitioning module selects a partition pk in which the messages to be processed remain the most 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 less than a threshold (in one embodiment, the same case may be included), the dynamic redistribution algorithm of this cycle ends. Here, the threshold may be set based on the number of messages that can make up a sufficient workload even if the remaining messages are divided.

상기 파티션(pk)에 남아있는 메시지의 수가 임계값(threshold)보다 큰 경우(일 실시예에서, 같은 경우도 포함할 수 있음), 메시지 파티셔닝 모듈은 처리해야 할 메시지들이 가장 많이 남은 파티션(pk)을 처리하는 컨슈머(cl)의 동작을 정지(hold)하고, 상기 파티션(pk)에 남아있는 메시지들을 균등하게 분할한다(단계 205). 일 실시예에서, 메시지 파티셔닝 모듈은 상기 파티션(pk)에 남아있는 메시지들을 두 개의 균등한 파티션들(pd1, pd2)로 분할할 수 있다. 상기 파티션(pk)에서 기존에 처리한 메시지들은 완료된 메시지들이므로, 메시지 파티셔닝 모듈은 해당 파티션(pk)을 종료 처리한다.When the number of messages remaining in the partition pk is greater than a threshold (in one embodiment, the same case may be included), the message partitioning module partitions the most remaining messages to be processed (pk) The operation of the consumer (cl) for processing is held, and the messages remaining in the partition (pk) are evenly divided (step 205). In one embodiment, the message partitioning module may divide 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 corresponding partition pk.

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

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

이로서, 동적 재분배 알고리즘의 한 주기가 완료되고, 다음 주기의 동적 재분배 알고리즘이 반복될 수 있다. 즉, 도 2는 동적 재분배 알고리즘의 한 주기를 나타낸 것으로서, 동적 재분배 알고리즘은 주기적으로 반복될 수 있다. As such, one period of the dynamic redistribution algorithm is completed, and the dynamic redistribution algorithm of the next period 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 largest message partition is divided sequentially, it is possible to minimize the shortening of the redistribution period. Meanwhile, since the dynamic redistribution algorithm is performed not periodically but periodically, it is possible to reflect the workload of the consumer that changes every moment.

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

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

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

기존의 메시지를 처리하던 컨슈머들 중 어느 하나의 컨슈머(Cf)가 예기치 못한 상황으로 종료(failure)되는 이벤트가 발생하면, 메시지 파티셔닝 모듈은 종료된 컨슈머(cf)가 처리하던 파티션(pa)에서 처리되지 않고 남은 메시지들을 이용하여 신규 파티션(pb)를 생성한다(단계 303). 즉, 메시지 파티셔닝 모듈은 남은 메시지들로 구성된 신규 파티션(pb)을 생성한다. 한편, 기존의 파티션(pa)은 종료 처리될 수 있다. 일 실시예에서, 메시지 파티셔닝 모듈은 기존의 파티션(pa)을 종료 처리할 수 있다.When an event in which any consumer (Cf) of existing consumers processing a message fails due to an unexpected situation, the message partitioning module processes the partition (pa) 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 allocates the created new partition pb to the consumer cx without the assigned partition (step 305).

도 3을 통해 설명한 컨슈머 종료(failure) 이벤트는 컨슈머들의 메시지 처리 동작 중에 발생할 수 있는 이벤트이다. 즉, 도 2에서 설명한 동적 재분배 알고리즘의 주기가 반복되는 과정 중에 발생할 수 있다. 컨슈머 종료 이벤트가 발생한 경우, 메시지 파티셔닝 모듈은 신규 파티션을 생성하고, 단계 201에 이르기 까지 대기할 수 있다. 즉, 도 3의 단계 305는 도 2의 단계 201 및 단계 203을 의미할 수 있다.The consumer failure event described through FIG. 3 is an event that may occur during the message processing operation of the consumers. That is, it may occur during a process in which the period of the dynamic redistribution algorithm described in FIG. 2 is repeated. When the consumer end 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 steps 201 and 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 according to the dynamic partitioning process described through 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, it is assumed that there are 5 partitions (p0, p1, p2, p3, p4), 5 consumers (c0, c1, c2, c3, c4), and that a total of 100,000 messages are processed. do. At this time, 20,000 messages are distributed to the five partitions p0, p1, p2, p3, and p4, respectively. Each consumer is configured to process one partition. For convenience, it is assumed 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 includes, as list information, partition list information P = {p0, p1, p2, p3, p4} and consumer list information C = {c0, c1, c2, c3, c4}. It may include {c0, p0}, {c1, p1}, {c2, p2}, {c3, p3}, {c4, p4} mapping information AllocPatition[4] (see Table 1 below). Reference)

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

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

한편, 메시지 파티셔닝 모듈은 메타 데이터를 업데이트한다. 기존에 존재하던 파티션(p2)에 포함된 메시지들은 모두 처리되었고, 기존에 존재하던 파티션(p4)는 새로운 파티션들로 분할되었으므로, p2와, p4는 파티션 리스트에서 삭제되고, 새로운 파티션인 p5, p6가 파티션 리스트에 추가된다. 그리고, 기존의 파티션(p2)을 처리하던 컨슈머(c2)와, 자신에게 할당된 메시지들을 모두 처리하여 할당된 파티션이 없는 컨슈머(c4)에 대한 파티션 매핑 정보도 업데이트 된다.Meanwhile, the message partitioning module updates meta data. All messages included in the existing partition (p2) have been processed, and since the existing partition (p4) has been divided into new partitions, p2 and p4 are 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 processed the existing partition p2 and the consumer c4 without the assigned partition is updated by processing all the messages assigned to it.

결과적으로, 업데이트된 메타 데이터는, 리스트 정보로서, 파티션 리스트 정보인 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 meta data includes partition list information P = {p0, p1, p3, p5, p6}, and consumer list information C = {c0, c1, c2, c3, c4} as list information. It may include, {c0, p0}, {c1, p1}, {c2, p5}, {c3, p3}, and {c4, p6} mapping information AllocPatition[4].

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

Figure 112018055889200-pat00001
Figure 112018055889200-pat00001

전술한 예시는, 컨슈머가 자신이 담당한 파티션에 대한 처리를 완료하여 컨슈머 풀에 변화가 발생한 경우에 대한 것이나, 신규 컨슈머가 컨슈머 풀에 참여한 경우 또는 컨슈머가 담당 파티션에 대한 처리를 끝내지 못하고 종료(failure)된 경우에도 유사하게 적용될 수 있다. The above-described example is for a case where a change in the consumer pool occurs due to the completion of processing of a partition in which the consumer is in charge, or when a new consumer participates in the consumer pool or the consumer fails to finish processing for the responsible partition ( It can be similarly applied in case of failure.

전술한 예시에서 볼 수 있듯이, 처리되어야 할 메시지가 많이 남은 파티션을 분할하게 되면, 로드 밸런싱을 개선할 수 있을 뿐만 아니라, 재분배 주기가 짧아지는 것을 최소화할 수 있다. 재분배 작업이 일어나는 동안에는 메시지 처리가 불가능하므로, 재분배 주기가 길어지도록 유도하면 재분배 작업으로 인해 시스템 성능이 낮아지는 것을 방지할 수 있다.As can be seen in the above example, if a partition having a lot of messages to be processed is partitioned, load balancing can be improved, and the redistribution cycle can be shortened. Since message processing is not possible during the redistribution operation, inducing the redistribution period to be long can prevent system performance from being reduced due to the redistribution operation.

한편, 전술한 예시에서, 특정 시점에 파티션(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 a case where the number of messages remaining in the partition is greater than a threshold value, and a sufficient workload can be configured by dividing the remaining messages. On the other hand, if the number of remaining messages is not sufficient, partitioning the partition may not have much meaning. Rather, if the number of remaining messages is insufficient, partitioning the partition may degrade system performance due to the redistribution operation. The above-described example is configured to not perform dynamic partitioning when the number of remaining messages does not exceed a predetermined threshold, thereby preventing system performance from deteriorating.

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

향후 IoT(Internet of Things)의 발전과 함께 다양한 형태의 메시지들이 분산 메시지 시스템을 통해서 연동되면 정적 파티셔닝 기법으로 인한 로드 밸런싱 문제가 지속적으로 발생할 수 있다. 본 발명에 따르면, 비교적 최소한의 노력으로 동적 파티셔닝 기법을 구현함으로써, 분산 메시지 시스템이 고성능 메시지 처리 성능을 유지하는데 큰 도움을 줄 수 있다. With the development of the Internet of Things (IoT) in the future, when various types of messages are interlocked through a distributed message system, a load balancing problem due to a static partitioning technique may continuously occur. According to the present invention, by implementing a dynamic partitioning technique with relatively minimal effort, a distributed message system can greatly assist in maintaining 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 the module, unit or device may be processors that execute successive processes stored in a memory (or storage unit). Each of the steps described in the above-described embodiment can be performed by hardware/processors. Each of the constituent units described in the above-described embodiment can operate as a hardware/processor. Also, the methods proposed by the present invention can be executed as code. This code can be written to a storage medium that can be read by a processor, and thus can be read by a processor provided by an apparatus.

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

본 발명에 따른 장치 및 방법은 상술한 바와 같이 설명된 실시 예들의 구성과 방법이 한정되게 적용될 수 있는 것이 아니라, 상술한 실시 예들은 다양한 변형이 이루어질 수 있도록 각 실시 예들의 전부 또는 일부가 선택적으로 조합되어 구성될 수도 있다.The 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 a part or all of each of the embodiments selectively so that various modifications can be made It may be configured in combination.

한편, 본 발명이 제안하는 방법을 네트워크 디바이스에 구비된, 프로세서가 읽을 수 있는 기록매체에, 프로세서가 읽을 수 있는 코드로서 구현하는 것이 가능하다. 프로세서가 읽을 수 있는 기록매체는 프로세서에 의해 읽혀질 수 있는 데이터가 저장되는 모든 종류의 기록장치를 포함한다. 프로세서가 읽을 수 있는 기록 매체의 예로는 ROM, RAM, CD-ROM, 자기 테이프, 플로피디스크, 광 데이터 저장장치 등이 있다. 또한, 프로세서가 읽을 수 있는 기록매체는 네트워크로 연결된 컴퓨터 시스템에 분산되어, 분산방식으로 프로세서가 읽을 수 있는 코드가 저장되고 실행될 수 있다.Meanwhile, it is possible to implement the method proposed by the present invention as a code readable by a processor in a recording medium readable by a processor provided in a network device. The processor-readable recording medium includes all kinds of recording devices in which data that can be read by the processor are stored. Examples of the recording medium readable by the processor include ROM, RAM, CD-ROM, magnetic tape, floppy disk, and optical data storage device. In addition, the processor readable recording medium may 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 embodiments of the present invention have been illustrated and described above, the present invention is not limited to the specific embodiments described above, and the technical field to which the present invention belongs without departing from the gist of the present invention claimed in the claims. In addition, various modifications can be implemented by a person having ordinary knowledge in the course, and these modifications should not be individually understood from the technical idea or prospect of the present invention.

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

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

본 명세서에서 장치 및 방법 발명이 모두 언급되고, 장치 및 방법 발명 모두의 설명은 서로 보완하여 적용될 수 있다.In this specification, both the device and method inventions are mentioned, and the descriptions of both the device and method inventions can be applied to complement each other.

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

Claims (15)

메시지들을 분할 저장하는 복수의 파티션들;
복수의 컨슈머들을 포함하는 컨슈머 그룹,
하나의 파티션에 저장된 메시지들은 상기 컨슈머 그룹에 포함된 하나의 컨슈머에 의해 처리되고; 및
상기 하나의 컨슈머가 상기 하나의 파티션을 처리하는 동안,
상기 복수의 파티션들에 대한 리스트 정보, 및 각 컨슈머와 상기 각 컨슈머에 할당된 파티션 간의 매핑 정보를 포함하는 메타 데이터를 관리하는 메시지 파티셔닝 모듈; 을 포함하고,
상기 메시지 파티셔닝 모듈은, 동적 재분배 오퍼레이션이 수행될 때 마다 상기 메타 데이터를 업데이트하고,
상기 동적 재분배 오퍼레이션은 상기 메시지 파티셔닝 모듈에 의해 수행되는 것으로서:
상기 복수의 컨슈머들 중에서 할당된 파티션이 없는 컨슈머가 존재하는지 판단하는 프로세스;
복수의 파티션들 중에서 메시지들의 수가 최대값인 제1 파티션을 선택하고,
상기 제1 파티션에 남아 있는 메시지들을 반으로 균등 분할하고, 2개의 신규 파티션을 생성하여 상기 균등 분할된 메시지들을 상기 2개의 신규 파티션에 각각 저장하는 프로세스; 및
상기 할당된 파티션이 없는 컨슈머와, 상기 제1 파티션에 할당되었던 컨슈머에 상기 2개의 신규 파티션을 각각 할당하는 프로세스; 를 포함하는,
분산 메시지 시스템.

A plurality of partitions for partitioning and 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
While the consumer is processing the partition,
A message partitioning module that manages metadata including list information for the plurality of partitions and mapping information between each consumer and a partition assigned to each consumer; Including,
The message partitioning module updates the metadata each time a dynamic redistribution operation is performed,
The dynamic redistribution operation is performed by the message partitioning module:
A process of determining whether a consumer without an assigned partition exists among the plurality of consumers;
A first partition having a maximum number of messages is selected from a plurality of partitions,
A process of equally dividing the messages remaining in the first partition in half, creating two new partitions, and storing the evenly divided messages in the two new partitions, respectively; And
A process of allocating the two new partitions to a consumer without the assigned partition and a consumer that has been assigned to the first partition; Containing,
Distributed message system.

삭제delete 제 1 항에 있어서,
상기 동적 재분배 오퍼레이션은, 소정 주기에 따라, 또는 상기 컨슈머 그룹에 변화가 발생할 때 마다 수행되는 것을 특징으로 하는 분산 메시지 시스템.
According to claim 1,
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,
When a change occurs in the consumer group,
When a new consumer joins the consumer group, when at least one consumer among the plurality of consumers processes all messages stored in a partition assigned to the consumer, and at least one consumer among the plurality of consumers Distributed message system, characterized in that any one of the cases that terminated without processing the message stored in the assigned partition.
삭제delete 제 1 항에 있어서,
상기 판단하는 프로세스 이전에, 상기 메타 데이터를 생성하는 프로세스;를 더 포함하는 것을 특징으로 하는 분산 메시지 시스템.
According to claim 1,
And a process for generating the metadata before the determining process.
제 1 항에 있어서,
상기 제1 파티션은 상기 복수의 파티션들 중에서 처리되어야 할 메시지들이 가장 많이 남은 파티션인 것을 특징으로 하는 분산 메시지 시스템.
According to claim 1,
The first partition is a distributed message system, characterized in that the message is the most remaining message to be processed among the plurality of partitions.
제 1 항에 있어서,
상기 판단하는 프로세스 이후에, 상기 제1 파티션에 남아 있는 메시지의 수를 임계값과 비교하는 프로세스; 를 더 포함하는 것을 특징으로 하는 분산 메시지 시스템.
According to claim 1,
A process of comparing the number of messages remaining in the first partition with a threshold value after the determining process; Distributed message system further comprising a.
제 1 항에 있어서,
상기 메타 데이터는, 상기 복수의 컨슈머들에 대한 리스트 정보를 더 포함하는 것을 특징으로 하는 분산 메시지 시스템.
According to claim 1,
The meta data further comprises a list information for the plurality of consumers distributed message system.
하나의 파티션에 저장된 메시지들은 복수의 컨슈머들을 포함하는 컨슈머 그룹에 포함된 하나의 컨슈머에 의해 처리하는 동적 파티셔닝 방법에 있어서,
복수의 파티션들이 메시지들을 분할 저장하는 단계;
상기 복수의 파티션들에 대한 리스트 정보, 및 각 컨슈머와 상기 각 컨슈머에 할당된 파티션 간의 매핑 정보를 포함하는 메타 데이터를 관리하는 단계;
상기 하나의 컨슈머가 상기 하나의 파티션을 처리하는 동안, 동적 재분배 오퍼레이션이 수행될 때 마다 상기 메타 데이터를 업데이트하는 단계;
상기 복수의 컨슈머들 중에서 할당된 파티션이 없는 컨슈머가 존재하는지 판단하는 단계; 를 포함하고,
복수의 파티션들 중에서 메시지들의 수가 최대값인 제1 파티션을 선택하고,
상기 제1 파티션에 남아 있는 메시지들을 반으로 균등 분할하고, 2개의 신규 파티션을 생성하여 상기 균등 분할된 메시지들을 상기 2개의 신규 파티션에 각각 저장하고,
상기 할당된 파티션이 없는 컨슈머와, 상기 제1 파티션에 할당되었던 컨슈머에 상기 2개의 신규 파티션을 각각 할당하는,
분산 메시지 시스템에서의 동적 파티셔닝 방법.

In the dynamic partitioning method, messages stored in one partition are processed by one consumer included in a consumer group including a plurality of consumers,
Storing a plurality of partitions by dividing the messages;
Managing meta data including list information for the plurality of partitions and mapping information between each consumer and a partition allocated to each consumer;
Updating the metadata each time a dynamic redistribution operation is performed while the one consumer processes the one partition;
Determining whether there is a consumer without a partition assigned among the plurality of consumers; Including,
A first partition having a maximum number of messages is selected from a plurality of partitions,
The messages remaining in the first partition are equally divided in half, and two new partitions are created to store the evenly divided messages in the two new partitions,
Assigning the two new partitions to a consumer without the assigned partition and to a consumer that has been assigned to the first partition,
Dynamic partitioning method in distributed message system.

삭제delete 제 10 항에 있어서,
상기 메타 데이터는, 상기 복수의 컨슈머들에 대한 리스트 정보를 더 포함하는 것을 특징으로 하는 분산 메시지 시스템에서의 동적 파티셔닝 방법.
The method of claim 10,
The meta data, dynamic partitioning method in a distributed message system further comprises a list information for the plurality of consumers.
제 10 항에 있어서,
상기 제1 파티션은 상기 복수의 파티션들 중에서 처리되어야 할 메시지들이 가장 많이 남은 파티션인 것을 특징으로 하는 분산 메시지 시스템에서의 동적 파티셔닝 방법.
The method of claim 10,
The first partition is a dynamic partitioning method in a distributed message system, characterized in that the message is the most remaining partition to be processed among the plurality of partitions.
제 10 항에 있어서,
상기 판단하는 단계 이후에, 상기 제1 파티션에 남아 있는 메시지의 수를 임계값과 비교하는 단계; 를 더 포함하는 것을 특징으로 하는 분산 메시지 시스템에서의 동적 파티셔닝 방법.
The method of claim 10,
After the determining step, comparing the number of messages remaining in the first partition with a threshold value; Dynamic partitioning method in a distributed message system further comprising a.
복수의 파티션들이 메시지들을 분할 저장하는 단계;
상기 복수의 파티션들에 대한 리스트 정보, 및 각 컨슈머와 상기 각 컨슈머에 할당된 파티션 간의 매핑 정보를 포함하는 메타 데이터를 관리하는 단계;
컨슈머가 상기 컨슈머에 대한 파티션에 할당된 동안, 동적 재분배 오퍼레이션이 수행될 때 마다 상기 메타 데이터를 업데이트하는 단계;
복수의 파티션들 중에서 메시지들의 수가 최대값인 제1 파티션을 선택하는 단계;
상기 제1 파티션에 남아 있는 메시지들을 반으로 균등 분할하고, 2개의 신규 파티션을 생성하여 상기 균등 분할된 메시지들을 상기 2개의 신규 파티션에 각각 저장하는 단계;
상기 할당된 파티션이 없는 컨슈머와, 상기 제1 파티션에 할당되었던 컨슈머에 상기 2개의 신규 파티션을 각각 할당하는 단계; 를 수행하도록 프로그래밍된 프로그램을 저장한 컴퓨터에서 판독 가능한 저장매체.


Storing a plurality of partitions by dividing the messages;
Managing meta data including list information for the plurality of partitions and mapping information between each consumer and a partition allocated to each consumer;
Updating the metadata whenever a dynamic redistribution operation is performed while the consumer is assigned to the partition for the consumer;
Selecting a first partition having a maximum number of messages from a plurality of partitions;
Equally dividing the messages remaining in the first partition in half, creating two new partitions, and storing the equally divided messages in the two new partitions;
Allocating the two new partitions to a consumer without the assigned partition and to a consumer that has been assigned to the first partition; A computer-readable storage medium storing a program programmed to perform the operation.


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 KR20190139006A (en) 2019-12-17
KR102124897B1 true 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
KR102484737B1 (en) * 2021-10-29 2023-01-05 한국전자기술연구원 Method for selecting distributed message buffer partition of data in mobile IoT environment

Families Citing this family (1)

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

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
KR102484737B1 (en) * 2021-10-29 2023-01-05 한국전자기술연구원 Method for selecting distributed message buffer partition of data in mobile IoT environment

Also Published As

Publication number Publication date
KR20190139006A (en) 2019-12-17

Similar Documents

Publication Publication Date Title
US11561841B2 (en) Managing partitions in a scalable environment
CN109582455B (en) Multithreading task processing method and device and storage medium
US9977689B2 (en) Dynamic scaling of management infrastructure in virtual environments
JP6185486B2 (en) A method for performing load balancing in a distributed computing environment
US20160004571A1 (en) System and method for load balancing in a distributed system by dynamic migration
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
US20160162562A1 (en) Database system, computer program product, and data processing method
US8776077B2 (en) Method for multithreading an application using partitioning to allocate work to threads
US20160171073A1 (en) Database system, computer program product, and data processing method
US20170024251A1 (en) Scheduling method and apparatus for distributed computing system
KR20180027326A (en) Efficient data caching management in scalable multi-stage data processing systems
KR20130136449A (en) Controlled automatic healing of data-center services
CN104679594B (en) A kind of middleware distributed computing method
US20140279902A1 (en) Database system, computer program product, and data processing method
US8799629B2 (en) Parallel execution of a loop
CN102981929A (en) Management method and system for disk mirror images
CN107515781B (en) Deterministic task scheduling and load balancing system based on multiple processors
US10733024B2 (en) Task packing scheduling process for long running applications
US20150046541A1 (en) System and method for providing a messaging cluster with hybrid partitions
CN104254839A (en) Systems and methods for partitioning of singly linked lists for allocation memory elements
KR102124897B1 (en) Distributed Messaging System and Method for Dynamic Partitioning in Distributed Messaging System
CN104702691A (en) Distributed load balancing method and device
US8316375B2 (en) Load-balancing of processes based on inertia
US20210390405A1 (en) Microservice-based training systems in heterogeneous graphic processor unit (gpu) cluster and operating method thereof
US9009713B2 (en) Apparatus and method for processing task

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