CN102081651A - Table division method for online game database - Google Patents

Table division method for online game database Download PDF

Info

Publication number
CN102081651A
CN102081651A CN 201010622615 CN201010622615A CN102081651A CN 102081651 A CN102081651 A CN 102081651A CN 201010622615 CN201010622615 CN 201010622615 CN 201010622615 A CN201010622615 A CN 201010622615A CN 102081651 A CN102081651 A CN 102081651A
Authority
CN
China
Prior art keywords
data
submeter
dummy node
random number
imaginary circles
Prior art date
Legal status (The legal status 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 status listed.)
Granted
Application number
CN 201010622615
Other languages
Chinese (zh)
Other versions
CN102081651B (en
Inventor
杨纮宇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Pixel Software Technology Co Ltd
Original Assignee
Beijing Pixel Software Technology Co Ltd
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 Beijing Pixel Software Technology Co Ltd filed Critical Beijing Pixel Software Technology Co Ltd
Priority to CN 201010622615 priority Critical patent/CN102081651B/en
Publication of CN102081651A publication Critical patent/CN102081651A/en
Application granted granted Critical
Publication of CN102081651B publication Critical patent/CN102081651B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The invention relates to a table division method for an online game database, and the method comprises the following steps: setting the online game database into a virtual circle with a limited value range, wherein the virtual circle comprises at least one table, and virtual nodes in each table are uniformly distributed on the virtual circle; and calculating random numbers of data which is ready to be subjected to table division, and inserting the data which is ready to be subjected to the table division into the virtual nodes according to the random numbers within the value range. After the embodiment of the invention is applied, the amount of the data which needs to be rebuilt can be reduced under the situation that the number of the tables changes.

Description

The method of a kind of data of network game storehouse submeter
Technical field
The present invention relates to networking technology area, more specifically, relate to the method for a kind of data of network game storehouse submeter.
Background technology
After online game was reached the standard grade, the data that network game system produces were more and more.In order to guarantee read and write data efficiently data in the storehouse of network game system, need be to the data submeter of being stored in the database.Use hash algorithm that mass data is evenly distributed in a plurality of tables, thereby the control list is shown data volume effectively, improves read-write efficiency.
For example: suppose that table adds up to N, input value is that the data of K should be kept in the table that sequence number is Hash (K) mod N so.K obtains showing under the K to the N delivery, in showing under K is kept at.According to above-mentioned hash algorithm, the data that can effectively network game system be produced are evenly distributed in a plurality of tables.
In addition, can the data in the increase-decrease plan be evenly distributed in each table according to loading condition increase-decrease plan quantity dynamically, Database Systems just have the smooth expansion ability so again.Database loads is separated with programmed logic, for the developer provides extendible efficiently database schema.
For example: show total N and change, recomputate table under the data in the table that changes by Hash (K) mod N so.Be stored in the data of X number table promptly, be saved in table after recomputating Y number.
Illustrate below and recomputate the affiliated table of data.
Suppose to have 3 data sample X, Y, Z,
Hash(X)=1,
Hash(Y)=2,
Hash(Z)=3。
0,1,2 three tables are arranged, and then free list quantity is 3, obtains according to delivery rule Hash (K) mod N:
Hash(X)mod?3=1?mod?3=1;
Hash(Y)mod?3=2?mod?3=2;
Hash(Z)mod?3=3?mod?3=0。
Be that data X is placed on table No. 1, data Y is placed on table No. 2, and data Z is placed on table No. 0.
Because No. 0 table lost efficacy, free list quantity becomes 2, obtains according to delivery rule Hash (K) mod N once more:
Hash(X)mod?2=1?mod?2=1;
Hash(Y)mod?2=2?mod?2=0;
Hash(Z)mod?3=3?mod?2=1。
Be that data X is placed on table No. 1, data Y is placed on table No. 0, and data Z is placed on table No. 1.
Therefore the position of data Y and data Z change after table quantity N sends variation as can be seen must import data Y again and data Z just can set up correct positional information.
As seen, because changing, table quantity causes the variation of data submeter.Can estimate again the data volume of submeter.
Tentation data total amount DN, current table total amount TN, the optimum value of the data volume RN that need rebuild is as follows:
In the table number change is under 1 the situation,
RN=DN*2/TN。
In the table number change is N, and N is greater than under 1 the situation,
RN=DN*(1+N)/TN。
Can be drawn by the aforementioned calculation formula, the table number change is under 1 the situation,
When TN is 3, with the total data of rebuilding 2/3; When TN is 4, with the total data of rebuilding 2/4.
Though the data volume of rebuilding is along with the increase of table quantity reduces gradually, it is not too large to show total amount in actual applications, so the data volume that said method need be rebuild is very big.
Summary of the invention
The embodiment of the invention proposes the method for a kind of data of network game storehouse submeter, under the situation of table number change, reduces the data volume that needs reconstruction.
The technical scheme of the embodiment of the invention is as follows:
The method of a kind of data of network game storehouse submeter, this method comprises:
With the data of network game lab setting is the imaginary circles that is limited by span, comprises at least one table on described imaginary circles, and wherein the dummy node in each table evenly distributes on described imaginary circles;
The random number of submeter data is treated in calculating, according to described random number the described submeter data for the treatment of is inserted in the dummy node in described span.
On imaginary circles, increase or reduce table, describedly described treating after inserting in the dummy node, the submeter data further comprised according to described random number, recomputate the random number of each data in the described imaginary circles, each data is inserted in the dummy node that changes the back table according to the random number that calculates once more.
Described according to described random number data insertions in the dummy node in described span comprises, in the described span, searches on described imaginary circles and is not less than the nearest dummy node of described random number, and the described submeter data for the treatment of are inserted in the described dummy node.
Described span is 20 to 232.
The included dummy node number of described each table is identical.
Described each table comprises 100 to 200 dummy nodes.
From technique scheme as can be seen, in embodiments of the present invention, with the data of network game lab setting is the imaginary circles that is limited by span, on described imaginary circles, comprise at least one table, wherein the dummy node in each table evenly distributes on described imaginary circles, determines the distribution of the dummy node of each table.The random number of submeter data is treated in calculating, according to described random number the described submeter data for the treatment of is inserted in the dummy node in described span.According to the random number for the treatment of the submeter data, determine further definite its affiliated table in its position.Because the dummy node in each table all is to be evenly distributed in the imaginary circles, under the situation of table number change, reducing needs the data volume of submeter again through overtesting.
Description of drawings
Fig. 1 is the method flow synoptic diagram of embodiment of the invention data of network game storehouse submeter;
Fig. 2 divides hoist pennants for the embodiment of the invention on imaginary circles;
Fig. 3 inserts on imaginary circles for the embodiment of the invention and treats the submeter schematic diagram data;
Fig. 4 is the embodiment of the invention newly-increased hoist pennants on imaginary circles.
Embodiment
For making the purpose, technical solutions and advantages of the present invention express clearlyer, the present invention is further described in more detail below in conjunction with drawings and the specific embodiments.
In embodiments of the present invention, by being imaginary circles with the data of network game lab setting, comprise at least one table on imaginary circles, the dummy node in each table evenly distributes in this imaginary circles, will treat in the submeter data insertion dummy node according to the random number for the treatment of the submeter data.Because dummy node is even distribution, under the situation of table number change, need again the data of submeter to reduce through overtesting.
Referring to accompanying drawing 1 is the method flow synoptic diagram of data of network game storehouse submeter, specifically may further comprise the steps:
Step 101, in imaginary circles, divide table.
In the data of network game storehouse, it is 20 to 232 imaginary circles that this database is set to span.Comprise at least one table on this imaginary circles, wherein comprise a plurality of dummy nodes in each table, the dummy node number that is comprised in each table is identical.Generally speaking, when overtesting draws each table and comprises 100 to 200 dummy nodes, less in the table quantity calculative data volume that changes.Wherein, each the table in dummy node be to be evenly distributed on the imaginary circles, promptly between each dummy node apart from approximately equal.In imaginary circles, two tables of black and white are arranged referring to accompanying drawing 2, the dummy node in two tables is evenly distributed on this imaginary circles.
The submeter data are treated in step 102, insertion.
Need insert in the network data base corresponding virtual circle in the data that network game system produces, then need to calculate the random number for the treatment of the submeter data.In imaginary circles, search and be not less than the nearest dummy node of this random number, will treat that the submeter data insert this dummy node.Promptly this treats to show under the submeter data table under this dummy node.The random number for the treatment of the submeter data can obtain by modes such as random functions.
Referring to accompanying drawing 3, will treat that the random number X that the submeter data obtain inserts in the imaginary circles, A1 is not less than the nearest dummy node of X, will treat that then submeter data X inserts among the A1.Because A1 belongs to the dummy node of Table A, treats that submeter data X belongs to Table A.
Step 103, all data on the imaginary circles are inserted again change in the table of back.
On imaginary circles, increase or reduce and show, then need to recomputate the random number of each data in the imaginary circles, according to the random number that calculates once more each data insertion is changed in the dummy node of showing the back then.Insertion treats that the submeter data are identical in the process of each data being inserted the dummy node that changes the back table and the step 102.
Referring to accompanying drawing 4 are newly-increased hoist pennants on imaginary circles, have two tables in the former imaginary circles, Table A and table B.In imaginary circles, increase table C newly, need to recomputate the random number of each data in the imaginary circles so, seek according to this random number again and be not less than the nearest dummy node of this random number.Treat the former Table A that belongs to of submeter data, this treats that the submeter data recomputate the random number X that obtains, and is not below or equal to the nearest dummy node C1 of X and belongs to table C, and then this treats that the submeter data belong to table C.
Because dummy node is to be evenly distributed in the imaginary circles, therefore under the situation of table number change, can reduce again the data volume of submeter.
For example: suppose to have in the imaginary circles 10 tables, each table has 200 dummy nodes.
There are 10000 to treat the submeter data, calculate and treat that the data key assignments formula of submeter data correspondence is:
1+rand(n)*pow(2,32),1≤n≤10000。
Wherein rand (n) is a random function, and pow is a power power function.
Under starting condition, treat that submeter DATA DISTRIBUTION situation is as shown in table 1:
Table 1
The table sequence number Data bulk
1 936
2 987
3 908
4 1028
5 1005
6 1015
7 963
8 1004
9 1050
10 1104
Delete table No. 10, the data that belonged to No. 10 tables in the past are re-assigned in other 9 tables according to technical scheme of the present invention, and the data in other table any change do not take place, final data distribution situation such as table 2 simultaneously:
Table 2
The table sequence number Data bulk
1 1080
2 1111
3 1036
4 1096
5 1172
6 1078
7 1130
8 1137
9 1160
According to technical scheme of the present invention, be changed under 9 the situation by 10 in table quantity, the data volume that needs to rebuild equals in the table 1 data volume 1104 in the table No. 10.
As according to the prior art scheme, data reconstruction amount=10000* (1+1)/10=2000 then.
As can be seen, compare with the optimal situation of prior art, the reconstruction number percent of technical solution of the present invention has reduced nearly 50%.
The above is preferred embodiment of the present invention only, is not to be used to limit protection scope of the present invention.Within the spirit and principles in the present invention all, any modification of being done, be equal to replacement, improvement etc., all should be included within protection scope of the present invention.

Claims (6)

1. the method for a data of network game storehouse submeter is characterized in that, this method comprises:
With the data of network game lab setting is the imaginary circles that is limited by span, comprises at least one table on described imaginary circles, and wherein the dummy node in each table evenly distributes on described imaginary circles;
The random number of submeter data is treated in calculating, according to described random number the described submeter data for the treatment of is inserted in the dummy node in described span.
2. according to the method for the described data of network game of claim 1 storehouse submeter, it is characterized in that, on imaginary circles, increase or reduce table, describedly described treating after inserting in the dummy node, the submeter data further comprised according to described random number, recomputate the random number of each data in the described imaginary circles, each data is inserted in the dummy node that changes the back table according to the random number that calculates once more.
3. according to the method for claim 1 or 2 described data of network game storehouse submeters, it is characterized in that, described according to described random number data insertions in the dummy node in described span comprises, in the described span, on described imaginary circles, search and be not less than the nearest dummy node of described random number, the described submeter data for the treatment of are inserted in the described dummy node.
4. according to the method for the described data of network game of claim 1 storehouse submeter, it is characterized in that described span is 2 0To 2 32
5. according to the method for the described data of network game of claim 1 storehouse submeter, it is characterized in that the included dummy node number of described each table is identical.
6. according to the method for the described data of network game of claim 5 storehouse submeter, it is characterized in that described each table comprises 100 to 200 dummy nodes.
CN 201010622615 2010-12-29 2010-12-29 Table division method for online game database Active CN102081651B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201010622615 CN102081651B (en) 2010-12-29 2010-12-29 Table division method for online game database

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 201010622615 CN102081651B (en) 2010-12-29 2010-12-29 Table division method for online game database

Publications (2)

Publication Number Publication Date
CN102081651A true CN102081651A (en) 2011-06-01
CN102081651B CN102081651B (en) 2013-01-30

Family

ID=44087614

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201010622615 Active CN102081651B (en) 2010-12-29 2010-12-29 Table division method for online game database

Country Status (1)

Country Link
CN (1) CN102081651B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104809175A (en) * 2015-04-13 2015-07-29 上海达梦数据库有限公司 Generation method and device of feature library
CN109144991A (en) * 2017-06-15 2019-01-04 北京京东尚科信息技术有限公司 Dynamic divides method, apparatus, electronic equipment and the computer of table can storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060173830A1 (en) * 2003-07-23 2006-08-03 Barry Smyth Information retrieval
CN101086732A (en) * 2006-06-11 2007-12-12 上海全成通信技术有限公司 A high magnitude of data management method
CN101145158A (en) * 2007-06-06 2008-03-19 中兴通讯股份有限公司 Data base table partition method
CN101404013A (en) * 2008-11-13 2009-04-08 山东浪潮齐鲁软件产业股份有限公司 Storage and query method for large data volume table of database

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060173830A1 (en) * 2003-07-23 2006-08-03 Barry Smyth Information retrieval
CN101086732A (en) * 2006-06-11 2007-12-12 上海全成通信技术有限公司 A high magnitude of data management method
CN101145158A (en) * 2007-06-06 2008-03-19 中兴通讯股份有限公司 Data base table partition method
CN101404013A (en) * 2008-11-13 2009-04-08 山东浪潮齐鲁软件产业股份有限公司 Storage and query method for large data volume table of database

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
《计算机系统应用》 20081231 刘玉红等 表分区技术在短信增值业务中的研究与实现 第72-75页 1-6 , 第11期 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104809175A (en) * 2015-04-13 2015-07-29 上海达梦数据库有限公司 Generation method and device of feature library
CN104809175B (en) * 2015-04-13 2018-02-27 上海达梦数据库有限公司 The generation method and device of feature database
CN109144991A (en) * 2017-06-15 2019-01-04 北京京东尚科信息技术有限公司 Dynamic divides method, apparatus, electronic equipment and the computer of table can storage medium

Also Published As

Publication number Publication date
CN102081651B (en) 2013-01-30

Similar Documents

Publication Publication Date Title
Chen et al. Sschain: A full sharding protocol for public blockchain without data migration overhead
KR102417067B1 (en) Method and apparatus for generating blocks in node on a block-chain network
CN111061769B (en) Consensus method of block chain system and related equipment
Zhao et al. Quantitative comparison of randomization designs in sequential clinical trials based on treatment balance and allocation randomness
CN103518364B (en) The data-updating method of distributed memory system and server
CN112074818A (en) Method and node for enabling access to past transactions in a blockchain network
CN105824720B (en) What a kind of data-oriented was continuously read delete again entangles the data placement method for deleting hybrid system
CN109299190B (en) Method and device for processing metadata of object in distributed storage system
CN107450855B (en) Model-variable data distribution method and system for distributed storage
CN103617508A (en) Configurable business rule plug-in extension apparatus and business rule plug-in extension method
CN106603729A (en) Distributed-file-system multi-client synchronization method and system thereof
CN102081651B (en) Table division method for online game database
CN103617226A (en) Regular expression matching method and device
CN110968647A (en) Data storage method and device, computer equipment and storage medium
FI3769232T3 (en) Method and system for performing inner-joins on a sharded data set
CN114936087B (en) Method, device, system and related equipment for embedded vector prefetching
Yang et al. Selectivity-based spreading dynamics on complex networks
CN107180048B (en) Method and device for identifying idempotent states in database
CN107562762A (en) Data directory construction method and device
Rana et al. Free2shard: Adversary-resistant distributed resource allocation for blockchains
CN107092700A (en) It is a kind of based on the method and device for importing data under big data quantity in batches
CN103036796A (en) Method and device for updating routing information
KR102377535B1 (en) Anonymization of big data personal information and method of combining anonymized data
CN114175011A (en) Block chain system with efficient world state data structure
CN106469042A (en) The generation method of pseudo random number and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant