Technical background
Along with the commercialization of Internet, its technology has obtained fast development, and range of application is constantly expanded.Html page cooperates with browser, becomes main, the most common mode that users visit Internet with its friendly interface.This mode is general, general because of its client, has been applied in embedded device for example in the management of switch, router.
The management system of existing embedded device adopts client/server (C/S:Client/Server) framework, the http protocol of support standard, the management of WEB mode is provided, IE browser by standard can conduct interviews and controls equipment, intuitively and easily equipment is managed, also can realize providing the remote upgrade function by the remote transmission that http protocol carries out data.
Different with common Web server, the handling property of the network equipment such as switch and router and the internal memory that is disposed, Flash is lower, need expend considerable time when handling lot of data, cause client the long-time phenomenon that does not have response to occur, very unfriendly to the user.On equipment, use circulation to dispose a plurality of attributes of each port respectively in addition, when mistake occurring, stop the configuration of back, give the user current miscue, can not clearly tell which port arrangement success of user those port arrangement failures; Continue the configuration of back, current mistake is saved in the internal memory, because the more needs of configuration item take a large amount of internal memories, so will influence other performances of equipment.
Therefore, in the web of equipment network management system running, need alleviate the burden of equipment.Method relatively more commonly used at present is a database technology, can support the processing and the complicated query request of big data quantity.The main feature of this technology is as follows:
The output of support section data can Pagination Display to big data quantity.After the http request that browser sends arrived server end, one section content in the specific data was exported in the request that server sends by browser, and the key word of the inquiry of output page up and following one page.Support data filter.Allow the user to import from the querying condition filtering data that customizes.Also can combine, only obtain the data that need with the part export technique.Server end uses database technology to support user's query manipulation, allows the content of output specific data section.
But in the system of some client/server (C/S) framework, as the web network management system of embedded device, there is following shortcoming in the database technology of employing:
Hardware performance is required height, and powerful database support needs high performance hardware configuration and handles complicated request and operation, and embedded device is subjected to the restriction of CPU and internal memory to be difficult for realizing.
Required memory space is big, and the code amount of database is huge, needs bigger memory space.Storage medium on the equipment (Flash) generally is no more than 64M, and few have only several M, can not satisfy the demands.
The requirement data are relatively stable, need the regular hour when handling big data quantity.If use Pagination Display just to need data relatively stable, otherwise the data that page up and following one page occur do not have correlation, just there is not any practical significance for data processing, because the overall data time point meeting difference in the data that read two pages respectively is very big, that is to say that the data in the back page are not the data that the user wanted just probably.This is engraved in equipment the time the related datas such as the route of variation and MAC Address just not too suitable.
In order to improve performance of database, need the support of operating system, such as environmental variance and pipeline etc., described database technology need be utilized the Premium Features of operating system, and this is difficult for realizing in some equipment such as embedded device.
Summary of the invention
In view of this, the technical problem to be solved in the present invention is, a kind of data processing method in client is provided.Under the situation that does not increase any hardware, solve the resource occupation that reduces equipment in the big data quantity processing procedure, and show result in real time.
For addressing the above problem, a kind of data processing method in client provided by the invention comprises:
A. client is collected the data of user's input, and these data are divided into the plurality of data piece;
B. send to server at described client storage divided data piece and with data block;
C. server customer in response end request, and execution result information returned described client;
D. client shows relevant information according to the execution result information of receiving.
Among the step b, during the partition data piece, the size of the data block after the balanced division and expense are so that described divided data piece meets with a response when moving on server in the given time.
Step b comprises:
The divided data piece is saved in the formation, in order the data block in the formation is sent to server by the formation sending module.
Data block of the every transmission of client is carried out subsequent operation again after server returns execution result.
In step c, described execution result information comprises feedback information and descriptor;
When the request of client transmission ran succeeded on server, server end returned the feedback information that runs succeeded;
When failure was carried out in the request of client transmission on server, server end returned the feedback information of carrying out failure and the descriptor that comprises failure cause.
When failure was carried out in the request that sends when client on server, server end was judged when subsequent step can success, is notified issuing of client terminate back by feedback information.
When failure is carried out in the request of client transmission on server, server end returns carries out failure, but need the user to confirm whether stop the feedback information of subsequent data blocks transmission and the descriptor that comprises failure cause, the user is according to described failure cause, and whether decision continues to send follow-up data block.
Described server is the embedded device with Http server capability.
Content displayed comprises that progress bar demonstration, stop button, user confirm dialog box in the described client end interface.
In client's server interaction process, comprise the step of client end response user input.
In existing Web application, same processing cross can in the user can't with server interaction, that is to say that the user can't participate in the process of finishing to server after the user submits to.It is mutual to allow the user to submit to the back to participate in the process of server operation among the present invention, can suspend or stop the processing of back, and in the server implementation if mistake, the user can also determine whether to continue the setting of back.
Utilize data processing method in client provided by the invention.When carrying out the processing of big data quantity with Web mode access means, be the small data piece with big data decomposition, equipment response in time and feedback-related information with embedded Http server are given client.Under the situation that does not increase any hardware, reduce the resource occupation of equipment in the big data quantity processing procedure, and show result in real time.Avoided that thereby the equipment long-time running is same too much when professional to take the operation that cpu resource influences other business, and avoided equipment client not response for a long time when handling big data quantity, shown, seemingly-dead phenomenon occurred without any information.
The present invention is applied on the embedded device that advantage is more obvious, and it is few to have the resource of taking, and function is simple, reliable, flexible characteristic.Simultaneously have the advantages that to allow user interactions in the process of handling in the WEB mode, network management interface is very friendly, the user need not import loaded down with trivial details order and the script batch parameter configuration on just can realization equipment again, and show current progress in the progress bar mode, make the webmaster personnel understand the current configuration progress and the configuration result of each bar order at any time.Thereby can improve webmaster personnel's operating efficiency greatly, reduce maintenance cost.
Embodiment
In order to further specify principle of the present invention, specific implementation of the present invention is described below in conjunction with accompanying drawing.
Fig. 1 is that the operational system of method of the present invention constitutes block diagram.As shown in Figure 1, method of the present invention comprises the two-part work of client and server end when implementing.Server described in the present invention comprises the embedded device with Http server capability.Client comprises information gathering module, formation sending module, user interactive module and information display module.
Fig. 4 is the method flow diagram according to the embodiment of the invention.With reference to Fig. 4, at first, send the HTTP request from client.The user imports lot of data from the WEB page after, system promptly brings into operation.The information gathering module is collected the data of user's input, behind the input data schema, data is divided into the plurality of data piece.Partition principle be the divided data piece at server end, as have on the embedded device of http-server function, other during operation on the not influence equipment is professional and meet with a response in the time of user's expection, promptly the size of data block is wanted suitably.The too small quantity that can increase data block of data block, thus the piecemeal transmission of each data block increased and the handover overhead when handling, and data block is excessive, its limiting condition has only a data block exactly, has influence on other business again.For example, suppose total speed, duplex state and 3 attributes of port type, 52 ports, if divide according to the minimum data piece, can be divided into 52*3=156 data block, consequently information is the clearest and the most definite, but efficient is minimum, consider that data block is not a lot, therefore division also is an acceptable like this.If need do the configuration of 10 attributes now simultaneously to 500 ports.If also divide according to top method, the time of cost will be very long, and the user is unacceptable.Therefore, can be divided into a data block to 20 ports and an attribute, overhead will significantly reduce, but information just can not be very well, and the resource that takies equipment also can increase.Therefore will be as the case may be, make the size of divided data piece and the extra expense balance of trying one's best, to improve whole efficiency.
In client, the divided data piece is saved in the formation, in order the data block in the formation is sent to server automatically by the formation sending module.Because single small data piece can not take the too many resource of equipment, and the time of carrying out is also shorter, and the user can be very fast obtains execution result, in addition, also can according to circumstances stop the transmission of back at any time, to adapt to user's interim decision-making.
The request of server customer in response end, and execution result information returned described client.The result that server returns comprises feedback information and describes two parts, can know the execution result of server by the feedback information client.At different feedback informations, client can be made different responses, and client is determined next step operation according to feedback information, and client is not done any processing to describing part.
When the request that sends when client runs succeeded on server, or server thinks that the result who carries out is inessential or unnecessary when knowing, server end returns the feedback information that runs succeeded.Describing character string can be confirmations such as " OK ", " success ", " correctly ".Client can continue to check formation and carry out issuing of next data block when receiving this feedback information.
When failure is carried out in the request that sends when client on server, and if server judge and continue issuing also not of back can success the time that server end returns carries out failure, the feedback information that the termination subsequent data blocks issues.The reason that partial content is set to fail is described, can failure to make things convenient for the user know-why.Client can stop the issuing of all data blocks of formation back when receiving this feedback information, be equal to the Close button that the user has clicked client.
For example, create the rule (RULE) of Access Control List (ACL) (ACL:Access Control List) in batches, owing to the RULE that is supported in the equipment is limited, when creating a RULE failure, be likely and reached maximum bar number, the establishment that continues the back this moment more also is failure certainly, therefore need return feedback information.
When failure is carried out in the request that client sends on server, and whether the server request that issues that can not confirm the back can success the time, and server end returns to carry out and fails, and whether user's affirmation stops the feedback information that subsequent data blocks issues.Describe the character string content and be set to the reason that this sends failure, determine whether to continue the transmission of back to make things convenient for the user.Client shows when receiving this feedback information confirms dialog box, is selected to continue to issue or stop the transmission of all data blocks of formation back by the user.
For example, delete MAC Address in batches, because the deletion of each MAC Address is separate, when the some MAC Address of deletion are failed, its failure cause may be that this MAC has been deleted by other keeper, this does not influence the deletion of other MAC Address, and the deletion that continues the back this moment more probably also can be successful, therefore need return feedback information.
In sum, in existing Web application, in the same processing procedure user can't with server interaction, that is to say that the user can't participate in the process of finishing to server after the user submits data to.Can allow the user to submit among the present invention in the process of server operation, to participate in after the data mutual, can suspend or stop or continuing the processing of back, and in the server implementation if mistake, the user can also determine whether to continue the setting of back.If server breaks down when handling the 30th port, in the prior art, the execution of its back can only be determined by server.Whether continue the operation of back by user's decision among the present invention, even mistake do not occur, the user also can stop the 30th the later configuration of port.
Client shows relevant information according to the execution result information of receiving.
Information display module is created client end interface, shows relevant information according to the execution result information of receiving, and after receiving that server program returns execution result, the interface is refreshed.At least should comprise in the client end interface that progress bar demonstration, stop button, user confirm dialog box.Can increase some additional functions during practical application, to increase the friendly at interface.Fig. 2 is the client end interface schematic diagram according to the embodiment of the invention, is depicted as one and has the client end interface of skipping user's affirmation.
Can be during concrete the application by revising color, layout, additional function etc. to realize and the collocation of current format and the close friend at interface.
With the operation of user interactions, i.e. input to the user responds timely in the client, comprise click suspend/continue, stop/X button and when making a mistake user's affirmation select.Fig. 3 is the user interactive interface schematic diagram according to the embodiment of the invention.
Embodiment 1
Be that example illustrates realization of the present invention with the deletion MAC Address below.
On the equipment 5001 MAC Address are arranged now, delete wherein 5000.Figure below is a Demo, supposes that it adds up to 5001.
If use general method, be exactly once 5000 all to be submitted on the equipment, on equipment, use circulation deletion one by one.Can take a large amount of CPU of equipment this moment, influences the normal operation of other business.Use the present invention can avoid this shortcoming, the realization that reference is following:
Client:
Choose 5000 MAC Address, the code below carrying out behind the click Remove button
Var count=oMAutoList.GetSelCount (); //oMAutoList is a multiple row choice box object
if(0==count)
{
There is not selected row in the // choice box
return?false;
}
// the present invention can use object to realize, by the following function an example of the present invention of can choosing the road through
var?oSendMsg=GetQueue(window);
oSendMsg.Reset("/wcn/mac/summary_detail");
// from the multiple row choice box, obtain the row that all are chosen, to realize deblocking
var?arrSelRows=oMAutoList.GetSelectedRows();
for(var?i=0;i<count;i++)
{
// in this example, each line data is a data block
sURL=sAction+"&mac="+arrSelRows[i].getValue();
oSendMsg.AddMsg(sURL,arrSelRows[i].GetText());
}
In time preserve after // the data block at every turn told.
Of the present invention the automatically performing of // startup
oSendMsg.Start();
return?false;}
Server end:
Obtain the deletion MAC action on the actuating equipment after the data of client.Because a data block of client has only a MAC Address, so server-side processes is got up not only simply but also occupying system resources not.if(RemoveMac()==OK){
// delete successfully, return the feedback information that allows to continue deletion
return?OutputResul?t(“OK”,WCN_QA_NEXT);}else?if(InternalError()){
// internal error appears, return the feedback information of forced termination, if the setting that allows this moment client to continue the back still gets nowhere basically
return?OutputResult(“Internal?error.”,WCN_QA_STOP);}else{
// general mistake can allow the user go to determine the operation of back.The reason of output error simultaneously
return?OutputResult(GetErrorMsg(),WCN_QA_USER);}
Client is packaged to the processing of three kinds of feedback informations, is transparent to the developer.Server end can output to the different feedback information of client according to different situations.
The operation interface figure of present embodiment as shown in Figure 5.
Embodiment 2
Implement situation of the present invention when being many configuration items of example explanation multiport with the port arrangement.On one 52 mouthfuls switch, simultaneously when configured port speed, duplex state, flow control, the forwarding of long frame and broadcast storm, use way of the present invention as follows to all port:
Client:
// the present invention can use an object to realize, can implement var oSendMsg=GetQueue of the present invention (window) by following function; OSendMsg.Reset ("/wcn/port/summary ");
// carry out deblocking according to configuration item of a port
// may take client CPU more, but because reduced the burden on the equipment, and the PC of client
// configuration general all than high many of equipment, so do not influence operate as normal.var?nPortCount=GetSelectedPortCount();var?sAction="/wcn/port/setup";for(var?i=0;i<nPortCount;i++){
var?sPortAction=sAction+"&port="+GetSelectedPort(i);
// cut apart the port speed data block
sURL=sPortAction+"&speed="+getSpeedValue();
OSendMsg.AddMsg (sURL, " port speed is set ");
// cut apart the duplex state data block
sURL=sPortAction+"&duplex="+getDuplexValue();
OSendMsg.AddMsg (sURL, " duplex state is set ");
// cut apart the flow control data block
sURL=sPortAction+"&speed="+getSteamValue();
OSendMsg.AddMsg (sURL, " flow control is set ");
// cut apart long frame to transmit data block
sURL=sPortAction+"&frm="+getFrameValue();
OSendMsg.AddMsg (sURL, " long frame is set to be transmitted ");
// cut apart the broadcast storm data block
sURL=sPortAction+"&bd="+getBroadValue();
OSendMsg.AddMsg (sURL, " broadcast storm is set "); }
In time preserve after // the data block at every turn told.
Of the present invention the automatically performing of // startup
oSendMsg.Start();
Server end:
Obtain after the data of client the port-action that is provided with on the actuating equipment.Because a data block of client has only a port and a setting option, so server-side processes is got up fairly simple and occupying system resources is less.
// get port char*sPort=GetUrlParameter (" port "); If (NULL==sPort)
// get parameter error, return the feedback information of forced termination, may be that illegal user enters this moment.
Return OutputResult (" Parameter error. ", WCN_QA_STOP); If (being that port speed is set)
UlRetCode=SetPortSpeed (); Else if (being that duplex state is set)
UlRetCode=SetPortDuplex (); Else if (being that flow control is set)
UlRetCode=SetPortStream (); Else if (being long frame to be set transmit)
UlRetCode=SetPortFrame (); Else if (being that broadcast storm is set)
ulRetCode=SetPortBroad();}else{
// error in data, the feedback information of output forced termination, may be that illegal user enters this moment.
return?OutputResult(“Parameter?error.”,WCN_QA_STOP);}if(OK==ulRetCode){
// success is set, output allows to continue the feedback information of configuration
return?OutputResult(“OK”,WCN_QA_NEXT);}if(InternalError()){
// internal error appears, and the feedback information of output forced termination is if the setting that allows this moment client to continue the back still gets nowhere
return?OutputResult(“Internal?error.”,WCN_QA_STOP);}
// general mistake can allow the user go to determine the operation of back.The reason of output error simultaneously
return?OutputResult(GetErrorMsg(),WCN_QA_USER)。
The operation interface figure of present embodiment as shown in Figure 6.
What more than enumerate is the exemplary embodiment of explanation principle of the present invention, and the present invention is not limited to this.For a person skilled in the art, the present invention can have various changes and variation.Within the spirit and principles in the present invention all, any modification of being done, be equal to replacement, improvement etc., all should be included within the claim scope of the present invention.