SYSTEM, METHOD AND COMPUTER READABLE STORAGE MEDIUM FOR PARTITIONING KEYSPACE

A system for partitioning a keyspace includes: a system for partitioning a keyspace, includes: a server configured to transmit a partition setting item based on a keyspace creation request; and a database configured to receive the partition setting item and configured to create a first partition for the keyspace based on the received partition setting item, wherein the partition setting item includes a replication factor and at least one of a size of a second partition for storing data or a storage period of the data.

CROSS-REFERENCE TO RELATED APPLICATION(S)

This application is based on and claims priority under 35 U.S.C. § 119 to Korean Patent Application No. 10-2022-0141732, filed on Oct. 28, 2022, in the Korean Intellectual Property Office, the disclosure of which is incorporated by reference herein in its entirety.

BACKGROUND

The disclosure relates to a system, method and computer readable storage medium for partitioning of a keyspace.

2. Description of the Related Art

Cassandra is a distributed database based on Apache open source. Unlike existing relational databases, Cassandra is a NoSQL database not using Structured Query Language (SQL), and thus, has the advantage of being able to process large amounts of transactions quickly.

Basically, Cassandra has a structure in which a number of nodes are connected in a ring form, and has data distributed and stored in respective nodes. In this case, since the storage capacity per node is recommended to be, for example, 1 terabyte, there may be a problem in that resources such as disks and the like should be added or replaced whenever the storage capacity is exceeded.

SUMMARY

Provided are a system, method and computer readable storage medium for partitioning of a keyspace, in which storage capacity may be efficiently managed and a problem of recommended storage capacity of nodes may be resolved.

According to an aspect of the disclosure, a system for partitioning a keyspace, includes: a server configured to transmit a partition setting item based on a keyspace creation request; and a database configured to receive the partition setting item and configured to create a first partition for the keyspace based on the received partition setting item, wherein the partition setting item includes a replication factor and at least one of a size of a second partition for storing data or a storage period of the data.

In some embodiments, the server is configured to request a registration of a cloud service based on an event to a cloud-service-providing device, and wherein the cloud-service-providing device is configured to store the cloud service requested for the registration.

In some embodiments, based on the event being a first event, in which a first access frequency is lower than a preset access frequency, the cloud service is configured to provide a first command for reducing the replication factor to the database, wherein, based on the event being a second event, in which the storage period of the data has elapsed, the cloud service is configure to provide a second command to delete the data for which the storage period has elapsed to the database, and wherein, based on the event being a third event, in which a data usage compared to the size of the partition is a predetermined ratio or more, the cloud service is configured to provide a third command to additionally create a third partition for storing the data to the database.

In some embodiments, the server is further configured to: monitor a second access frequency of the data stored in the partition and a magnitude of the data stored in the partition, and transmit an event alarm including at least one of the first event, the second event, or the third event based on a monitoring result to the cloud-service-providing device.

In some embodiments, the cloud-service-providing device is configured to, based on the event alarm, provide the cloud service according to at least one of the first event, the second event, or the third event to the database in an event-triggered manner.

In some embodiments, the partition setting item further includes a name of the keyspace, a time stamp, and a storage period, and wherein the partition setting item is stored as a JavaScript Object Notation (JSON) file.

According to an aspect of the disclosure, a method of partitioning a keyspace, the method includes: transmitting, in a server, a partition setting item based on a keyspace creation request; and receiving, in a database, the partition setting item and creating a first partition for the keyspace based on the received partition setting item, wherein the partition setting item includes a replication factor and at least one of a size of a second partition for storing data or a storage period of the data.

In some embodiments, the method further includes: requesting, in the server, a registration of a cloud service based on an event to a cloud-service-providing device; and storing, in the cloud-service-providing device, the cloud service requested for the registration.

In some embodiments, based on the event being a first event, in which a first access frequency is lower than a preset access frequency, the cloud service is configured to provide a first command for reducing the replication factor to the database, based on the event being a second event, in which the storage period of the data has elapsed, the cloud service is configured to provide a second command to delete the data for which the storage period has elapsed to the database, and based on the event being a third event, in which a data usage compared to the size of the partition is a predetermined ratio or more, the cloud service is configured to provide a third command to additionally create a third partition for storing the data to the database.

In some embodiments, the method further includes: monitoring, in the server, a second access frequency of the data stored in the partition and a magnitude of the data stored in the partition; and transmitting, by the server, an event alarm including at least one of the first event, the second event, or the third event based on a result of the monitoring to the cloud-service-providing device.

In some embodiments, the method further includes: providing, by the cloud-service-providing device based on the event alarm, the cloud service according to at least one of the first event, the second event, or the third event to the database in an event-triggered manner.

In some embodiments, the partition setting item further includes a name of the keyspace, a time stamp, and a storage period, and wherein the partition setting item is stored as a JavaScript Object Notation (JSON) file.

According to an aspect of the disclosure, a non-transitory computer-readable recording medium storing computer program, which, when executable by at least one processor, causes the at least one processor to execute: transmit, in a server, a partition setting item based on a keyspace creation request; and receive, in a database, the partition setting item and creating a first partition for a keyspace based on the received partition setting item, wherein the partition setting item includes a replication factor and at least one of a size of a second partition for storing data or a storage period of the data.

DETAILED DESCRIPTION

Hereinafter, embodiments of the disclosure will be described with reference to the accompanying drawings. However, the embodiment may be modified in many different forms, and the scope of the disclosure is not limited only to the embodiments described below. The shapes and sizes of elements in the drawings may be exaggerated for clearer explanation. Elements indicated by the same reference numerals in the drawings are the same elements.

First, in the disclosure, Cassandra is a distributed database based on Apache open source, and unlike existing relational databases, Cassandra is a NoSQL database that does not use Structured Query Language (SQL). Cassandra basically has a structure in which a number of nodes are connected in a ring form, and data may be distributed and stored in respective nodes.

Also, in the disclosure, keyspace partitioning refers to creating partitions in units of keyspaces within the storage space (disk) of a database or managing partitions in units of created keyspaces.

Hereinafter, the server used in Cassandra will be described as an example, and the database used in Cassandra will be described as an example.

FIG.1is a block diagram of a system100for partitioning a keyspace according to an embodiment, and the system100may include an administrator terminal110, a server120, a database130, and a cloud service providing device140.

On the other hand,FIG.2is a diagram illustrating the keyspace used in Cassandra.

FIGS.3A to3Care diagrams illustrating monitoring results using Java Management eXtensions (JMX), an open Application Programming Interface (API), according to an embodiment.

Hereinafter, the system100for partitioning a keyspace according to an embodiment will be described with reference toFIGS.1and3C.

The administrator terminal110is a terminal that transmits a keyspace creation request to the server120, and for example, may be included in a smartphone, a mobile phone, a laptop computer, a digital broadcasting terminal, Personal Digital Assistants (PDA), a Portable Multimedia Player (PMP), a tablet PC, a desktop PC, and the like.

The above-described keyspace creation request may include a partition setting item. As the partition setting item, in addition to the existing replication factor, at least one of the size of the partition for storing data and the retention period of data may be further included.

In creating a keyspace, it is determined how many nodes to replicate the partition to, which is referred to a replication factor. For example, when the replication factor is set to 3, a partition may be replicated to two adjacent nodes.

In addition, as illustrated inFIG.2, the keyspace is a data model including a plurality of tables, in which each table is comprised of a number of rows, and each row contains data (Column name, Column value).

On the other hand, the server120may include a control unit121and a monitoring unit122.

When a request for creating a keyspace is received, the control unit121may transmit partition setting items included therein to the database130.

In addition, the control unit121may request registration of the cloud service according to the event to the cloud service providing device140to be described later. Accordingly, the cloud service providing device140may store the cloud service requested for registration.

The above-described event may include first to third events.

In detail, the first event may be a case in which the frequency of access to data is lower than a preset frequency of access. The second event may be when the storage period of data has elapsed. Also, the third event may be a case in which data usage compared to the size of the partition is equal to or greater than a predetermined ratio.

In addition, the cloud service according to an event may include the following contents.

In detail, when the event is the first event, the cloud service may be a service providing a command to decrease the replication factor to the database130.

In addition, when the event is the second event, the cloud service may be a service providing a command to delete data for which the retention period has elapsed to the database130.

In addition, when the event is the third event, the cloud service may be a service providing a command to additionally create a partition for data storage to the database130.

Although the first event, the second event, and the third event and the contents of the cloud service according to the first event, the second event, and the third event are specifically described in the disclosure, this is to help in an understanding of the disclosure, and various modifications may be made according to the needs of those skilled in the art.

In addition, the control unit121may transmit an event alarm including at least one of the first event, the second event, and the third event to the cloud service providing device140based on a monitoring result of the monitoring unit122to be described later. Thereafter, the cloud service providing device140may provide the cloud service according to at least one of the first event, the second event, and the third event to the database130in an event-triggered manner according to the event notification.

On the other hand, the monitoring unit122may monitor the access frequency of data stored in the partition and the size of data stored in the partition. Monitoring results may be transmitted to the above-described control unit121.

According to an embodiment, the monitoring unit122may monitor using JMX. JMX may be an open API of Java.

FIGS.3A to3Cillustrate monitoring results using JMX. For example, JMX may monitor the usage of the partitioned storage medium (disk), as illustrated inFIG.3A. Alternatively, JMX may monitor the data size of each node as illustrated inFIG.3B. Alternatively, as illustrated inFIG.3C, JMX may compare and monitor the sizes of data for respective nodes (corresponding to the vertical axis).

On the other hand, the database130may include a control unit131, an authentication unit132, and a storage unit133.

The control unit131may receive a partition setting item from the server120, and create a partition for a keyspace in the storage unit133according to the received partition setting item.

In addition, the control unit131may manage partitions according to cloud services based on events provided from the cloud service providing device140.

In detail, when the cloud service is a cloud service according to the first event, a preset replication factor may be reduced.

Alternatively, when the cloud service is a cloud service according to the second event, data for which the retention period has elapsed may be deleted.

Alternatively, when the cloud service is a cloud service according to the third event, a partition may be additionally created to store data.

On the other hand, the authentication unit132may be used to authenticate an administrator terminal.

For example, when the keyspace creation request transmitted from the administrator terminal includes administrator information, administrator information may be further included in the partition setting item. In this case, the authentication unit132may authenticate the authority of the administrator terminal110based on the administrator information.

The storage unit133is a high-capacity storage medium for storing data, and a partition for a key space is created in the storage space. Data may be stored in the structure illustrated inFIG.2.

According to an embodiment, the above-described partition setting items may further include a keyspace name, a time stamp, and a storage period, and may be stored as a JavaScript Object Notation (JSON) file.

These JSON files may be used to retrieve partition setting items.

For example, when requesting a keyspace including an inquiry date from the server120, the database130may search for a partition setting item having a storage period including the inquiry date, and transmit the searched partition setting item to the server120.

Finally, the cloud service providing device140may include an event trigger141and a storage unit142.

The event trigger141may store a cloud service according to an event requested for registration from the server120, in the storage unit142.

In detail, the cloud service may be a service providing a command for decreasing the replication factor to the database130when the event is the first event, and when the event is the second event, the cloud service may be a service providing a command to the database130to delete data for which the retention period has elapsed, and when the event is the third event, the cloud service may be a service providing a command to additionally create a partition for data storage to the database130, as described above.

In addition, when the event trigger141receives an event notification from the server120, with reference to the storage unit142, the event trigger141may provide a cloud service according to at least one of the first event, the second event, and the third event to the database130in an event triggered manner.

As described above, according to an embodiment, by creating and managing partitions by adding at least one of the size of the partition for storing data and the retention period of data in addition to the existing replication factor as a partition setting item for the keyspace, storage capacity may be managed more efficiently than in the case of managing partitions by setting a replication factor of a fixed value in the related art.

In addition, according to an embodiment, a cloud service for processing events according to data access frequency, data storage period, and partition usage is registered in the cloud service providing device, and the cloud service is provided in an event-triggered manner. Therefore, the problem of the recommended storage capacity of the node may be resolved by allowing the database to reduce the replication factor, delete data of which retention period has elapsed, or create additional partitions.

FIG.4is a flowchart illustrating a method of partitioning a keyspace according to an embodiment.

Hereinafter, a method of partitioning a keyspace according to an embodiment will be described with reference toFIGS.1to4. However, for the sake of brevity of the disclosure, overlapping descriptions withFIGS.1to3will be omitted.

Referring toFIGS.1to4, a method S400of partitioning a keyspace according to an embodiment may start by transmitting a keyspace creation request from the administrator terminal110to the server120(S401).

The keyspace creation request may include a partition setting item. As described above, the partition setting item may further include at least one of the size of the partition for storing data and the storage period of data in addition to the existing replication factor.

Thereafter, the server120may transmit the partition setting item included in the keyspace creation request to the database130(S402).

Accordingly, the database130may create a partition for the keyspace according to the received partition setting item (S404) and transmit the result to the server120(S405).

Depending on an embodiment, when the keyspace creation request transmitted from the administrator terminal110includes administrator information, the administrator information may also be further included in partition setting items. In this case, it is as described above that the authentication unit132may authenticate the authority of the administrator terminal110based on the administrator information (S403).

Thereafter, the server120may request registration of the cloud service according to the event to the cloud service providing device140to be described later (S406). Accordingly, the cloud service providing device140may store the registration-requested cloud service (S407).

The above-described event may include the first event, the second event, and the third event.

In detail, the first event may be a case in which the frequency of access to data is lower than a preset frequency of access. The second event may be when the storage period of data has elapsed. Also, the third event may be a case in which data usage compared to the size of the partition is equal to or greater than a predetermined ratio.

In addition, the cloud service according to an event may include the following contents.

In detail, when the event is the first event, the cloud service may be a service providing a command to decrease the replication factor to the database130.

In addition, when the event is the second event, the cloud service may be a service providing a command to delete data for which the retention period has elapsed to the database130.

In addition, when the event is the third event, the cloud service may be a service providing a command to additionally create a partition to store data to the database130as described above.

Thereafter, the server120may monitor the access frequency of data stored in the partition and the size of data stored in the partition (S408). According to an embodiment, the monitoring unit122may monitor using JMX, and JMX may be an open API of Java as described above.

Then, the server120may transmit an event alarm including at least one of the first event, the second event, and the third event to the cloud service providing device140based on the monitoring result (S409).

Accordingly, the cloud service providing device140may provide the cloud service according to at least one of the first event, the second event, and the third event to the database130in an event-triggered manner according to the event notification (S410).

Then, the database130may manage the partition according to the cloud service according to the event provided from the cloud service providing device140(S411).

In detail, when the cloud service is a cloud service according to the first event, a preset replication factor may be reduced.

Alternatively, when the cloud service is a cloud service according to the second event, data for which the retention period has elapsed may be deleted.

Alternatively, when the cloud service is a cloud service according to the third event, it is as described above that a partition may be additionally created to store data.

As described above, according to an embodiment, a partition may be created and managed by adding at least one of the size of a partition for storing data and the storage period of data in addition to the existing replication factor as a partition setting item for a keyspace. Therefore, storage capacity may be managed more efficiently than in the case of managing partitions by setting a replication factor of a fixed value in the related art.

In addition, according to an embodiment of the disclosure, a cloud service for processing events according to data access frequency, data storage period, and partition usage may be registered in the cloud service providing device, and the corresponding cloud service may be provided in an event-triggered manner, thereby resolving the problem of the recommended storage capacity of the node by allowing the database to reduce the replication factor, delete data whose retention period has elapsed, or create additional partitions.

On the other hand,FIG.5is a block diagram of a computer device that may fully or partially implement a system for partitioning a keyspace according to an embodiment, and may be applied to the respective devices110,120,130, and140illustrated inFIG.5.

As illustrated inFIG.5, a computer device500may include an input interface501, an output interface502, a processor504, a memory505and a communication interface506, and the input interface501, the output interface502, the processor504, the memory505and the communication interface506may be interconnected through a system bus503.

In an embodiment, the memory505is used to store programs, instructions or code, and the processor504may execute a program, instructions or code stored in the memory505, control the input interface501to receive a signal, and control the output interface502to transmit a signal. The aforementioned memory505may include read-only memory and random access memory, and may provide instructions and data to the processor504.

In an embodiment, it should be understood that the processor504may be a central processing unit (CPU), and may be other general-purpose processors, digital signal processors (DSPs), application specific integrated circuits (ASICs), field programmable gate arrays (FPGAs) or other programmable logic devices, discrete gates or transistor logic device, individual hardware component, or the like. A general purpose processor may be a microprocessor, or the processor may be any related art processor or the like.

In one implementation process, the method performed in the system100ofFIG.1may be obtained by an integrated logic circuit of hardware in the processor504or instructions in the form of software. The content of the method disclosed in relation to the embodiment may be completed by being performed by a hardware processor, or may be implemented to be performed and completed by a combination of hardware and software modules of a processor. The software module may be disposed in a storage medium such as random access memory, flash memory, read-only memory, programmable read-only memory or electrically erasable programmable memory, registers, or the like. The storage medium is located in the memory505, and the processor504reads the information of the memory505and implements the contents of the above method in combination with hardware. To avoid duplication, detailed descriptions are omitted herein.

In addition, in describing the disclosure, ‘-unit’ may be implemented in various manners, for example, by a processor, program instructions executed by the processor, software modules, microcodes, computer program products, logic circuits, application-specific integrated circuits, firmware, and the like.

As set forth above, according to an embodiment, as a partition setting item for a keyspace, in addition to the existing replication factor, at least one of the size of the partition for storing data and the storage period of data may be added to create and manage the partition, thereby efficiently managing storage capacity, as compared to the case of managing partitions by setting a replication factor of a fixed value in the related art.

In addition, according to an embodiment, a cloud service for processing events according to data access frequency, data storage period, and partition usage may be registered in the cloud service providing device, and the corresponding cloud service may be provided in an event-triggered manner. Therefore, the problem of the recommended storage capacity of a node may be resolved by allowing the database to reduce the replication factor, delete data of which retention period has elapsed, or create additional partitions.