The content of the invention
In consideration of it, it is an object of the invention to provide a kind of synchronous method and system of trigger data, it is to avoid terminal shouldWith the peak time netted during synchrodata in terminal, the pressure of terminal network is alleviated, terminal applies data are improved sameThe reliability of step.
According to foregoing invention purpose, the present invention provides a kind of trigger data synchronous method, and methods described includes;
S1, obtains network traffics of the terminal in each preset time period;
S2, according to the network traffics and a preset algorithm in each preset time period, obtains the net of each preset time periodThe score value of network situation;
S3, it is the triggered time to select the network condition score value maximum corresponding period, within the triggered timeCarry out terminal data synchronous.
Preferably, step S1 is specifically included:
S100, will be divided into each preset time period the time cycle;
S110, obtains network traffics when network traffics and the termination when current slot starts;
The network traffics when network traffics during beginning and termination are carried out difference operation by S120, when obtaining describedBetween section network traffics.
Preferably, step S2 is specifically included:
S200, sets the network traffics upper limit valve value and network traffics lower limit valve value of terminal;
S210, when the network traffics in the current slot are more than network traffics lower limit valve value and less than network trafficsDuring upper limit valve value, computing is carried out to the score value of the network condition of the current slot;
S220, otherwise, obtains the network traffics of subsequent time period, and the score value of the network condition to the subsequent time periodCarry out computing.
Preferably, the step S210 is specifically included:
The initial value for setting the network condition of each preset time period is 0;
According to following formula, computing is carried out to the score value of the network condition of the current slot and obtained;
W (i)=(W (i*)+1)/2
W (i) is the network condition score value of present period, and W (i*) is a upper web-based history for the corresponding present periodCondition score.
Preferably, step S3 is specifically included:
S300, sets a timer;
S310, according to the score value of the network condition of each preset time period, when selecting the score value maximum correspondingBetween section be timer triggered time;
S320, when the timers trigger, data syn-chronization is carried out to the terminal.
Preferably, step S3 also includes:
After the terminal data synchronously success, computing is carried out to the score value of the present period network condition, and storeFor the corresponding web-based history condition score of the present period.
Preferably, step S3 also includes:
After the terminal data synchronization failure, the score value corresponding time taken second place compared with network condition score value maximum is selectedSection is the triggered time, terminal data is carried out within the triggered time synchronous.
According to foregoing invention purpose, the present invention also provides a kind of trigger data synchronous system, and the system includes flowMonitoring module, computing module, data simultaneous module, wherein,
The traffic monitoring module, for obtaining network traffics of the terminal in each preset time period;
The computing module, for according to the network traffics and a preset algorithm in each preset time period, obtaining eachThe score value of the network condition of preset time period;
The data simultaneous module, during for setting the network condition score value maximum corresponding period for triggeringBetween, terminal data is carried out within the triggered time synchronous.
Preferably, the computing module includes setting unit, judging unit and arithmetic element, wherein,
The setting unit, network traffics upper limit valve value and network traffics lower limit valve value for setting terminal;
The judging unit, for when the network traffics in the current slot be more than network traffics lower limit valve value andDuring less than network traffics upper limit valve value, computing is carried out to the score value of the network condition of the current slot;
The arithmetic element, for according to following formula, being transported to the score value of the network condition of the current slotCalculate and obtain;
W (i)=(W (i*)+1)/2
W (i) is the network condition score value of present period, and W (i*) is a upper web-based history for the corresponding present periodCondition score.
Preferably, the data simultaneous module includes selecting unit, timing unit and synchronization unit, wherein,
The selecting unit, for the score value of the network condition according to each preset time period, selects the score value mostIt is worth the triggered time that the corresponding period is timer greatly;
The timing unit, timer is triggered for setting a timer, and according to the triggered time;
The synchronization unit, for when the timers trigger, data syn-chronization to be carried out to the terminal.
Compared with prior art, a kind of synchronous method and system of trigger data of the invention, have the advantages that:EventuallyWhen holding application data simultaneously operating, according to the Internet Use before terminal system user, one network condition of pre-selection is goodPeriod carry out data syn-chronization operation so that the peak period netted in terminal when avoiding synchronous data operation, subtractsPressure that light terminal is netted, it is to avoid when causing data syn-chronization because of network busy the problem of packet loss, improve terminal applies numberAccording to synchronous reliability, the experience of user is improved;The successful probability of terminal applies data syn-chronization is improved simultaneously, number is reducedAccording to the number of times of synchronization failure.
Embodiment
As being referred in background technology, the trigger timing for how solving terminal applies data syn-chronization in the prior art comparesUnified, the problem of causing terminal network burden, influence Consumer's Experience, is question of common concern.
Therefore, the present invention is by obtaining network traffics of the terminal in each preset time period, then according to each preset timeNetwork traffics and a preset algorithm in section, obtain the score value of the network condition of each preset time period, set network condition score valueThe maximum corresponding period is the triggered time, terminal data synchronization is carried out within the triggered time, so as to avoid same step numberThe peak period netted during according to operation in terminal, improve the reliability of terminal applies data syn-chronization.
Below by way of specific instantiation and embodiments of the present invention are described with reference to the drawings, those skilled in the art canUnderstand the further advantage and effect of the present invention easily by content disclosed in the present specification.The present invention can also pass through other differencesInstantiation implemented or applied, the various details in this specification also can based on different viewpoints with application, without departing substantially fromVarious modifications and change are carried out under the spirit of the present invention.
Fig. 1 is a kind of flow chart of the method for trigger data synchronization of one embodiment of the invention.As shown in figure 1,;
S1, obtains network traffics of the terminal in each preset time period;
S2, according to the network traffics and a preset algorithm in each preset time period, obtains the net of each preset time periodThe score value of network situation;
S3, it is the triggered time to select the network condition score value maximum corresponding period, within the triggered timeCarry out terminal data synchronous.
The method of the present invention can be applied to the scene that terminal applies carry out data syn-chronization, when simultaneously multiple applications of terminal are enteredRow network request, causes substantial amounts of network request in the same time, and terminal network request must be caused busy, data syn-chronization mistakeLose.Then the present invention obtains each preset time period by obtaining network traffics of the terminal in each preset time period by computingNetwork condition score value, selection network condition score value maximum corresponding period is the triggered time, within the triggered timeCarry out terminal data synchronous.According to the Internet Use of terminal system, one network condition of selection good period entersRow data simultaneously operating, so that the peak period netted when avoiding synchronous data operation in terminal, alleviates terminal netPressure, it is to avoid when causing data syn-chronization because of network busy the problem of packet loss, improve the reliable of terminal applies data syn-chronizationProperty.
In the above-described embodiments, step S1 is specifically included:
S100, will be divided into each preset time period the time cycle;
S110, obtains network traffics when network traffics and the termination when current slot starts;
The network traffics when network traffics during beginning and termination are carried out difference operation by S120, when obtaining describedBetween section network traffics.
Each preset time period will be divided into the time cycle, the granularity of the preset time period size can be set, week timeThe length of phase can be arranged as required to 24 hours systems or 12 hours make.For example, system was made using 24 hours, the preset timeDuan great little granularity is set to 1 hour, therefore is divided into 24 periods, such as 00 by 24 hours:00-01:00 corresponds toOne period, 01:00-02:00 corresponds to second period, the like 23:00-00:00 is the 24th period.It is rightShould embodiment, 24 periods were divided into by 24 hours, to the network flow of terminal in each period in this 24 periodsAmount is counted.To the network flux statistical method of terminal in day part, by inquiring about terminal system, obtain current slot and openNetwork traffics when network traffics when starting and termination are carried out difference by the network traffics when network traffics during beginning and terminationComputing, the difference is exactly the network traffics in current slot.For example, according to above-described embodiment, such as, obtaining 00:00-01:The network traffics of 00 this first period, record 00:The network traffics at 00 moment are Fs, record 01:The network at 00 momentFlow is Fe, then the network traffics in this first time period are Fe-Fs.By that analogy, can obtain systemic presupposition each whenBetween network traffics in section.
In the above-described embodiments, step S2 is specifically included:
S200, sets the network traffics upper limit valve value and network traffics lower limit valve value of terminal;
S210, when the network traffics in the current slot are more than network traffics lower limit valve value and less than network trafficsDuring upper limit valve value, computing is carried out to the score value of the network condition of the current slot;
S220, otherwise, obtains the network traffics of subsequent time period, and the score value of the network condition to the subsequent time periodCarry out computing.
The network traffics upper limit valve value and network traffics lower limit valve value of terminal are set in systems, and system is according to acquisitionThe network traffics for presetting each preset time period, and score value computing is carried out to the network condition of each period.When some is pre-If the network traffics in the period are more than the upper limit valve value, it is believed that terminal is in the situation of network busy, system is not rightThe score value of the network condition of current slot carries out computing, reacquires the network traffics of subsequent time period, and to described nextThe score value of the network condition of period carries out computing;Or when the network traffics in some preset time period are less than lower limit valveValue, it is believed that terminal is in the situation without network, system does not carry out computing to the score value of the network condition of current slot,The network traffics of subsequent time period are reacquired, and computing is carried out to the score value of the network condition of the subsequent time period.Work as instituteState network traffics in current slot and be more than network traffics lower limit valve value and during less than network traffics upper limit valve value, can be withThink that the network state of current slot is good, computing is carried out to the score value of the network condition of the current slot.
It is preferred that in above-described embodiment, the step S210 is specifically included:
The initial value for setting the network condition of each preset time period is 0;
According to following formula, computing is carried out to the score value of the network condition of the current slot and obtained;
W (i)=(W (i*)+1)/2
W (i) is the network condition score value of present period, and W (i*) is a upper web-based history for the corresponding present periodCondition score.
After judging the network state of current slot to be good, the network condition to the period carries out score value meterCalculate.The initial value for setting the network condition of the period is 0, according to following formula, to the network-like of the current slotThe score value of condition carries out computing and obtained;
W (i)=(W (i*)+1)/2
W (i) is the network condition score value of present period, and W (i*) is a upper web-based history for the corresponding present periodCondition score.
The specific embodiment of the present invention, for example, system was made using 24 hours, the granularity of the preset time period size is setFor 1 hour, therefore 24 periods, such as 00 were divided into by 24 hours:00-01:00 corresponds to first period, 01:00-02:00 corresponds to second period, the like 23:00-00:00 is the 24th period.The network traffics of terminal are setUpper limit valve value is Fu and network traffics lower limit valve value is Fd, and the initial network flow for recording some period section is Fs, is terminatedThe network traffics during period are Fe, and the network traffics in the period are Fe-Fs.The network of each preset time period is setThe initial value W of situation is 0, such as, for the embodiment of 24 periods, W (1)=W (2)=...=W (24)=0.WhenFd<(Fe-Fs)<During Fu, according to following formula, the network condition score value W (i) of present period is calculated,
W (i)=(W (i*)+1)/2
W (i-1) is the upper web-based history condition score of the corresponding present period;
Such as, to 01:00-02:The score value W (2) of the network condition of 00 this second period is calculated, according to formulaW (2)=(W (2*)+1)/2, W (2*) is the history score value of the period corresponding last network condition in system, Jin ErjiCalculate the score value of W (2).The span of the score value of the network condition of each period is 0-1, according to the big of the fractional valueIt is small, it can be determined that to should the period network condition, the more big corresponding network condition of fractional value is better.
On the basis of above-described embodiment, step S3 is specifically included:
S300, sets a timer;
S310, according to the score value of the network condition of each preset time period, when selecting the score value maximum correspondingBetween section be timer triggered time;
S320, when the timers trigger, data syn-chronization is carried out to the terminal.
One timer is set in systems, when the timer is used to be triggered, data syn-chronization is carried out to terminal.Specifically,According to computing is carried out to the score value of the network condition of each preset time period in above-described embodiment, the network condition of each period is obtainedScore value, and select the score value maximum corresponding period be timer triggered time.When terminal is in the triggered time,Timer is triggered, and system carries out data syn-chronization to terminal.
On the basis of above-described embodiment, after the terminal data synchronously success, to the present period network conditionScore value carries out computing, and is stored as the corresponding web-based history condition score of the present period.For example, to present period networkThe score value of situation carries out the computing of average value, and the numerical value after computing is stored as the corresponding history net of the present periodNetwork condition score.According to the technical scheme, after data syn-chronization success, the score value of the network condition of the period is carried out at reductionReason, is conducive to balancing network idle period, in order to avoid cause network blockage.After the terminal data synchronization failure, according to it is each whenBetween section network condition score value, select the score value of network condition taken second place compared to score value maximum, the corresponding period isIn the triggered time, terminal data is carried out within the triggered time synchronous.
In the technical scheme, the network traffics in each preset time period are obtained by system in terminal, according to the networkFlow judges the network state of the period, if the network state in the period is good, when obtaining each default by computingBetween section network condition score value, selection network condition score value maximum corresponding period is the triggered time, and the period isThe network condition best period, then terminal data is synchronous within the period.According to the Internet Use of terminal system, selectionOne network condition good period carries out data syn-chronization operation, so as to be used when avoiding synchronous data operation in terminalPeak period of net, alleviate the pressure of terminal net, it is to avoid when causing data syn-chronization because of network busy the problem of packet loss, carryThe high reliability of terminal applies data syn-chronizations, improves Consumer's Experience.
Fig. 2 is a kind of structure chart of trigger data synchronization system of one embodiment of the invention.As shown in Fig. 2 the systemSystem includes traffic monitoring module 20, transportation module 21, data simultaneous module 22, wherein,
The traffic monitoring module 20, for obtaining network traffics of the terminal in each preset time period;
The computing module 21, for according to the network traffics and a preset algorithm in each preset time period, obtainingThe score value of the network condition of each preset time period;
The data simultaneous module 22, during for setting the network condition score value maximum corresponding period for triggeringBetween, terminal data is carried out within the triggered time synchronous.
In traffic monitoring module 20, system will be divided into each preset time period the time cycle, and the preset time period is bigSmall granularity can be set, and the length of time cycle can be arranged as required to 24 hours systems or 12 hours make.For example, systemMade using 24 hours, the granularity of the preset time period size is set to 1 hour, therefore is divided into 24 periods by 24 hours,Such as 00:00-01:00 corresponds to first period, 01:00-02:00 corresponds to second period, the like 23:00-00:00 is the 24th period.To should embodiment, 24 periods were divided into by 24 hours, in this 24 periodsThe network traffics of terminal are counted in each period.To the network flux statistical method of terminal in day part, pass through inquiryTerminal system, obtains network traffics when network traffics and the termination when current slot starts, by network traffics when startingDifference operation is carried out with network traffics when terminating, the difference is exactly the network traffics in current slot.By that analogy, can be withObtain the network traffics in each period of systemic presupposition.
Specifically, the computing module 21 includes setting unit 210, judging unit 211 and arithmetic element 212, wherein,
The setting unit 210, network traffics upper limit valve value and network traffics lower limit valve value for setting terminal;
The judging unit 211, for being more than network traffics lower limit valve when the network traffics in the current slotWhen being worth and being less than network traffics upper limit valve value, computing is carried out to the score value of the network condition of the current slot;
The arithmetic element 212, for according to following formula, being carried out to the score value of the network condition of the current slotComputing is simultaneously obtained;
W (i)=(W (i*)+1)/2
W (i) is the network condition score value of present period, and W (i*) is a upper web-based history for the corresponding present periodCondition score.
System sets the network traffics upper limit valve value and network traffics lower limit valve value of terminal in setting unit 210.In judging unit 211, when the network traffics in some preset time period are more than the upper limit valve value, it is believed that terminal is inThe situation of network busy, or when the network traffics in some preset time period are less than lower limit valve value, it is believed that endIn the situation without network, in both cases, system does not carry out computing, weight to the score value of the network condition of current slotThe new network traffics for obtaining subsequent time period, and computing is carried out to the score value of the network condition of the subsequent time period.When describedWhen network traffics in current slot are more than network traffics lower limit valve value and are less than network traffics upper limit valve value, it can recognizeIt is good for the network state of current slot, computing is carried out to the score value of the network condition of the current slot.Judging to work asAfter the network state of preceding period is good, then in arithmetic element 212, the network-like of each preset time period is setThe initial value of condition is 0, then according to following formula, carries out computing to the score value of the network condition of the current slot and obtainsTake;
W (i)=(W (i*)+1)/2
W (i) is the network condition score value of present period, and W (i*) is a upper web-based history for the corresponding present periodCondition score.The span of the score value of the network condition of each period is 0-1, according to the size of the fractional value, can be withJudge to should the period network condition, the more big corresponding network condition of fractional value is better.
Specifically, the data simultaneous module 22 includes selecting unit 220, timing unit 221 and synchronization unit 222, itsIn,
The selecting unit 220, for the score value of the network condition according to each preset time period, selects the score valueThe maximum corresponding period is the triggered time of timer;
The timing unit 221, timer is triggered for setting a timer, and according to the triggered time;
The synchronization unit 222, for when the timers trigger, data syn-chronization to be carried out to the terminal.
When system is the triggering of timer by the selection of the selecting unit 220 network condition score value maximum corresponding periodBetween.The timer set by timing unit 221, when the timer is used to be triggered, data syn-chronization is carried out to terminal.SameWalk in unit 222, when terminal is in the triggered time, timer is triggered, and system enters line number within the period to terminalAccording to synchronization.After terminal data synchronously success, computing is carried out to the score value of present period network condition, and be stored as present periodCorresponding web-based history condition score.After terminal data synchronization failure, according to the score value of the network condition of each period, choosingThe score value for the network condition taken second place compared to score value maximum is selected, the corresponding period is the triggered time, within the triggered timeCarry out terminal data synchronous.
In summary, the synchronous method and system of a kind of trigger data of the invention, according to the net before terminal system userNetwork behaviour in service, one network condition of selection good period carries out data syn-chronization operation, so as to avoid synchrodataThe peak period netted during operation in terminal, the pressure that terminal is netted is alleviated, improve terminal applies data syn-chronization canBy property, the experience of user is improved.
Any those skilled in the art can repair under the spirit and scope without prejudice to the present invention to above-described embodimentDecorations are with changing.Therefore, the scope of the present invention, should be as listed by claims.