Specific embodiment
In order that those skilled in the art more fully understand the technical scheme in the application, below in conjunction with the embodiment of the present application
Accompanying drawing, the technical scheme in the embodiment of the present application is clearly and completely described, it is clear that described embodiment is only
It is some embodiments of the present application, rather than the embodiment of whole.Based on the embodiment in the application, ordinary skill people
The every other embodiment that member is obtained under the premise of creative work is not made, should all belong to the scope of the application protection.
Describe implementing for the embodiment of the present application in detail with several specific examples below.
Hereinafter a kind of embodiment of the method for load balancing of the application is introduced first.Fig. 1 is illustrated according to some embodiments of the application
The schematic flow sheet of the load-balancing method of offer, this application provides the method operating procedure as described in embodiment or flow chart,
But either can include more or less operating procedures without performing creative labour based on conventional.The step of enumerating in embodiment is suitable
Sequence is only a kind of mode in numerous step execution sequences, does not represent unique execution sequence.Device in practice or client
When end product is performed, can be according to embodiment either method order shown in the drawings execution or executed in parallel (such as parallel processing
The environment of device or multiple threads).Specifically as shown in figure 1, methods described can include:
S110:Pending business datum is obtained, is that the pending business datum arranges storage mark.
In certain embodiments, pending business datum can be obtained, is that the pending business datum arranges storage mark.Tool
Body, the pending business datum can include needing to carry out the data into library storage in business procession.Specifically, institute
State the mapping relations that storage mark can be represented between the pending business datum and the pending business datum storage location.
Being identified according to the storage of pending business datum in the present embodiment can perform the behaviour for being stored the pending business datum
Make.
In a specific embodiment, by taking Twitter message notice system as an example, it is assumed that certain microblog account user delivered one it is micro-
It is rich.Accordingly, the microblogging needs broadcast to notify to the vermicelli of the microblog account user;Assume the microblog account user's
Vermicelli number is 1000, then 1000 vermicellis are accomplished by generating 1000 Notification Records, and 1000 Notification Records can be with
As needing to carry out the data into library storage in business procession.Then storage mark can be set for the microblogging
store_ddl_flag。
S120:Load balancing rule according to arranging determines the assignment of the storage mark.
In certain embodiments, after step S110 obtains pending business datum, can be according to the load balancing rule for arranging
Then determine the assignment of the storage mark.The assignment of the storage mark can include being set according to the load balancing rule of the setting
The assignment of the loading mark of the described pending business datum put.
Specifically, in certain embodiments, the load balancing rule can include being referred to according to the data payload situation of data base
The business datum that positioning is put is migrated to presetting database.Accordingly, it is described that the storage is determined according to the load balancing for arranging rule
The assignment of mark can include:Migrated based on the pending business datum to the storage address of presetting database and the storage is set
The assignment of mark.
Specifically, in certain embodiments, the load balancing rule can include being arranged according to the data payload situation of data base
The data storage storehouse of the business datum of corresponding service type.Accordingly, it is described to deposit according to the load balancing for arranging rule determines
The assignment of storage mark can include:Obtain the type of service of the pending business datum, according to the pending business datum
The address in type of service corresponding data storage storehouse the assignment of the storage mark is set.The pre-set business type can be wrapped
Include a type of service and/or multiple types of service.The loading condition of the data base can include the business number stored in data base
According to data amount information, can also include the data base in store the affiliated type of service of business datum auto-correlation data volume category
Property.The auto-correlation data volume attribute of the type of service can include the data amount information of the business datum of the type of service.
In one specific embodiment, by taking Twitter message notice system as an example, the auto-correlation data volume attribute of the type of service can be wrapped
Include the data amount information of the user-dependent business datum of a certain microblog account.Here different microblog account users correspond to different
The data volume of the related business datum such as type of service, Notification Record of each microblog account user correspond to microblog account user
Auto-correlation data volume attribute.
It is that the pending business datum is provided with after corresponding storage mark in the present embodiment, can be according to the load for arranging
Balanced rule determines the assignment of the storage mark.
S130:Assignment based on the storage mark to corresponding storage location, the pending business datum storage is formed
Processing business data.
In certain embodiments, after step S120, the assignment for storing mark can be based on by the pending business
The corresponding storage location of data Cun Chudao, forms processed business datum.
Fig. 2 is a kind of another schematic flow sheet of load-balancing method that the application is provided.In certain embodiments, in step
After S130, as shown in Fig. 2 methods described can also include:
S140:Loading mark is set for the processed business datum, the loading mark is arranged for locating based on described
Assignment in the loading mark of reason business datum loads the processed business datum.
In certain embodiments, the processed business datum can carry out after storing loading processing.Accordingly, Ke Yiwei
The processed business datum arranges loading mark, and the loading mark is arranged for based on the processed business datum
Assignment in loading mark loads the processed business datum.Specifically, the loading mark can be load_ddl_flag.
The loading mark of the processed business datum can be corresponding with the storage of pending business datum mark, represents institute
State the mapping relations between processed business datum and the processed business datum storage location.According to processed in the present embodiment
The loading mark of business datum can perform the operation for being loaded the processed business datum.In certain embodiments, institute
The assignment for stating the loading mark of pending business datum can be consistent with the assignment of the storage mark of the processed business datum.This
Outward, in certain embodiments, the assignment of the loading mark of the pending business datum can be with the processed business datum
The assignment of storage mark is inconsistent, but the load balancing rule corresponding to the assignment of the processed business datum loading mark and institute
Load balancing rule corresponding to the assignment of the storage mark for stating pending business datum is consistent.
Specifically, the assignment of the loading mark can include:Locate according to the load balancing rule setting of the setting
The assignment of the loading mark of reason business datum.Specifically, for example in one embodiment, if the load balancing rule includes:
When according to the data payload situation of data base the business datum of specified location is migrated to presetting database, accordingly, the basis
The assignment of the loading mark of the described processed business datum of the load balancing rule setting of the setting can include:Based on described
Processed business datum migrate to the presetting database storage address arrange the loading mark assignment.As above institute
State, if the load balancing rule includes:The business datum of corresponding service type is set according to the data payload situation of data base
During data storage storehouse, accordingly, the described processed business datum of the load balancing rule setting according to the setting plus
Carrying the assignment of mark includes:Stored according to the processed business datum to the address in the data storage storehouse and the loading mark is set
The assignment of knowledge.
Additionally, having with the business datum load balancing rule of B type services in the system of Twitter message notice described in step S120
In case of change.When load balancing rule changes, the tax of the storage mark of the business datum of the B type services
The assignment of value and loading mark is adjusted correspondingly.During this load balancing rule transformation, may be because of depositing
There is regular hour time delay between storage and loading, or there is the reasons such as data storage complete system-down afterwards maintenance, cause in B classes
The new business data of type business are stored to after associated databases according to the assignment of new storage mark, and business datum originally is (originally
Notification Record) do not loaded.So data load process can include assignment based on original loading mark from corresponding
Data base load original business datum;After original business datum has been loaded, the loading mark after adjustment can be switched
Assignment, new business datum is loaded from corresponding data base based on the assignment of the loading mark after adjustment.Additionally, the data
Loading procedure can also include traveling through the assignment of the loading mark before and after the adjustment of B type services, and be based respectively on adding before and after adjustment
The assignment for carrying mark loads business datum from corresponding data base.
In certain embodiments, after step s 140, methods described can also include:Advise in the load balancing of the setting
When then changing, the storage mark is changed accordingly and/or the assignment of mark is loaded, so that operation system is based on the storage
Mark and/or load the storage that business datum is carried out under load balancing rule of the amended assignment of mark after the change and/or
Loading.
The operation system can include carrying out system server of Business Processing etc. using the load-balancing method.Actually should
With in, with the development of business, the loading condition of data base may change, and at this moment the load balancing rule can basis
Specific loading condition is adjusted correspondingly.Accordingly, after load balancing rule has carried out corresponding adjustment, so that it may weight
Newly carry out load balance process.When load balancing is re-started, can be according to the load balancing rules modification corresponding service number
According to storage mark assignment.
In a specific embodiment, by taking Twitter message notice system as an example, it is assumed that A, B, C tri- in certain a period of time
Microblog account user represents respectively three kinds of different types of business datums, and party A-subscriber has 1000 vermicellis, and party B-subscriber has 500
Individual vermicelli, C user has 2000 vermicellis.Assume party A-subscriber's corresponding A type service, party B-subscriber's correspondence B type services, C
User's correspondence C type services, and the storage mark of the business datum of type-A business and B type services both types of service
Assignment it is the same.It is possible to assume that the business datum of type-A business and the business datum of B type services are stored in data
In storehouse in X, the business datum of C type services is stored in data base Y.Accordingly, when tri- users of A, B, C deliver
Microblogging, business datum that party A-subscriber has 1000 vermicellis, type-A business can include 1000 Notification Records;Party B-subscriber
The business datum for having 500 vermicellis, B type services can include 500 Notification Records;C user has 2000 vermicellis, C
The business datum of type service can include 2000 Notification Records.Accordingly, 1500 can be stored in data base X and notifies note
Record, can store 2000 Notification Records in data base Y.Assume with development, party A-subscriber develops into big V user, party A-subscriber
Vermicelli number be changed into 3000.When new service request (issuing microblog) is carried out, storage is may need in data base X
3500 Notification Records, may need to store 2000 Notification Records in data base Y, and this results in data base X and data base
Data distribution between Y is uneven.At this time load balancing rule can be changed according to database loads situation, make data base relative
Balance.The storage location of the business datum of B type services is such as revised as the position of data base Y, accordingly, can be adjusted
The assignment of the storage mark of the business datum of B type services.When follow-up B type services have new business datum, the new industry
Business data are possibly stored in data base Y.So after tri- users of A, B, C have delivered microblogging, can in data base X
To store 3000 Notification Records, 2500 Notification Records can be stored in data base Y, the load of data base is realized again
It is balanced.
As can be seen here, the technical scheme that a kind of embodiment of load-balancing method of the application is provided is by the pending business to obtain
Data arrange storage mark, and the assignment of the load balancing rule determination storage mark in conjunction with actual loading situation;
The pending business datum storage to corresponding storage location, is formed processed business number by the assignment based on the storage mark
According to.Accordingly, subsequently loading mark can be set for the pending business datum, according to described actual loading situation is combined
Load balancing rule determine it is described loading mark assignment.So can be according to actual loading situation equilibrium assignment data, it is ensured that
Database loads are balanced.Compared with prior art, the single caused data distribution of factor data putaway rule is effectively improved uneven,
The inconsistent problem of data base's pressure, realizes equilibrium assignment data, has reached database loads purpose in a balanced way.
Based on load-balancing method described herein, the application provides a kind of load balancing apparatus.The application introduced below is a kind of
The embodiment of load balancing apparatus, Fig. 3 is a kind of a kind of schematic diagram of the device of load balancing of the application, with reference to accompanying drawing 3, should
Device 300 can include:
Data acquisition module 310, can be used for obtaining pending business datum.
First setup module 320, may be used for the pending business datum and arranges storage mark.
Assignment module 330, can be used for determining the assignment of the storage mark according to the load balancing rule for arranging.
Balance processing module 340, can be used for the assignment based on the storage mark by the pending business datum storage to phase
The storage location answered, forms processed business datum.
In a preferred embodiment, Fig. 4 is a kind of another kind of schematic diagram of the device of load balancing of the application, with reference to accompanying drawing
4, the device 300 can also include:
Second setup module 350, may be used for the pending business datum and arranges loading mark, and the loading mark is set
It is set to and loads the processed business datum for the assignment in the loading mark based on the processed business datum.
Accordingly, the assignment module is additionally operable to determine the processed business datum according to the load balancing rule of the setting
The assignment of loading mark.
In a preferred embodiment, the load balancing rule can include:
The business datum of specified location is migrated to presetting database according to the data payload situation of data base;
Accordingly, the assignment module 330 determines that the assignment of the storage mark can include according to the load balancing rule for arranging:
The assignment module 330 is migrated to the storage address of presetting database based on the pending business datum and arranges the storage mark
Assignment, and,
The assignment module 330 determines the assignment of the loading mark of the processed business datum according to the load balancing rule for arranging
Can include:The assignment module 330 is migrating the storage address to the presetting database based on the processed business datum
The assignment of the loading mark is set.
In a preferred embodiment, the load balancing rule can include:
The data storage storehouse of the business datum of corresponding service type is set according to the data payload situation of data base;
Accordingly, the assignment module 330 determines that the assignment of the storage mark can include according to the load balancing rule for arranging:
The assignment module 330 obtains the type of service of the pending business datum, according to the business with the pending business datum
The address in the corresponding data storage storehouse of type arranges the assignment of the storage mark, and,
The tuber of assignment mould 330 determines the assignment of the loading mark of the processed business datum according to the load balancing rule for arranging
Can include:The assignment module 330 is stored to the address in the data storage storehouse according to the processed business datum and arranges institute
State the assignment of loading mark.
Fig. 5 is a kind of another kind of schematic diagram of the device of load balancing that the application is provided.In a preferred embodiment, such as
Shown in Fig. 5, described device 300 can also include:
Assignment modified module 360, can be used for when the load balancing rule of the setting is changed, and corresponding modification is described
The assignment of storage mark and/or loading mark, so that operation system is based on the storage mark and/or the amended tax of loading mark
Value carries out the storage and/or loading of business datum under the load balancing rule after the change.
Load-balancing method described in the embodiment of the present application and the load balancing apparatus can apply to the operation system of data processing
In, so described operation system by the modification storage mark and/or load mark assignment just can realize not shutting down, business
The dynamic load leveling of unaware, solves the problems, such as that data distribution is uneven under the table scheme of data base point storehouse point.
As can be seen here, a kind of load-balancing method of the application and device embodiment provide technical scheme by for obtain wait locate
Reason business datum arranges storage mark, and the load balancing rule in conjunction with actual loading situation determines the storage mark
Assignment;Assignment based on the storage mark to corresponding storage location, forms the pending business datum storage processed
Business datum.Accordingly, subsequently loading mark can be set for the pending business datum, according to described actual negative is combined
The load balancing rule of load situation determines the assignment of the loading mark.So can be according to actual loading situation equilibrium assignment number
According to, it is ensured that database loads are balanced.Compared with prior art, the single caused data point of factor data putaway rule are effectively improved
Cloth is uneven, and the inconsistent problem of data base's pressure realizes equilibrium assignment data, reached database loads purpose in a balanced way.
Although the description of data sampling and processing in teachings herein, the application be not limited to must be complete standard or
The situation of the data handling utility environment mentioned by person.Foregoing description involved in each embodiment is only the application in the application
In some embodiments in application, the scheme of each embodiment of above-mentioned the application can also be carried out in some other frameworks.When
So, meet other of the process method step described in the application the various embodiments described above can be with without creative deformations, still
Identical application is realized, be will not be described here.
Although this application provides the method operating procedure as described in embodiment or flow chart, based on conventional or without creative
Means can include more or less operating procedures.The step of enumerating in embodiment order is only numerous step execution sequences
In a kind of mode, do not represent unique execution sequence.When device or client production in practice is performed, can be according to reality
Either method order shown in the drawings performs either executed in parallel (environment of such as parallel processor or multiple threads) to apply example.
Above-described embodiment illustrates device or module, specifically can be realized by computer chip or entity, or by with certain function
Product realizing.For convenience of description, it is divided into various modules with function when describing apparatus above to describe respectively.Certainly, exist
Implement the function of each module can be realized in same or multiple softwares and/or hardware during the application, it is also possible to will realize same
The module of function is realized by the combination of multiple submodule or subelement.
It is also known in the art that in addition to realizing controller in pure computer readable program code mode, completely can be with
By the way that method and step is carried out into programming in logic controller is caused with gate, switch, special IC, FPGA control
The form of device processed and embedded microcontroller etc. is realizing identical function.Therefore this controller is considered a kind of Hardware Subdivision
Part, and the device for realizing various functions included to its inside can also be considered as the structure in hardware component.Or or even,
Can be used to realizing that the device of various functions be considered as not only being the software module of implementation method but also can be in hardware component
Structure.
The application can be described in the general context of computer executable instructions, such as program module.
Usually, program module include performing particular task or realize the routine of particular abstract data type, program, object, component,
Data structure, class etc..The application can also be in a distributed computing environment put into practice, in these distributed computing environment, by
The remote processing devices connected by communication network are performing task.In a distributed computing environment, program module can be with position
In local and remote computer-readable storage medium including including storage device.
As seen through the above description of the embodiments, those skilled in the art can be understood that the application can be by soft
Part adds the mode of required general hardware platform to realize.Based on such understanding, the technical scheme of the application is substantially in other words
The part contributed to prior art can be embodied in the form of software product, and the computer software product can be stored in
In storage medium, such as ROM/RAM, magnetic disc, CD, including some instructions are used so that computer equipment (can be with
Be personal computer, mobile terminal, server, either network equipment etc.) perform each embodiment of the application or embodiment
Method described in some parts.
Each embodiment in this specification is described by the way of progressive, and same or analogous part is mutual between each embodiment
Referring to what each embodiment was stressed is the difference with other embodiment.The application can be used for it is numerous general or
In special computing system environments or configuration.For example:Personal computer, server computer, handheld device portable set
Standby, laptop device, mobile communication terminal, multicomputer system, based on the system of microprocessor, programmable electronic equipment,
Network PC, minicomputer, mainframe computer, including the distributed computing environment etc. of any of the above system or equipment.
Although depicting the application by embodiment, it will be appreciated by the skilled addressee that the application have it is many deformation and change and
Without departing from spirit herein, it is desirable to which appended claim includes these deformations and changes without deviating from spirit herein.