Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Spring cloud (8): the Application of Turbine

2025-02-22 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/03 Report--

1. Concept

Turbine is a tool for aggregating server event stream data to monitor hystrix metrics in clusters.

2. Introducing dependencies

org.springframework.cloud

spring-cloud-netflix-turbine

3. Create an application

TurbineApplication

@SpringBootApplication

@EnableTurbine

public class TurbineApplication {

public static void main(String[] args) {

new SpringApplicationBuilder(TurbineApplication.class).web(true).run(args);

}

}

4. Corresponding configuration information

server.port=8031

spring.application.name=turbine

turbine.appConfig=app01,app02

turbine.aggregator.clusterConfig= app

turbine.clusterNameExpression= metadata['cluster']

turbine.appConfig Configure apps that need aggregation

turbine.aggregator.clusterConfig turbine The cluster name that needs to be aggregated via turbine.stream? cluster=app Access

turbine.clusterNameExpression Gets the cluster name expression, which means to get cluster data in metadata. App01 and app02 are the corresponding configuration information.

5. Create EurekaServer service

6. Create an app01

@Configuration

@EnableAutoConfiguration

@EnableDiscoveryClient

@EnableCircuitBreaker

@RestController

public class App01 {

public static void main(String[] args) {

SpringApplication.run(App01.class, args);

}

@Autowired

private HelloService service;

@RequestMapping("/")

public String hello() {

return this.service.hello();

}

@Component

public static class HelloService {

@HystrixCommand(fallbackMethod = "fallback")

public String hello() {

return "Hello World";

}

public String fallback() {

return "Fallback";

}

}

}

Corresponding configuration:

server.port= 8091

spring.application.name=app01

eureka.instance.hostname=localhost

eureka.instance.metadata-map.cluster=app

7. Create an app02

Corresponding configuration:

server.port= 8092

spring.application.name=app02

eureka.instance.hostname=localhost

eureka.instance.metadata-map.cluster=app

8. Register the three applications to Eureka Server at the same time, and then start the market service. Enter http://localhost:9031/www.example.com in the market service. turbine.stream? cluster=app Get monitoring interface;

9. Meaning of each indicator of monitoring interface

Circle color and size: health and flow

Broken line: throughput change in 2 minutes

hosts: Number of nodes in the cluster

median: Median time per request

mean: Average time spent per request

subscriberGetAccount:

Green 200545: Number of successful requests

Blue 0: represents the number of open circuits

Yellow 19: Number of threads representing table timeout

Purple 94: represents the number of thread pool rejections, i.e. insufficient threads

Red 0: Number of failures or exceptions

Gray 0%: Last 10 seconds error rate

host: Average request throughput per second for each node

cluster: request throughput per second of cluster

circuit: represents the status of the circuit breaker, i.e. whether to open the circuit breaker 90th, 99th, 99.5th:

Percentage of various delays in the last 1 minute. 90% of requests are less than 10ms; 99% of requests are less than 44ms, and 99.5% of requests are completed in 61 ms.

10. Summary

Turbine can monitor the request volume of the cluster and know the peak period of the system, so as to better know where the shortcomings of the system are.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report