Use a SERVICE-oriented architecture to improve manageability and scalability of your application underlying architecture.

xiaoxiao2021-03-06  57

The concept of application framework is almost simultaneously with object-oriented techniques, which has proven to shorten development time, improve component reuse, and an effective way to meet market conditions in time. The application framework encapsulates advanced underlying technologies (such as .NET Remoting, ADO.NET, and Security) and provide a shared underlying architecture component for program development. The application development team can focus on developing business functions because the framework provides all the necessary underlying architecture components. At the same time, since the framework encourages the consistency of the program design, you can reduce costs in terms of application.

Since your development team is planning to use .NET technology, you will want to create a reliable application framework to achieve the purpose of using these performance in a cost-saving manner. Before you do this, you can understand the issues of procedures management and scalability, you can have a SERVICE-oriented application framework to solve these problems, thus enhances developers' productivity in your business.

The management and scalability of applications is two special issues involved in any development organization. Unless you have treated them very well, it will be difficult to handle later. First, I will clarify the concept of manageability and scalability. Some program components (such as components that are incoming database connection strings) are supported by a configuration file. After you deploy these components, you may need to add a new entry in the configuration file or modify the existing entry. This ability to modify the configuration information and easily use it in the component to indicate that your application has strong management. However, in many cases, the application team does not have the right to access the product server, so the server administrator is required to modify the configuration and restart the server. For the application development group, it is better if you have the ability to modify the configuration information of a particular program.

Scalability refers to the ability to add new, manageable components to the frame without causing the existing software to be changed. Usually you will start the construction of your underlying architecture with a range of requirements (such as database access and security). When you want to add new performance, (such as a scheduler (Scheduler) or E-mail, you should already have a standard object mode as the foundation of these components. Similarly, you need a standard method to specify configuration information used to provide these underlying architectural performance components.

Most application frameworks are mainly used to provide a model for the development of applications while increasing the reuse of components. Providing the application of the underlying architecture service is the main function target of all program frames, so the scalability and manageability of each individual part in this frame should be the primary target.

Identifying Service Before you start discussing architectural issues, it is very important to get a service and how it is applied to the program. Do not mix them with the service in Web Services as a talk. A Service is a functional unit in a stand-alone framework, each service, may be running (Started) and stopped, and it has its own configuration information. Since Service has a definition defined limit, they can make good systems more consolidated and extend the frame with minimal separation members.

Application Framework provides a large number of bottom architecture components for consistency programs. The components provided by the application framework are divided into two categories: utility components and service components. I will mainly introduce the service component, so I understand the difference between them.

Application Framework Glossary is familiar with these terms that makes it easy for you to find and create a service-oriented framework for your business. More tool components themselves are lightweight, meaning creation they do not consume a lot of memory. Usually they are also stateless, if there is a stateful, only in a short period of time, such as when the client is processed in an intermediate layer. Examples of tool components include data access components that centrally access the database, and a component that takes effect for an E-mail address. These components do not require a large initialization code to complete the creation work. A Service component provides a certain function while having resource costs at each startup. For several reasons, you have to create a new object every time. For example, a Service may have a configuration file that needs to be loaded at startup; in which case new components will reduce efficiency. At the same time, this component may need to perform time-consuming initialization at startup. You must not want to endure such a latency every time you need a service, this is why you want to implement it as long as you open this service, you can adjust their causes again and again. Therefore, once a service starts running, you need to have a good way to make it temporarily unavailable or restarted.

For example, you have a component that provides a Data-Source registration function. This component provides a connection string and an XML configuration file listing all data sources. This component loads the file into the memory during startup and provides a connection string for the data source. Loading configuration from this file is a fairly consuming memory, so you must not create new components when you need strings every time you need a string.

Design Platform The purpose of the service architecture is to provide a service development mode for recognizable and a server that provides operational support for these services. In order to explain how it is run, I will outline an exemplary scene. This server is a simple program that can accept (Host) any remote object. Remoting in .NET is a replacement of DCOM. It is used to provide object access running in different application domains, which can be performed in the same machine or different machines. Because of the raability is important for any untrivial enterprise app, you will want to separate the business logic layer from the display layer. All components that need to be involved in distributed transactions must be used as enterprise services in COM ; all other components are used as .NET remote components. Since .NET does not provide any default container program for receiving remote components, this server just fills this vacancy.

figure 1.

Reasonable architecture

This architecture is mainly composed of Remoting Server, Service Context, Service, Service Controller, and Service Locator, and SERVICE. Remoting Server includes two stacks; the stack on the left displays a list of remote objects they receive (see

figure 1). This Service Controller is a special remote object in this frame, and the server will automatically register it. If any other remote object needs to be accepted in the server, they can be added to the configuration file of the server. The Service Controller also controls the activity cycle of all services located in the right hand side stack. All layers of the application (display layers, business logic and data access layers) are implemented with Service Locator objects. Since you have already understood components that make up this architecture, then I will continue to introduce its implementation problem (see

figure 2).

Providing Servers In this example, the server is a simple Windows Service that provides a host environment (Hosting Environment) and allows them to run in the Transmission Control Protocol channel. The server can accept any Remoting class mentioned in the configuration file. It registers a built-in remote object called Service Controller. This object is the component of this framework because it controls all service cycles of service. At startup, Windows Service sets a TCP channel to create a Service Controller object, and then register it as a remote object. The user end can access these services through an object called Service Locator, which is designed according to the factory-method mode. This allows these services and clients to form loose coupling through the package information of the service location (Physical Location). Like any other Windows Service, the server can start or stop by a control panel. Every time you restart this server, all underlying services will be restarted. Any changes in the configuration file will cause restart of the server. In the Application Framework, you can implement the functional unit of the underlying architecture (such as a data source manager, security manager, and E-mail transmitter) as a service. Although they have different functions, their concepts are the same - all services.

figure 2.

Reasonable design

Service Controller is a single instance of remote object example, which is operated in the server (Windows Service) mentioned earlier (see

Resource). It reads the XML configuration file when constructed and starts all services mentioned in the file. There is a name in the XML file

Part of which is used to provide details of each service, such as the Class name and Assembly name. All services can be accessed through this object, any client that needs to access these service will first get the instance of the controller, and then request an instance of a Service to the controller. You may want to know why you must have a controller and why these service itself cannot be registered as a remote object. Although this is also a feasibility plan, it is more advantageous to use this controller.

Service Controller provides some flexible usage so that you want a special service to temporarily invalid. It can check its status before a service returns the client. In the absence of a controller, Services must be registered as a remote object. In this case, the Service object is even marked even after sending out to the client, because the remote host (Remoting Host) cannot interrupt the request for Service. If the client does not check the status of this service, it may try to use some invalid objects. Service Controller is also very useful in bookkeeping operations, such as tracking requests and log management sent to Service.

Service Locator provides service access for client location transparency (Location-Transparent). You must not want the client object to know what these service's specific location and what you are used to access their skills. If the client understands these details, the client and service are tightly coup. When a close coupling is formed, if a service moves from one server to another server, then you need to change all the clients. You can put the execution information in the Service Locator. The XML profile behind this class tells you the name of this machine, where is the service runs, and runs (TCP or HTTP) and port number in the channel (port number). In order to make it more efficient, you can simply read only one configuration information and make sure that the class is only one instance in the application domain. A GetService () method will use the service name as a parameter and return to the service object. It will be in contact with the remote object of Service Locator, and then call a method in the controller to get the requested service. And other services Conne contact service also includes data source registration (Data-Source Registry), Logger Service and Security Service. Data Source Registration Service is used to provide definitions of all data sources. Such information is primarily located in program configuration information such as Web.config. This method has two problems. First, the user ID and password included in the configuration file are not secure; second, any data source may be shared by several programs. Therefore, it is best to store these data source information (such as username, user ID, password, server, and database), such as in XML file or Active Directory (AD). Data Source Registration Service You can read this information at startup and transfer their definition to the requested application. If you add any new data to this XML file, you can easily restart it.

The log service provides a centralized tool to record a large number of information from the application, which can help you track questions in the program. This set of logs allows you to change the level (debugging, warning, information) that performs log records for the program. You can use an Open-Source log package called log4net to implement this function (see resources). You can implement a service packaging suitable for this architecture.

Security Service is necessary to provide authentication and user licensing. It can identify users through AD and confirm that the user has access to the application. If the user is confirmed to access, the security service reads the role of the user and all license information related to this role.

It is necessary to implement a service and other service. For example, if you have a log service that records a message to a log file and database, you may want to use it in all services. You can activate this call connection by incorporating the ServiceContext object in the service in initialization. This serviceContext object contains a method called getService (), which can use the name of the service and returns the service object. It is important to all of these services run in an identical process and an identical application domain. As a result, the call between the service contains a simple local program call and does not involve remote. If a service tries to use other service at startup, then you will ensure that the target service is listed in the XML configuration file.

You can use the service in many places to use the Service, mainly to see what features are provided, if the service provides some things that can be used for display layers, call it from the display layer. You can call services such as credit card processing from the business logic layer. Other tool components provided by the Application Framework can use some service, such as a data source to register a service. It is important to learn when to call a service from a program, which is accessed by .NET Remoting, not as fast as the local program calls. You must never want to turn all the components in the architecture into a service. If your components do not consume memory when starting, then it doesn't have to become a service. Since all services are included in all services, you may need to modify this information, you may also want to terminate the service and make it temporarily invalid or restart it. Fortunately, you can use ASP.NET or WINFORM to create a service-manager application to provide interfaces that perform these features. Since these configuration information are XML format, this Service-Manager program can provide an XML editing tool to modify these configurations. The configuration information is loaded by the controller when starting, so you can modify it in the memory and save it to the XML file when you need it. The Service Manager is also capable of providing a tool that starts and stops Service. If you develop it as an ASP.NET program, you can configure all services through your browser without having to access the server at the operating system layer.

The development of enterprise applications is quite complicated, so you must start the development of each .NET program. You can develop a good application framework by speaking some time and energy to increase the productivity of the developer.

转载请注明原文地址:https://www.9cbs.com/read-116763.html

New Post(0)