A kind of B/S of making system has the method for distributed nature
Technical field
The present invention relates to the B/S system, the especially a kind of B/S of making system has the method for distributed nature.
Background technology
In present telecommunications industry, the operation of OSS business service mostly is B/S(browser end/server end) structure, generally utilize Java EE to develop, Java EE wherein is a kind of standard of Java, be abbreviation (the Java Platform of Java platform, enterprise edition, Enterprise Edition), be used to develop be convenient to assemble, healthy and strong, can expand, the server end Java of safety uses.Traditional B/S(browser end/server end) system work process is that the user utilizes the browser end access service, thereby returns to the transmission that corresponding user place browser end is finished information after by server end different business being handled.
As seen in traditional B/S structure, the fraction affairs logic of having only in the Business Processing realizes that at browser end most affairs logic is all in server end realization, load balancing far from.Simultaneously, raising along with traffic carrying capacity in the telecommunications industry, the quick growth of visit capacity and data traffic, telecom operators require transaction processing system not only will reach load balancing, the ability that also will have disaster tolerance, can expand and be easy to safeguard, such as when in the system break down in the part, can safeguard separately faulty component, and not influence the normal operation of other business; When adding the new business function, only need this business is disposed separately and avoided influencing the normal operation of other function of system.More than these requirements mean that all the B/S system should have distributed nature.
But to utilizing the B/S system of Java EE exploitation in the prior art, add the HardwareUpgring that new characteristic need be added code again and carry out usually, the cost costliness is consuming time serious.
Summary of the invention
The object of the present invention is to provide a kind of B/S of making system to have the method for distributed nature, realize utilizing Java EE to allow B/S under the prerequisite of not revising any code, realize distributed nature.
The technical scheme that the present invention solves the problems of the technologies described above is as follows: a kind of B/S of making system has the method for distributed nature, comprising:
Step S1, the server end in the B/S system is split as client and backstage service end, described backstage service end comprises child servers;
Step S2, between described client and described backstage service end the route end is set, this route end comprises route information table.
By the server end in the original B/S system is split as client and backstage service end, making in traditional B/S system server end reach service when operation provides and the service consumption de, thereby realizes distributed.Between client and backstage service end, add the route end and can realize load balancing.
Further, step S1 also comprises following substep:
S11, Service Processing Module is deployed in the described child servers.
Different business further is split as littler Service Processing Module, and carries out the modularization distribution, can improve the parallel ability of system in the backstage service end.
Further, step S1 also comprises following substep:
S12, agency mechanism is set in described client;
S13, service end is provided with reflex mechanism on described backstage.
Agency mechanism and reflex mechanism belong to the common method among the Java, and agency mechanism (Proxy) is for other objects provide a kind of agency with the visit of control to this object, is equivalent to the gateway between client and the backstage service end in the present invention or transmits intermediary; Reflex mechanism (Reflection) is the information dynamically obtained and the method for dynamic call object, and the backstage service end can rely on reflex mechanism to call local Service Processing Module and finish Business Processing in the present invention.The utilization of agency mechanism and reflex mechanism makes and realizes de between client and the backstage service end, and increased the transparency between client and the backstage service end.
Further, step S2 also comprises following substep:
S21, the deployment information of described Service Processing Module on described child servers is stored in the described route information table.
Can find the deployment information of the pairing Service Processing Module of service request by the route information table of route end, provide safeguard for route service is provided.
Preferably, described agency mechanism is the dynamic proxy mode.
Dynamic proxy (Dynamic Proxy) just generates agency's mode when being operation, in this way, can be changed when the operation by the object acted on behalf of, the interface that needs control and control mode, the static state agency of the change than can't adapt to operation the time has more flexibility.
And that described dynamic proxy mode adopts is Cglib.
Cglib adopts is that ASM bytecode instrument is directly revised bytecode and the agency that produces, need not depend on the interface of agent object, so application limitations is less.
Further, described step S11 also comprises following substep:
S110, every kind of described Service Processing Module is deployed in two described child servers at least.
Described deployment information comprises that the domain name of Service Processing Module claims, loaded service identifies, place child servers information.
When one of them child servers at Service Processing Module place breaks down, can not influence this Service Processing Module on other child servers to the normal process of business.
By the server end in the original B/S system is split as client and backstage service end, realized the distributed deployment of system, between client and backstage service end, add the route end and realized load balancing, and implementation procedure need not revised a large amount of codes of B/S system, only the configuration file in the original system need be made simple modification can easily finish, save lot of manpower and material resources, effectively controlled the optimization cost.
Description of drawings
Fig. 1 is a method flow diagram of the present invention;
Fig. 2 is the distributed schematic diagram that the present invention realized.
Embodiment
Below in conjunction with accompanying drawing principle of the present invention and feature are described, institute gives an actual example and only is used to explain the present invention, is not to be used to limit scope of the present invention.
According to shown in Figure 1, the invention provides a kind of B/S of making system and have the method for distributed nature, comprising:
Step S1, the server end in the B/S system is split as client and backstage service end, described service end comprises child servers; Step S2, between described client and described backstage service end the route end is set, this route end comprises route information table.
In traditional B/S system, server end should receive and analyze user's request that browser sends, and again the user's request after analyzing is handled, and returns result.It has served as service consumer and these two kinds of roles of ISP simultaneously.The two can't finish function separately independently of each other in traditional B/S system, the degree of coupling is very high.Therefore, the present invention is split as two functional areas with the two, be responsible for receiving the customer service request of sending from browser by client, through client solicited message is encapsulated, be delivered to the backstage service end by http again, the backstage service end then is responsible for receiving this service request and carrying out Business Processing by request, and result is returned to client by http.Wherein, client can comprise a plurality of client computer, and different types of service request can be received by different client computer and analyze, and the backstage service end also can be divided into a plurality of child servers, is used for handling respectively different types of business.Such as, in Fig. 2, respectively performance analysis business, channel management business, user management business are received respectively and analyzed by performance analysis client computer, channel management client computer, the user management client computer of client, by performance analysis child servers, channel management child servers, user management child servers business is handled respectively in the backstage service end.
Http is a HTML (Hypertext Markup Language), is the standard of asking and replying between the terminal of using always.
Therefore, further, step S1 also comprises substep S11, Service Processing Module is deployed in the described child servers.For example, the customer relationship Service Processing Module is deployed in the carrying customer relationship child servers; The channel management Service Processing Module is deployed in the carrying channel management child servers.So just realized that from function the ISP from one to many distributed deployments, has reduced the degree of coupling of traditional B/S system server terminal.
Step S2, between described client and described backstage service end the route end is set, this route end comprises route information table.Step S2 also comprises following substep S21, the deployment information of described Service Processing Module on described child servers is stored in the described route information table.Wherein, deployment information comprises that the domain name of Service Processing Module claims, loaded service identifies, place child servers information.For example, the domain name of performance analysis Service Processing Module is called " performance analysis "; When adding a Bean for this Service Processing Module, the Bean ID that is named is exactly a loaded service sign (wherein Bean is a standard among the Java, belongs to known technology); Place child servers information comprises the title, sign of address on the child servers that Service Processing Module disposes and child servers etc.Child servers information and domain name claim, loaded service has mapping relations between identifying in route information table.The route end provides sensing to backstage service end Data transmission by route information table to client, help client find service request the destination that should arrive.
Further, step S1 also comprises following substep:
S12, agency mechanism is set in described client;
S13, service end is provided with reflex mechanism on described backstage.
Wherein, described agency mechanism is the dynamic proxy mode.Agency mechanism (Proxy) is to provide a kind of agency with the visit of control to this object for other objects; Reflex mechanism (Reflection) is the mechanism of the method for the information dynamically obtained and dynamic call object, be exactly in running status,, can both know all properties and the method for this class for any one class, for any one object, can both call its any one method.Agency mechanism is equivalent to the gateway between client and the backstage service end in the present invention or transmits intermediary, client passes to the route end by agency mechanism earlier with service request, the route end is searched route information table according to service request, poll returns this professional child servers information of deployment, client is according to the child servers information of returning then, service request is directly sent on the corresponding child servers of backstage service end, this child servers receives that this request back calls the corresponding service processing module by reflex mechanism, gives client with the result data back and notifies the browser end at user place.Child servers business transferring request on the service end of backstage, the backstage service end is also returned service processing result by agency mechanism to client.
The agency is according to the difference of creation-time, be divided into static agency and dynamic proxy (Dynamic Proxy), static agency generates source code automatically by programmer's establishment or particular tool, before program running, the .class file of proxy class has just existed, dynamic proxy (Dynamic Proxy) dynamic creation when being program running, in this way, the object of being acted on behalf of, need the interface and the control mode of control when operation, to change, static state agency than the change that can't adapt to when operation has more flexibility, and need not its code of programmer's hand-coding, saved programing work, and improved extensibility, meet the requirement that realizes distributed nature.
That wherein, dynamic proxy preferably adopts is Cglib.Cglib adopts is that ASM bytecode instrument is directly revised bytecode and the agency that produces, and Cglib can act on behalf of the class of the succession that does not realize interface, because Cglib is not based on interface, efficient is higher, uses more flexibly, so application limitations is less.
Agency mechanism and reflex mechanism belong to method for designing commonly used in the Java language, belong to those skilled in the art's known technology.
Further, described step S11 also comprises following substep, S110, every kind of described Service Processing Module is deployed in two described child servers at least.Come distribution service to handle request by the mode of delivery of services,, also can not influence the normal process ability of this business on other child servers even wherein indivedual child servers breaks down.
Coupling above can be understood as the dependence between entity and the entity.Interdependency is exactly more by force a close coupling, otherwise is exactly loose coupling.
The above only is preferred embodiment of the present invention, and is in order to restriction the present invention, within the spirit and principles in the present invention not all, any modification of being done, is equal to replacement, improvement etc., all should be included within protection scope of the present invention.