The accelerated method that non-intrusion type WEB asks
Technical field
The present invention relates to software technology field, particularly relate to the accelerated method that a kind of non-intrusion type WEB asks.
Background technology
Along with going deep into of enterprise operation system application, business system scale constantly expands, and software complexity constantly promotes.This proposes new problem to the exploitation of information system, integrated, deployment, upgrading etc., proposes new requirement to the high efficiency of system architecture and autgmentability.
Information system is divided into several part usually: 1) background program, and connection data storehouse, does business.2) some service logic, the controls etc., 3 on foreground) be presented to the page info (UI part) of user, comprise picture, layout, pattern, js file.Js file also can comprise service logic.The picture of program itself, layout, pattern, js file, normally static.Common static resource part contains picture file (.jpg .gif .png .bmp), pattern file (.css), js file (.js).
In order to good Consumer's Experience, intrasystem page info (UI part) along with picture, pattern and client script JS file day by day complicated, this type of Web request occupy a large amount of network traffics.And the effect of these contents usually just in order to increase system, do not comprise service logic.
In existing information system, there is a large amount of pictures (.jpg .gif .png etc.), pattern (.css), client script (.js).According to J2EE specification, these files all exist under the WEB-INF catalogue of Software deployment bag for access.After deployment completes, program and these static files are all put in a reservoir, and when user accesses, container directly responds user.Such mode just brings drawback:
1. static resource file needs Internet Transmission file, therefore can take many network bandwidths.Service logic and these static resources are at same container, and take identical bandwidth, therefore a large amount of bandwidth is taken by static resource file.The bandwidth of service logic is just occupied.So traffic handing capacity, concurrent capability will decline.
2. the network bandwidth is that second aspect is server thread on the one hand.Because the page of a usual system, comprises the static resources such as a lot of picture and pattern, because script deployment way is all put together.Each access, runs container and all can take a server thread.The thread that such service logic itself needs is just occupied.
3. when a lot of large business system is optimized also consider static resource to be separated.But need manually to recognize, extract.After extraction, need manually to build static resource server, carry out complicated configuration.
Summary of the invention
Existence is asked for existing non-intrusion type WEB ... problem, the present invention proposes the accelerated method of a kind of non-intrusion type WEB request.
The invention provides the accelerated method that a kind of non-intrusion type WEB asks, based on J2EE application standard, it is characterized in that:
1) by the High Availabitity relevant parameter of the page definition program of manager: between minimum and maximum operation node area;
2), after having defined, carry out deployment by system and wrap biography;
3) upload after verification completes, system background carries out decompress(ion) and verification: verification content comprises bibliographic structure, Engineering describing symbol file and static resource catalogue;
4) system communicates with state server, upgrades state server state, writes up-to-date deployment package informatin;
5) after status service upgrades, all static resources perceive event notice, carry out the contrast of static resource catalogue, synchronous or renewal, and whether comparing result decides file and upgrade, and cover and delete.
6) routing rule of network is revised.User is separated in static resource service automatically for the access of static resource, is separated with the access link of service logic.
Decompress(ion) in described step 3) and checking procedure, it is characterized in that system carries out logical operation, the normalization of analysis package structure, judges whether bibliographic structure meets specification, whether there is WEB-INF, whether there is Engineering describing file and whether there is static resource catalogue.
Update strategy in described step 5), after it is characterized in that extracted file, whether contrast current static server there is the catalogue of this application system, file is the need of amendment or renewal to adopt the contrast of MD5 algorithm to determine: do not change if file MD5 spy detects code, then do not need again to be separated this file, the performance of raising program, ensure that the correctness of separation; Recognition system title and reference address, automatically extract static resource file, automatically service logic and static resource file access be balanced to different terminals;
Event notification mechanism in described step 5), is characterized in that first Deployment Manager can first inform state recording module, the current state of register system, version when certain application program carries out disposing/upgrading; Then carry out bag checking, verify without exception after, the server being just sent to system is disposed; Change state server state simultaneously.All static resource servers, because have employed action listener mechanism, all can receive the event notice of system code change; Once receive, this change static server is just direct in Deployment Manager catalogue, carries out file contrast; MD5 code does not meet, and directly carries out file and covers renewal; If MD5 code is consistent, then think that file does not change.
Concrete, to static resource file abstracting method be: the conventional catalogue such as image, static, css below scanning WEB-INF, find all names with the file of js, css, jpg, bmp, png, gif form, this class file is disposed decompress(ion) bag from Java, and by file copy to static resource server; First contrast on current static server, whether had the catalogue of this application system; If had, proving this application has not been dispose first time, then need each file under documents catalogue; Contrast adopts MD5 condition code to carry out, if MD5 code does not mate, then program is thought needs re-synchronization file.
The reference address of recognition system, the method for amendment access equalizer is automatically: each information system has the web reference address of response after disposing; Same, static resource also needs oneself reference address; In order to seamless docking, make user imperceptible, system will change network equilibrium and routing rule automatically; If Operational Visit, then balanced road service server, if need access static resource, then jumps to static resource server.
The accelerated method that non-intrusion type WEB of the present invention asks, its beneficial effect is:
1) ask accelerator by MD5 algorithm application in Web, greatly save the difficulty of contrast, do not need each file of circulation contrast, do not need to contrast at every turn or carry out file update, reduce file transfer expense.No matter be new deployment or renewal below, programmed logic can both be unified: the file lacked is just direct to be as the criterion with Deployment Manager, and alternative document is as the criterion with up-to-date file MD5 code.
2) with event notification mechanism, the maintenance of cluster environment is greatly simplified.All states are all be sent to state server, and other action listeners person listens to event, just processes.
Accompanying drawing explanation
Fig. 1 is the logic diagram of non-intrusion type web request accelerated method of the present invention.
Fig. 2 is module assignment of the present invention and flow chart.
Embodiment
Embodiment 1: non-intrusion type web request accelerated method of the present invention carries out under following environment: client uses readware hardware balanced, uses Nginx software balanced.
1) by the High Availabitity relevant parameter of the page definition program of manager: between minimum and maximum operation node area;
2), after having defined, carry out deployment by system and wrap biography.Set up one to each system or module and dispose bag, each deployment Bao Jun contains service logic and static resource file; Uploaded by system and dispose bag, system scan disposes bag, extracts static resource file.
3) upload after verification completes, system background carries out decompress(ion) and verification: verification content comprises bibliographic structure, Engineering describing symbol file and static resource catalogue.System carries out logical operation, the normalization of analysis package structure, judges whether bibliographic structure meets specification, whether there is WEB-INF, whether there is Engineering describing file and whether there is static resource catalogue.
4) system communicates with state server, upgrades state server state, writes up-to-date deployment package informatin;
5) after status service upgrades, all static resources perceive event notice, carry out the contrast of static resource catalogue, synchronous or renewal, and whether comparing result decides file and upgrade, and cover and delete.Whether contrast current static server there is the catalogue of this application system, file is the need of amendment or renewal to adopt the contrast of MD5 algorithm to determine: do not change if file MD5 spy detects code, then do not need again to be separated this file, improve the performance of program, ensure that the correctness of separation; Recognition system title and reference address, automatically extract static resource file, automatically service logic and static resource file access be balanced to different terminals; When certain application program carries out disposing/upgrading, first Deployment Manager can first inform state recording module, the current state of register system, version; Then carry out bag checking, verify without exception after, the server being just sent to system is disposed; Change state server state simultaneously.All static resource servers, because have employed action listener mechanism, all can receive the event notice of system code change; Once receive, this change static server is just direct in Deployment Manager catalogue, carries out file contrast; MD5 code does not meet, and directly carries out file and covers renewal
6) routing rule of network is revised.User is separated in static resource service automatically for the access of static resource, is separated with the access link of service logic.
Concrete, to static resource file abstracting method be: the conventional catalogue such as image, static, css below scanning WEB-INF, find all names with the file of js, css, jpg, bmp, png, gif form, this class file is disposed decompress(ion) bag from Java, and by file copy to static resource server; First contrast on current static server, whether had the catalogue of this application system; If had, proving this application has not been dispose first time, then need each file under documents catalogue; Contrast adopts MD5 condition code to carry out, if MD5 code does not mate, then program is thought needs re-synchronization file.
The reference address of recognition system, the method for amendment access equalizer is automatically: each information system has the web reference address of response after disposing; Same, static resource also needs oneself reference address; In order to seamless docking, make user imperceptible, system will change network equilibrium and routing rule automatically; If Operational Visit, then balanced road service server, if need access static resource, then jumps to static resource server.