Java Service Governance approach

Source: Internet
Author: User

Before a large-scale service, the application may simply expose and reference remote services through tools such as RMI or Hessian, call through the URL address of the configuration service, and load balance through hardware such as F5.

(1) With more and more services, service URL configuration management becomes very difficult, and the F5 hardware load Balancer's single point of pressure is getting bigger.

At this point, a service registry, dynamic registration and discovery services are required to make the location of the service transparent.

It also reduces the reliance on the F5 hardware load balancer by obtaining a list of service provider addresses in the consumer, which can reduce the partial cost.

(2) When further development, inter-service dependencies become a complex, even unclear which application to start before which application, the architect can not fully describe the application's architectural relationship.

At this point, you need to automatically draw a dependency graph between applications to help the architect clean up the relationship.

(3) Then, the service is more and more calls, the capacity of the service problem is exposed, how much machine support this service needs? When should I add a machine?

To solve these problems, the first step is to count the number of calls and response times for the service now, as a reference for capacity planning.

Secondly, to be able to dynamically adjust the weight, on-line, the weight of a machine has been increased, and in the process of increasing the time to record the change in response times, until the response time to reach the threshold, record the amount of traffic at this time, and then the amount of this traffic multiplied by the number of machines to push back total capacity.

(4) Scale continues to expand, the application is no longer a flat correspondence relationship, start layering, such as the core data layer, business integration layer, even if there is no cyclic dependence, nor allow from the lower level to rely on, so as to avoid the subsequent forced cyclic dependence.

At this point, you need to define the architecture in the registry, define which layers are defined, and when each service is exposed or referenced, you must declare which tier your application belongs to, so that the registry can quickly discover the corruption of the architecture.

(5) More services, communication costs also began to rise, the transfer of a service failed to find who? What are the conventions for the parameters of the service?

At this point you need to register who is responsible for each service, and create a service document library for easy retrieval.

(6) Slowly some of the sensitive data are also served, security issues began to become important, who can adjust the service? How to authorize?

Such a service may require a password, access to take this password, but if the password, to change the password, it will be very inconvenient, all consumers have to change, so the dynamic generation of tokens (tokens) may be better, the provider will be licensing the registration center, by the registry to determine whether to sue the consumer, This makes it possible to make a complex authorization model on the Registry page.

(7) Even if the service is not sensitive, and can not be arbitrarily invoked, such as a service suddenly more than a consumer, the demand of the consumer directly to the service to drag across, other consumers follow a failure.

First, the service provider needs to flow control, when the process exceeds the standard, can reject part of the request, self-protection.

Second, consumers pre-launch and the provider agreed to the service quality level agreement (SLA), the SLA includes the consumer commitment to daily call volume, request data volume, provider commitment response time, error rate, etc., the SLA recorded in the Monitoring Center, timing and monitoring data comparison, exceeding the alarm.

(8) Although there are SLA agreements, if not control, just gentlemen's agreement, how to ensure the quality of service?

For example: An application is important, a less important, they call the same service, the service should be tilted to important applications, rather than the same, when the support, should limit the access of non-critical applications, to ensure the availability of important applications, how to do this. At this point, service routing is required to control different applications to access different machines, such as:
Application Separation:
consumer.application = foo = Provider.host =
Consumer.application! = Foo = Provider.host = 5,6
Read/write Separation:
Method.name = find*,get* = Provider.host =
Method.name! = find*,get* = Provider.host = 5,6

(9) After the service on-line, need to verify that the service is available, but because of firewall restrictions, offline is not able to access online services, have to write a test main, and then put on the line to execute, very troublesome, and easy to forget the verification.

So there needs to be a self-running validator on the line, and the user simply fills in the interface with the service method to be validated, as well as the parameter value and expected return value, and when a service provider goes online, the use case is automatically run and the result is emailed to the owner.

(10) Service Application and Web application is different, it is a background daemon program, do not need a web container such as Tomcat. However, because of the company's previous web-based application, the specification is based on the Web application, so the service must be run in a fundamentally unused web container, and a Web project like this is also very troublesome.

So you need to implement a non-web container, simply load the spring configuration with main, and provide MAVEN template engineering, just mvn dubbo:generate to create a perfectly formed service app.

(11) More and more people develop services, focus on development efficiency, IDE integration support is essential.

With plugins, you can run the service directly in Eclipse, where the provider can directly fill in the test data test service, and the consumer can directly mock the service without relying on the provider development.

(12) Because the exposure service is very simple, the service is more and more casual, sometimes responsible for service architects do not know someone on-line a service, so that the online service is a mixed bag, and even the recurrence of services, and service offline than on-line is difficult.

Need a new service on-line approval process, must be approved by a service architect before you can go online.

When the service is offline, it should be identified as obsolete, and then notify the caller to modify the call as soon as possible until no one calls this service to go offline.

(13) Due to the experience of service interface design has been slowly accumulated in the process, a lot of interfaces can not be a promotion and time, in the process of modification, how to ensure compatibility, how to determine compatibility? In addition, is the deeper, business behavior compatible?

Depending on the protocol type used, it is possible to analyze the compatibility of interfaces and domain model changes, such as: Contrast plus minus fields, method signatures, and so on.

On the business, it may be necessary to form technology compatibility Kit (TCK) based on an automated regression test case to ensure a compatible upgrade.

(14) With the service upgrade, there are always some unexpected things happen, such as the cache is wrong to lead to memory overflow, failure is unavoidable, each time the core services a hanging, affecting a large, people flustered panic, how to control the impact of the fault surface? is the service capable of degrading functionality? or resource deterioration?

Inter-application claims rely on strength, which features are strongly dependent on, which weak dependencies are then based on dependency strength, calculate the impact polygons, and periodically test the review to enhance service optimization and fault tolerance on critical paths, and clean up services that should not be on critical paths.

Provide fault-tolerant mock data, mock data should also be able to be issued in the registry at runtime, when a service is not available, using mock data instead, can reduce the occurrence of failures, such as a verification service, when the right to check the service is all hung, directly return false indicates that there is no permission, and print error log alarms.

In addition, the front-end page should be degraded by the portal, when the portal does not get data, directly hidden, or replaced with other modules to display, and provide functional switches, can manually intervene whether to show, or limit how much traffic can be displayed.

(15) When there are many small services, it may be necessary to combine a large number of small services, to this end, have to add a middle tier, exposing a new service, there are other small services, such as the new service business logic less, but bring a lot of development workload.

At this point, a service orchestration engine is required, with a simple process engine built-in, simply using XML or a DSL to declare how the service is aggregated, the registry can be issued directly to the consumer to perform the aggregation logic, or deploy a generic orchestration server, all requests have Orchestration server forwarding.

(16) Not all services have a large number of visits, many services are only a tiny amount of traffic, but need to deploy two service-providing machines, ha interoperability, how to reduce wasted machines.

At this point, you may want to allow the service container to support deploying multiple applications on a single machine, either with multiple JVM isolation or with ClassLoader isolation.

(17) Multiple applications if not a team developed, deployed on a machine, it can be mistaken operation, to stop the service of others.

Therefore, automatic deployment is required, and all deployments require no manual interference, preferably one-click deployment.

(18) How to improve machine utilization when the machine is always idle and busy, or if redundant machines are in disaster prevention?

That is, it can be automatically deployed, according to the monitoring data, you can implement resource scheduling, according to the pressure of the application, automatically add the machine and deploy.

If your application is international, there are Chinese stations, such as the United States, because of the time difference, the United States station of the machine at night, it may be the Chinese station busy during the day, can be through resource scheduling, automatic provisioning and deployment of the two sides of the application.

By keywords summed up as:

1. Service Registration and Discovery

2. Soft load balancing and fault tolerance

3. Service Monitoring and statistics

4. Service Capacity Assessment

5. Service on-line approval

6. Service Offline notification

7. Service Leader

8. Service Documentation

9. Service Routing

10. Service Orchestration

11. Service Black and white list

12. Service Rights control

13. Service Dependencies

14. Service Tiering Architecture

15. Service Call chain tracking

16. Fault conduction analysis

17. Service downgrade

18. Service Level Agreements

19. Service Automated Testing

20. Service Camouflage Fault Tolerance

21. Service Compatibility detection

22. Service Usage Report

23. Dynamic adjustment of service weights

24. Service Load Balancing Adjustment

25. Service Mapping

26. Service Template Engineering

27. Service Development IDE

28. Service Health Testing

29. Service Container

30. Automatic deployment of services

31. Service Resource Scheduling

Java Service Governance approach

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.