The accelerated method of non-intrusion type WEB requests
Technical field
The present invention relates to software technology field, more particularly to a kind of accelerated method of non-intrusion type WEB requests.
Background technology
With going deep into for enterprise operation system application, business system scale constantly expands, and software complexity is constantly promoted.This
It to the developing of information system, integrates, dispose, upgrade etc. and to propose new problem, the high efficiency and autgmentability of system architecture are carried
New requirement is gone out.
Information system is generally divided into several parts:1)Background program connects database, does business.2)Some industry on foreground
Business logic, control etc., 3)It is presented to the page info of user(UI parts), including picture, layout, pattern, js files.Js files
Service logic can also be included.Picture, layout, pattern, the js files of program in itself are typically static.Common static money
Source part contains picture file(.jpg .gif .png .bmp), pattern file(.css), js files (.js).
For good user experience, the page info in system(UI parts)With picture, pattern and client script
JS files are increasingly complicated, and such Web request occupies substantial amounts of network traffics.And these contents are generally only to be to increase
The effect of system, not comprising service logic.
In existing information system, there are substantial amounts of picture (.jpg .gif .png etc.), pattern (.css), client scripts
(.js).According to J2EE specifications, these files all exist under the WEB-INF catalogues of software deployment bag for accessing.Deployment is completed
Afterwards, program and these static files are all placed in the vessel, and when user accesses, container directly responds user.Such side
Formula just brings drawback:
1. static resource file needs network transmission file, therefore can occupy more network bandwidths.Service logic and
These static resources occupy identical bandwidth, therefore substantial amounts of bandwidth is occupied by static resource file in same container.Business
The bandwidth of logic is with regard to occupied.So traffic handing capacity, concurrent capability will decline.
2. on the one hand network bandwidth is, the second aspect is server thread.Because the page of a usual system, comprising
Many static resources such as picture and pattern, since script deployment way is all placed on together.Each to access, operation container can all account for
With a server thread.The thread that so service logic needs in itself is with regard to occupied.
3. it is also contemplated for separating static resource during many large business system optimizations.But need manually to be recognized, it takes out
It takes., it is necessary to manually build static resource server after extraction, complicated configuration is carried out.
The content of the invention
There are problems that for existing non-intrusion type WEB requests ..., the present invention proposes a kind of non-intrusion type WEB requests
Accelerated method.
The present invention provides a kind of accelerated methods of non-intrusion type WEB requests, and based on J2EE application standards, feature exists
In:
1)The High Availabitity relevant parameter of program is defined by the page of manager:Minimum and maximum operation node interval;
2)After the completion of definition, deployment package upload is carried out by system;
3)After the completion of uploading verification, system background is decompressed and verified:Verifying content includes bibliographic structure, Engineering describing
Accord with file and static resource catalogue;
4)System and state server communicate, and update state server state, write newest deployment package informatin;
5)After the update of state server state, all static resource servers perceive event notice, carry out static
Resource TOC compares, synchronous or update, and comparing result determines whether file is updated, and covers and deletes;
6)Change the routing rule of network.User is automatically separated static resource server for the access of static resource
On and service logic access link separation.
The step 3)In decompression and checking procedure, it is characterised in that system carry out logical operation, analyze pack arrangement
Normalization, judges whether bibliographic structure meets specification, with the presence or absence of WEB-INF, with the presence or absence of Engineering describing file and whether deposit
In static resource catalogue.
The step 4)In more new strategy, it is characterised in that after extracted file, compare current static Resource Server on
Whether there is the catalogue of the application system, compared using MD5 algorithms and determine whether file needs to change or update:If file
MD5 condition codes do not change, then need not separate this document again, improve the performance of program, ensure that separated correct
Property;Identifying system title and access address automatically extract static resource file, automatically visit service logic and static resource file
It asks and is balanced to different terminals;
The step 5)In event notification mechanism, it is characterised in that it is first when some application program dispose/update
First Deployment Manager can first inform state recording module, record current state, the version of system;Then bag verification is carried out, is verified
After without exception, it is sent on the server of system and is disposed;Change state server state simultaneously.All static resources
Server because employing action listener mechanism, can all receive the event notice of system code variation;Once receive this variation
Static resource server just directly into Deployment Manager catalogue, carries out file comparison;MD5 codes, which are not met, then directly carries out file
Covering update;If MD5 codes are consistent, then it is assumed that file does not change.
Specifically, it is to static resource file abstracting method:Scan image, static, css below WEB-INF etc. often
Catalogue is advised, finds all files of the name with js, css, jpg, bmp, png, gif form, this class file is disposed from Java
It is decompressed in bag, and copies the file to static resource server;It first compares on current static Resource Server, if had this
The catalogue of a application system;If so, it has not been to dispose for the first time to be proved to be this application, then need under documents catalogue
Each file;Comparison is carried out using MD5 condition codes, and MD5 codes are if it does not match, program thinks to need re-synchronization file.
The access address of identifying system, the method that automatic modification accesses balanced device are:After each information system deployment
There is the web access address of response;Likewise, static resource is also required for the access address of oneself;For seamless docking, use is allowed
Family is imperceptible, and system will change network equilibrium and routing rule automatically;If Operational Visit, then balanced road business service
Device if needing to access static resource, then jumps to static resource server.
The accelerated method of the non-intrusion type WEB requests of the present invention, its advantage are:
1)It is applied to Web request accelerator with MD5 algorithms, greatlys save the difficulty of comparison, it is every that comparison need not be cycled
One file need not compare and either carry out file update, reduce file transport overhead every time.Either new deployment is still
Update below, programmed logic can be unified:The file lacked is just directly subject to Deployment Manager, and alternative document is with newest
File MD5 codes subject to.
2)With event notification mechanism, the maintenance of cluster environment is greatly simplified.Institute is stateful to be all sent to state server,
Other action listeners person listens to event, is just handled.
Description of the drawings
Fig. 1 is the logic diagram of the non-intrusion type web request accelerated method of the present invention.
Specific embodiment
Embodiment 1:The non-intrusion type web request accelerated method of the present invention carries out under following environment:Client uses
Readware hardware is balanced, balanced using Nginx softwares.
1)The High Availabitity relevant parameter of program is defined by the page of manager:Minimum and maximum operation node interval;
2)After the completion of definition, deployment package upload is carried out by system.A deployment package is established to each system or module,
Each deployment package contains service logic and static resource file;Deployment package is uploaded by system, system scanning deployment package is right
Static resource file is extracted.
3)After the completion of uploading verification, system background is decompressed and verified:Verifying content includes bibliographic structure, Engineering describing
Accord with file and static resource catalogue.System carries out logical operation, analyzes the normalization of pack arrangement, judges whether bibliographic structure meets
Specification, with the presence or absence of WEB-INF, with the presence or absence of Engineering describing file and with the presence or absence of static resource catalogue.
4)System and state server communicate, and update state server state, write newest deployment package informatin;
5)After the update of state server state, all static resource servers perceive event notice, carry out static
Resource TOC compares, synchronous or update, and comparing result determines whether file is updated, and covers and deletes.Comparison is current quiet
Whether there is the catalogue of the application system on state Resource Server, compared using MD5 algorithms and determine whether file needs to change
Or update:If file MD5 condition codes do not change, this document need not be separated again, improves the performance of program, ensured
Separated correctness;Identifying system title and access address automatically extract static resource file, automatically by service logic and quiet
The access of state resource file is balanced to different terminals;When some application program dispose/update, Deployment Manager can be first first
It informs state recording module, records current state, the version of system;Then bag verification is carried out, after verification is without exception, is sent to
It is disposed on the server of system;Change state server state simultaneously.All static resource servers, because employing
Action listener mechanism can all receive the event notice of system code variation;Once this variation static resource server is received
Directly into Deployment Manager catalogue, file comparison is carried out;MD5 codes, which are not met, then directly carries out file covering update
6)Change the routing rule of network.User is automatically separated static resource server for the access of static resource
On and service logic access link separation.
Specifically, it is to static resource file abstracting method:Scan image, static, css below WEB-INF etc. often
Catalogue is advised, finds all files of the name with js, css, jpg, bmp, png, gif form, this class file is disposed from Java
It is decompressed in bag, and copies the file to static resource server;It first compares on current static Resource Server, if had this
The catalogue of a application system;If so, it has not been to dispose for the first time to be proved to be this application, then need under documents catalogue
Each file;Comparison is carried out using MD5 condition codes, and MD5 codes are if it does not match, program thinks to need re-synchronization file.
The access address of identifying system, the method that automatic modification accesses balanced device are:After each information system deployment
There is the web access address of response;Likewise, static resource is also required for the access address of oneself;For seamless docking, use is allowed
Family is imperceptible, and system will change network equilibrium and routing rule automatically;If Operational Visit, then balanced road business service
Device if needing to access static resource, then jumps to static resource server.