Background technology
Along with the popularity that telecom operators' business is carried out, various new business emerge in an endless stream, and the miscellaneous service ticket emerges in an endless stream; Along with the decline of telecom charges, the growth of customers, user's call volume is cumulative year after year also, and user's the detailed odd-numbered day order of magnitude often breaks through hundred million.
To the heavy problem that the operator must solve that become of picking of mass data.At present, each big operator mostly adopts database mode, internal memory mode and file system mode, and these methods advance to be more or less in defectiveness aspect performance and the IO in mass data processing.
Database mode: the concrete grammar that utilizes database unique index technology to pick weight is, in the Call Detail Record table, field is set up unique index, when Call Detail Record carried out in-stockroom operation, unique index mechanism was checked the ticket writing that each bar inserts, thereby is guaranteed heavy Dan Buhui warehouse-in.Ticket writing in table more after a little while, the warehouse-in efficiency of this method is all right.But, record number (after several days) more for a long time in table as the cycle of entering an item of expenditure in the accounts at each, storage will seriously descend so that this method has lost Practical significance.The storage of data and retrieve the serious performance that depends on data.I/O to back-end data has relatively high expectations, and often adopts the lifting of branch storehouse, subregion, data compression, increase hardware configuration to improve the handling capacity of data.Its cost of investment is big, and system's later maintenance requires high, causes the high of maintenance cost.
Traditional file systems mode: in the ticket preprocessing process, set up heavy single comparison document of checking every day.To every standard ticket through generating after the pre-service, unpack field (character string), open corresponding heavy single file of checking according to condition, utilize HASH algorithm and adaptation function to search fast heavy single the inspection in the file, if the match is successful, it is heavy single that this ticket belongs to, and then carries out heavy accordingly single the processing.If coupling is unsuccessful, this work is single not to be heavy single, and above-mentioned three character rates are added corresponding heavy single the inspection in the file in this ticket, are used for heavy single inspection the to follow-up ticket.For the time of the matched and searched that reduces the HASH algorithm, heavyly singly check that file also should be the smaller the better.It is relevant with the size of performance and file that this method will be searched in full text spare, and the little performance of ticket amount is possibility also, and having measured big may be influential.
Pure internal memory mode: will weigh and single check that file is placed in the internal memory and move, this method function that dependency database did not provide, processing speed is fast, but heavy single inspection quantity of documents is more, except will taking a part of hard-disc storage resource, also need system that bigger memory source is arranged, at the processing mass tickets host memory is had relatively and be strict with.
Summary of the invention
Technical matters to be solved by this invention provides a kind of removing call ticket repeat method, to reduce the EMS memory occupation that ticket picks heavy process, improves ticket and picks heavy processing power, makes ticket pick that performance has nothing to do with data volume in the heavy processing procedure.
The technical scheme that the present invention solves the problems of the technologies described above is as follows: a kind of removing call ticket repeat method comprises the steps:
Step 1: read current ticket information, and obtain the type of service of current ticket;
Step 2: according to the type of service of obtaining, picking of selected current ticket weighs service groups;
Step 3:, navigate to and current ticket time corresponding section described picking in the heavy service groups according to the air time of current ticket;
Step 4:, in the time period that step 3 navigates to, continue to navigate to and current ticket time corresponding subregion according to the air time of current ticket;
Step 5:, and compare with current ticket with the existing ticket write memory in the time subregion that navigates in the step 4; If existing ticket is identical with current ticket, then the current ticket list of attaching most importance to writes current ticket in the weight monofile; If existing ticket is different with current ticket, then current ticket and described existing ticket are merged, generate new existing ticket.
The invention has the beneficial effects as follows: according to ticket information, to change individual palpation puts into different categories according to picking heavy service groups, time period and time subregion, the retry of picking of ticket is carried out in classification (time subregion) lining in minimum, method of the present invention will be not all the whole write memories of information of existing ticket, only will get final product with the ticket information write memory in the corresponding time subregion of current ticket, the EMS memory occupation space of picking heavy process is little, it is fast to pick heavy speed, save system resource, and make ticket pick that performance has nothing to do with data volume in the heavy processing procedure.
On the basis of technique scheme, the present invention can also do following improvement.
Further, described type of service comprises voice ticket and note ticket, and described to pick heavy service groups be voice bill services group or note bill services group.
Adopt the beneficial effect of above-mentioned further scheme to be, ticket is carried out the branch door according to voice ticket and note ticket sort out, avoided a certain class ticket in other class bill services groups, to pick heavily, removed unnecessary time waste from, saved and picked the heavy time.
Further, the described time period is hour being unit.
Further, described time subregion is unit with the second.
Adopt the beneficial effect of above-mentioned further scheme to be, can navigate to relevant time period and time subregion fast the ticket information of every day.
Further, the existing ticket in the described time period is carried out index, generate index file; Described time subregion is the index block in described index file; In step 3 and the step 4, pairing time period of current ticket and time subregion are positioned by described index file; In the described step 5, when current ticket and described existing ticket are merged, in described index block, note the index information of current ticket.
Adopt the beneficial effect of above-mentioned further scheme to be, utilize index file to improve and search and pick heavy speed.
Further,, then newly open an index block, and in full index block header, preserve the address of newly opening index block if record is full in the described index block.
Adopt the beneficial effect of above-mentioned further scheme to be, guaranteed the sustainable use of index file.
Embodiment
Below in conjunction with accompanying drawing principle of the present invention and feature are described, institute gives an actual example and only is used to explain the present invention, is not to be used to limit scope of the present invention.
As shown in Figure 1, removing call ticket repeat method of the present invention comprises the steps:
Step 1: read current ticket information, and obtain the type of service of current ticket;
Step 2: according to the type of service of obtaining, picking of selected current ticket weighs service groups;
Step 3:, navigate to and current ticket time corresponding section described picking in the heavy service groups according to the air time of current ticket;
Step 4:, in the time period that step 3 navigates to, continue to navigate to and current ticket time corresponding subregion according to the air time of current ticket;
Step 5:, and compare in current ticket with the existing ticket write memory in the time subregion that navigates in the step 4; If existing ticket is identical with current ticket, then the current ticket list of attaching most importance to writes current ticket in the weight monofile; If existing ticket is different with current ticket, then current ticket and described existing ticket are merged, generate new existing ticket.
Wherein, type of service has comprised voice ticket and note ticket etc., picks heavy service groups accordingly and has comprised voice bill services group and note bill services group etc.; According to the ticket amount that generated every day, the time period can be provided with hour to be unit, and it is unit that time subregion wherein can be set to the second.
Heavy for inquiring about and picking, ticket is carried out index, utilize index file can improve inquiry greatly and pick to weigh efficient.Therefore, adopt the index means, the existing ticket in the time period is carried out index, generate index file; Described time subregion is the index block in described index file; In step 3 and the step 4, pairing time period of current ticket and time subregion are positioned by described index file; In the step 5, when current ticket and described existing ticket are merged, in described index block, note the index information of current ticket.When setting up that index file is inquired about and when picking retry, the size of index file can constantly increase along with the increase of data amount information, full in the at this moment unavoidable index block because of record, cause new record to write, and new record should be recorded in the record in this piece index block exactly, therefore if record is full in the index block, then newly open an index block (as newly opening index block at last) at this index file, and the address that index block is newly opened in preservation in full index block header, make new record can load in the newly-increased index block, thereby guaranteed the sustainable use of index file, when treating that new ticket picks retry, just can inquire about the ticket writing in the index block of newly opening by in full index block header, preserving the address of newly opening index block.
Below, in conjunction with specifically practice, removing call ticket repeat method of the present invention is further set forth.
A kind of the picking that Fig. 2 is among the present invention and is provided weighs index organization's structural drawing.According to the configuration information program initialization, form by the empty file that disposes the index information storage that generates, index file is pressed the time subregion by traffic packets, index by time segmentation, index.Disposable minimizing is the shared time of application in operational process for required picking weighs the good disk space of the pre-first to file of index, for later ticket picks the preliminary work of having reformed, accelerates to pick heavy speed.
Be meant dissimilar tickets to be gone into by traffic packets herein and pick heavily together, also can separately pick heavily combination arbitrarily.For example: the ticket of all voice can be divided into a group promptly the shared class index file of all voice tickets pick heavily, the note ticket is divided into one group of all note ticket separately picks heavily by a class index file.If think that this kind classification is cumbersome, voice and note ticket can certainly be placed on and pick in the same class index file heavily.
Above-mentioned being meant by the time segmentation is subdivided into a plurality of index files with the of a sort index file in top branch intact group back by the requirement of disposing appointment.For example: the index file of all voice can being divided by the hour, was example with one day like this: the index file of one day voice can be divided into 24 little index files, and the index of a hour ticket of each little index file storage appointment.
Above-mentionedly be meant in segmentation by the hour by the time subregion, promptly be divided into little index file after, index file inside can also be divided into different subregions by configuration.For example: the index file of one day recited above voice is divided into 24 hours index file, promptly per hour generate a little index file, at this moment each little index file inside again by second subregion promptly a little index file be divided into 3600 that specify size, take an index block each second.
Pick when weighing, a ticket has come, and obtains type of service from this ticket, so just can determine that grouping navigates to group.Get the ticket air time then, at this moment hour can navigate to time slice, can find the index file of appointment according to the date.Get branch and the second of ticket air time this moment.At this moment which second that to obtain this ticket be this hour, thus navigate to which the piece index that starts anew in the index file.If the ticket of this second is too many in one hour, originally the index block of this of appointment second uses up, then can newly open an index block at last by indexed file, and the address that index block is newly opened in preservation in this index block header, can be from this piece index block directly by jumping to the index block of newly opening, as shown in Figure 3.
To sum up, traffic packets, index file and index block correspondence be to pick heavy three step location, index-group (traffic packets) navigates to the index file catalogue, and index file navigates to the index file of appointment, and index block navigates to which concrete in this index file piece index block.
Initialized process is:
(1) reads service configuration information file and allocation list, be loaded in the internal memory, organize index information;
(2) press the ticket critical field and generate index-group, index file and index block, promptly index file is by traffic packets respectively, and index file is by the time segmentation, and index file is by the time subregion.
After the initialization, just can pick heavily ticket: from the inlet file, get a ticket writing information and according to predefined heavy index field and the condition of picking of system, search index-group, locate index file simultaneously, and search detailed single index information in the indexed file piece fast, if it is heavy single finding explanation, this ticket is got in the heavy monofile, if do not find this ticket of explanation is not heavy single, ticket is outputed to outlet, and to note simultaneously the index information of this ticket in index block be that to pick recast next time be foundation, if detailed single index is not enough at the index block of presorting, the fast automatic expanded function of system employs, a newly-built subindex piece, relation is the levels set membership between two index blocks.
Detailed process is:
(1) reads service configuration information file and allocation list, be loaded in the internal memory, organize index information;
(2) read file, get a ticket writing, take out the index key section;
(3), find index-group earlier according to the index condition;
(4) navigate to index file after finding index-group;
(5) according to navigating to index block as phone number or time in the field, use quick adaptation function to search algorithm at index and obtain index information;
(6) if it is heavy single obtaining the index information explanation, outputs to heavy monofile, and forward (2) to, otherwise forward (7) to;
(7) if do not obtain index information, then in index block, note the index information of current ticket, bring up again for foundation for picking next time;
(8) if pre-assigned index block expired, the last newly-built index block of indexed file then, new ticket index information is placed in the new index block, and the address with new index block is recorded in the header of original index block simultaneously, and both are set memberships of levels.
Maintenance for index file: a certain section interior index information storing data files of time of timing analysis, obtain index information in each time period distribution, take up room and the index file extension frequency, and, adjust the index configurations scheme, the elevator system treatment effeciency according to analysis result.
Method provided by the invention adopts index file to press time or user partition by traffic packets, index file by time segmentation, index file, it is little to have committed memory, it is little that the IO operation is picked master control program at tradition, and high capacity, high performance processing power have realized that handling property and data volume are irrelevant.Specifically, a ticket picks heavily, directly navigates to file by condition; Opening file, by picking the index block that heavy condition directly navigates to appointment, relocate index record, calculate visit, all is disposable location, has only when pre-assigned index block has been expired, and just can locate the expansion index block once more.To travel through and do a large amount of IO operation hereof far better than original.
Certainly, according to actual conditions, index file can adjust accordingly, such as:
With the bill services group that indexes, do filename and index block location condition by the time.Divide an index-group with speech business, divide an index-group data service.Then by the time, configuration every day 0~6 are an index file (ticket in this section period is few), later 7~24 each hours an index file.Each index file divides a plurality of index blocks again, at this moment that index file of 0~6 is configured to take in per 6 seconds an index block, and we are configured to take each second an index block 7~24 index file.Like this, searching when picking heavy index, just can navigate to second, only quick adaptation function is searched the ticket index in that second.If the ticket in this second is too much, pre-assigned index block is full, then starts automatic expansion mechanism, and an index block is newly opened in the indexed file bottom, simultaneously new index block address is recorded in the former index block header, uses when navigating to new index block during for later index search.
The above only is preferred embodiment of the present invention, and is in order to restriction the present invention, within the spirit and principles in the present invention not all, any modification of being done, is equal to replacement, improvement etc., all should be included within protection scope of the present invention.