您当前的位置: 首页 >  负载均衡

一一哥Sun

暂无认证

  • 3浏览

    0关注

    622博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Day17_14_SpringCloud教程之Ribbon负载均衡算法详解

一一哥Sun 发布时间:2019-07-15 13:30:21 ,浏览量:3

Ribbon负载均衡算法详解

本篇教程之前一篇博客的基础之上,工程代码在前一篇博客的代码基础上添加功能.

请参考:https://mp.csdn.net/postedit/95932412

一. 负载均衡实现

1. 自定义负载均衡策略
package com.syc.cloud.config;

import com.netflix.loadbalancer.*;
import org.springframework.cloud.netflix.ribbon.RibbonClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 自定义负载均衡策略
 */
@Configuration
@RibbonClient(name = "eureka-provider")
public class RibbonClientConfig {

    @Bean
    public IRule ribbonRule() {
        System.out.println("            
关注
打赏
1665624836
查看更多评论
0.0766s