Background technology
M2M is Machine-to-Machine/Man (machine be'ss to machine or people) a abbreviation, be a kind of with the machine terminal intelligent interaction be core, the networking application and service.It is by embedding wireless communication module at machine intimate, be the access means with radio communication etc., for the client provides comprehensive informatization resolve scheme, to satisfy the information system requirement of client to aspects such as monitoring, command scheduling, data acquisition and measurements.
WMMP (Wireless M2M Protocol, wireless M2M agreement) agreement is the application layer protocol of realizing in the M2M business between the M2M terminal and M2M platform, data communication process between the M2M terminal, between M2M platform and the application platform designs that is of China Mobile design.
At present along with the continuous popularization and application of M2M, the expansion that scale is not stopped, more abundant to the demand of business, and the upgrade software that carries out that terminal just need not stopped is satisfied and do not stop the business demand that changes and expand.Just handling property, the network service efficiency to the M2M platform proposed very high requirement when big capacity is downloaded.In view of present hardware handles ability has been enough to deal with under the situation that multithreading handles, a bottleneck that when restriction of bandwidth and database read have been write as big capacity and downloaded business has been impacted.And the network traffics variation in the interactive features of the terminal staging of the M2M decision network is the initiation download request decision by terminal, so just need to solve in the distributed arrangement, the bandwidth that has between section processes machine and the interface message processor (IMP) exhausts soon, and part then is in the situation of idle condition.
The download flow process of WMMP agreement is:
(1) the M2M platform is created the notice task of downloading, and sends the download request message to terminal;
(2) the M2M terminal according to s own situation, can be initiated download request at any time after successfully receiving, and asks data download, is returned the data of request by platform;
(3) terminal needs data downloaded to the M2M platform request next one once more after the data download that the request of receiving is responded, and finishes receiving until whole upgrade files.
Downloading process is supported the breakpoint transmission function that the WMMP agreement is formulated, and promptly the M2M terminal can temporarily stop to download, and handles the higher task of other priority earlier, when treating the free time from the breakpoint succession file in download of last downloaded.The concrete download flow process of WMMP is seen Fig. 1, and wherein, terminal can be from M2M platform file in download (i.e. upgrading), also can be from the upgrade server file in download.In this article, only consider the situation of terminal from M2M platform file in download.
Characteristics of the download function of WMMP agreement are that terminal can be asked file in download any time, the arbitrary portion of content is downloaded in request simultaneously arbitrarily, just terminal can be downloaded after receiving platform download notice immediately, perhaps waits several days and downloads.To file, can read from the centre when downloading, also can read from beginning, platform reads corresponding data after giving authentication to the message of each download request, sends to terminal.
Industry realizes that the common practices that WMMP downloads has following two kinds at present:
(1) gets the surplus different processor processing that sends to according to the sequence number tail number of terminal;
(2) the current download number of connection according to processor carries out load balancing, will ask to send to successively processor and handle.
For above-mentioned two kinds of processing modes, first kind, just get the surplus processor that sends to according to tail number, the terminal number that exists many processors to handle can be unbalanced in a lot of moment, is not that each terminal all can be carried out down operation, like this may be on the many processors of download terminal load, business is very busy, and download few processor, and then relatively more idle, the waste of resource appears.Second kind, the download characteristics of WMMP have determined, download message content by the terminal active request, though processor of possibility has the connection of 100 downloads, but this moment terminal downloads half, the request of just no longer including is downloaded, and waits self operation to go then manage business.And another processor has 10 to download connection, and 10 connections are all being downloaded.Cause new download request still can be dealt into 10 like this and download the processor that connects, cause the unbalanced of traffic load.
Summary of the invention
The technical problem to be solved in the present invention is exactly the load sharing implementation method that proposes a kind of M2M platform and the download of big capacity, and WMMP downloads the problem that may cause traffic load imbalance in the solution prior art.
In order to solve the problems of the technologies described above, the invention provides the load sharing implementation method of a kind of machine to machine or the big capacity download of people M2M platform, comprising:
Terminal is known the download notice of M2M platform, sends the download request message to the M2M platform;
When the interface message processor (IMP) of M2M platform received described download request message, described interface message processor (IMP) sent to the minimum processor of load according to the current data download amount of each processor of M2M platform and the weight of carrying data with described download request message.
Further, above-mentioned load sharing implementation method also can have following characteristics:
Described interface message processor (IMP) calculates the product of weight of the current data download amount of each processor and carrying data, with the processor of product value minimum as the minimum processor of load.
Further, above-mentioned load sharing implementation method also can have following characteristics:
During described M2M platform initialization, the current data download amount of processor is 0, and interface message processor (IMP) starts timer, and per second calculates the data download amount of each processor:
Per second Ti=Ti-Fi; If Ti-Fi<0, then Ti=0; Wherein Ti is the data download amount of i processor, and 1≤i≤n, n are the number of processor, and Fi is the Configuration Values of the per second flow control of i processor;
In the time of up download request message, if interface message processor (IMP) sends to processor Si with described download request message, Ti=Ti+L is set then, wherein L is the length of described download request message;
In the time of descending download content message, if sending to interface message processor (IMP), processor Si downloads the content message, and then interface message processor (IMP) is provided with Ti=Ti+L ', and wherein L ' is the length of described download content message.
Further, above-mentioned load sharing implementation method also can have following characteristics:
In the time of up download request message, if calculating, described interface message processor (IMP) knows that the minimum processor of load is Si, but judges Ti>Bi that then interface message processor (IMP) abandons described download request message, no longer sends to processor Si; Described Bi is the maximum capacity of processor Si.
Further, above-mentioned load sharing implementation method also can have following characteristics:
After described processor receives the download request message that interface message processor (IMP) sends, with the TRANSID in the described download request message and terminal serial number as keyword, search the memory buffer pond of this processor,, then directly send and download the content message to described terminal if find; If do not find, Query Database then, the wrong described terminal of giving is then returned in the Query Database failure; If the Query Database success then writes authentication information in the memory buffer pond of each processor; When terminal downloads is finished, then upgrade database positioning, and remove authentication information in the memory buffer pond of each processor.
In order to solve the problems of the technologies described above, the present invention also provides a kind of M2M platform, comprises interface message processor (IMP), at least two processors, database,
When described interface message processor (IMP) was used to receive the download request message of terminal transmission, the data download amount and the weight of carrying data current according to each processor sent to the minimum processor of load with described download request message.
Further, above-mentioned M2M platform also can have following characteristics:
Described interface message processor (IMP) is further used for calculating the product of the current data download amount of each processor and the weight of carrying data, with the processor of product value minimum as the minimum processor of load.
Further, above-mentioned M2M platform also can have following characteristics:
After described processor is used to receive the download request message that interface message processor (IMP) sends, with the TRANSID in the described download request message and terminal serial number as keyword, search the memory buffer pond of this processor,, then directly send and download the content message to described terminal through interface message processor (IMP) if find; If do not find, then described processor is further used for Query Database, and the Query Database failure is then returned the wrong described terminal of giving through interface message processor (IMP); If the Query Database success, then notification database writes authentication information in the memory buffer pond of each processor; When terminal downloads was finished, then notification database was upgraded database positioning, and removed authentication information in the memory buffer pond of each processor.
The present invention proposes to utilize according to weight and shares download and download buffer technology, the load balancing of control M2M platform when big capacity is downloaded, thereby guarantee professional stable operation, improve the M2M platform and operate in actual capacity and the competitiveness that does not promote under the hardware condition situation, good marketing prospect is arranged.
Embodiment
In the present invention, data download amount and the weight of carrying data that interface message processor (IMP) is current according to processor are selected the minimum processor data download of load.Like this can be so that the M2M platform offer more multiple terminals download service, improving the M2M platform still has higher efficient when the big capacity of reply is downloaded.
The present invention is described in detail below in conjunction with drawings and the specific embodiments.
As shown in Figure 2, be the networking schematic diagram of M2M platform, described M2M platform comprises: interface message processor (IMP), at least two processors (among the figure be example so that 3 processors to be arranged), database;
Wherein, interface message processor (IMP) is born all terminal access functions, and processor links to each other respectively with described interface message processor (IMP), database, is responsible for professional relevant treatment.
As shown in Figure 3, the method for the embodiment of the invention comprises the steps:
Step 301, M2M platform are created the notice task of downloading, and send the download request message to terminal; Terminal is known the download notice of M2M platform, responds the download request message to the M2M platform;
In this step, the processor of M2M platform obtains mission bit stream from database, and the download request message that carries described mission bit stream is sent to terminal through interface message processor (IMP);
Wherein, described mission bit stream comprises information such as download version, filename, file size, also comprises TRANSID (TRANSID is used to identify a download link in the WMMP agreement);
The keeper can initiate to download the notice task at some terminal;
In database, preserve the authentication information of terminal, that is: TRANSID and download version content and terminal serial number relation;
In each processor, all preserving needs downloaded files;
Carry TRANSID and terminal serial number in the download request message that terminal is responded;
Step 302, when the interface message processor (IMP) of M2M platform receives the download request message of described terminal response, data download amount and the weight of carrying data that described interface message processor (IMP) is current according to each processor of M2M platform, the download request message that described terminal is responded sends to the minimum processor of load;
In this step, interface message processor (IMP) calculates the product of weight of the current data download amount of each processor and carrying data, with the processor of product value minimum as the minimum processor of load;
Specifically, at processor S1, S2...Sn, n are the number of processor; Correspondingly, configure weights is Q1, Q2, and Q3....Qn, getting its least common multiple is CM, drawing the weight of calculating actual carrying data is R1=CM/Q1, R2=CM/Q2, R3=CM/Q3....Rn=CM/Qn.
If the current data download amount of processor is respectively T1, T2....Tn, then select MIN (T1*R1, T2*R2 ... .Tn*Rn) Dui Ying processor is the minimum processor of load.
The current data download amount of described processor is current this processor data total amount to be sent He to be received, and unit is byte (byte), and its concrete statistical is:
Current data download amount was 0 when the M2M platform started (initialization), that is: Ti=0, (1≤i≤n);
Interface message processor (IMP) starts the timer per second and calculates:
Per second Ti=Ti-Fi; If Ti-Fi<0, then Ti=0; Wherein Fi is the Configuration Values of the per second flow control of i processor, and this value can dispose according to actual conditions, can think the flow value that disposes, i.e. the ability of processor i per second transmission data;
In the time of up download request message: interface message processor (IMP) sends to processor Si with described download request message, and Ti=Ti+L is set, and wherein L is the length of described download request message;
When descending download content message was promptly responded the download content to terminal: processor sent to interface message processor (IMP) and downloads the content message, and interface message processor (IMP) is provided with Ti=Ti+L ', and wherein L ' is the length of described download content message.
If the link between interface message processor (IMP) and the processor is an off state at this moment, then no longer calculate the load of this processor; If (1≤i≤n) equate then selects the forward processor of sequence number to the product value Ti*Ri of two or more processor correspondences that calculating obtains, and sends the download request message to it;
In addition, when receiving up download request message,, abandon this download request message, no longer send to corresponding processor if interface message processor (IMP) is judged Ti>Bi; Described Bi is the maximum capacity of i processor, and unit is byte, and this value need be configured according to different Network Transmission types and transmission quality bandwidth for the treatable maximum data total amount of processor.
It should be noted that dropping packets is to abandon up download request message, does not do discard processing to the message of descending response terminal.
Step 303, described processor are carried out authentication to described terminal after receiving the download request message that interface message processor (IMP) sends, if authentication is passed through, then send by interface message processor (IMP) and download the content message to described terminal.
Step 303 specifically comprises: after processor receives the download request message that interface message processor (IMP) sends, according to the TRANSID in the message and terminal serial number as keyword (KEY), search the memory buffer pond of this processor,, then directly send and download the content message if find; If do not find (such as request time first, just necessarily can not find, necessarily can not find after perhaps platform is restarted yet), Query Database then, the wrong terminal of giving is then returned in the Query Database failure; If Query Database success, then with authentication information, as the contents such as size that are used for the placement path of TRANSID, terminal serial number, file in download of authentication and file write the memory buffer pond of each processor, make to reduce the reading database number of times when handling the next download request message of this terminal; When terminal downloads is finished, then upgrade database positioning, and remove authentication informations such as TRANSID in the memory buffer pond of each processor and terminal serial number.
Described memory buffer pond is to set up HASH (Hash) index with TRANSID and terminal serial number as keyword, the authentication information of the terminal when preserving the WMMP download.
In principle, the assignable memory headroom (being the memory buffer pond) that is used for subscription authentication is the information that the user is used for authentication of preserving when enough being used to download, but exist terminal not have to download the extreme case of finishing and having the great amount of terminals request to download for a long time, can cause Out of Memory to use, that adopt under this situation is FIFO (First in, first out, first in first out) mode, promptly when in when being filled with, the TRANISID+ terminal serial number place internal memory record purge of putting into is at first fallen then that this is new content write memory.
When the downloading task of database to after date, can remove the memory information that is used for authentication in the processor.
In the said method,, carry out one and illustrate for step 302:
At first: suppose to have 3 processor S1, S2, S3, its configure weights 1: 2: 3.Then the weight of the carrying data of their reality is 3: 2: 1 after converting with least common multiple, flow T1=T2=T3=0.
The download request message length that step 1, interface message processor (IMP) are received is assumed to be 100byte, S1*T1=0 as calculated, and S2*T2=0, S3*T3=0 is so message sends to S1; This moment T1=100;
The download message length that step 2, interface message processor (IMP) are received is assumed to be 100byte, S1*T1=300 as calculated, and S2*T2=0, S3*T3=0 is so message sends to S2; This moment T2=100;
The download message length that step 3, interface message processor (IMP) are received is assumed to be 100byte, S1*T1=300 as calculated, and S2*T2=200, S3*T3=0 is so message sends to S3; This moment T3=100;
The download message length that step 4, interface message processor (IMP) are received is assumed to be 100byte, S1*T1=300 as calculated, and S2*T2=200, S3*T3=100 is so message sends to S3; This moment T3=200;
The download message length that step 5, interface message processor (IMP) are received is assumed to be 100byte, S1*T1=300 as calculated, and S2*T2=200, S3*T3=200 is so message sends to S2; This moment T2=200;
The download message length that step 6, interface message processor (IMP) are received is assumed to be 100byte, S1*T1=300 as calculated, and S2*T2=400, S3*T3=200 is so message sends to S3; This moment T3=300;
The download message length that step 7, interface message processor (IMP) are received is assumed to be 100byte, S1*T1=300 as calculated, and S2*T2=400, S3*T3=300 is so next message sends to S1; This moment T1=200.
It should be noted that, how above-mentioned steps 1~step 7 calculates if just illustrating, think process that step 1~step 7 finishes less than 1 second, thus Ti=Ti-Fi do not calculated, and also hypothesis does not all send the situation of descending download content message when pretreating machine.
The M2M platform of the embodiment of the invention, as shown in Figure 2, comprise interface message processor (IMP), at least two processors, database, when described interface message processor (IMP) is used to receive the download request message of terminal transmission, the data download amount and the weight of carrying data current according to each processor send to the minimum processor of load with described download request message.
Described interface message processor (IMP) is further used for calculating the product of the current data download amount of each processor and the weight of carrying data, with the processor of product value minimum as the minimum processor of load.
Processor links to each other with database with described interface message processor (IMP) respectively, after being used to receive the download request message that interface message processor (IMP) sends, with the TRANSID in the described download request message and terminal serial number as keyword, search the memory buffer pond of this processor, if find, then directly send and download the content message to described terminal through interface message processor (IMP); If do not find, Query Database then, the Query Database failure is then returned the wrong described terminal of giving through interface message processor (IMP); If the Query Database success, then notification database writes authentication information in the memory buffer pond of each processor; When terminal downloads was finished, then notification database was upgraded database positioning, and removed authentication information in the memory buffer pond of each processor.
In sum, the present invention is directed to the weight according to real network situation configuration carrying data, the restriction downloading flow reduces database IO operation by buffer technology simultaneously, has improved systematic function, the maximum using Internet resources.Guaranteed simultaneously under the bigger situation of downloading service amount, not the potential impact that can cause regular traffic.
Certainly; the present invention also can have other various embodiments; under the situation that does not deviate from spirit of the present invention and essence thereof; those of ordinary skill in the art work as can make various corresponding changes and distortion according to the present invention, but these corresponding changes and distortion all should belong to the protection range of the appended claim of the present invention.