Coherence在extend模式下,proxy的负载均衡机制官方解释是

Extend client connections are load balanced across proxy service members. By default, a proxy-based strategy is used that distributes client connections to proxy service members that are being utilized the least. Custom proxy-based strategies can be created or the default strategy can be modified as required. As an alternative, a client-based load balance strategy can be implemented by creating a client-side address provider or by relying on randomized client connections to proxy service members. The random approach provides minimal balancing as compared to proxy-based load balancing.

Proxy-based load balancing is the default strategy that is used to balance client connections between two or more members of the same proxy service. The strategy is weighted by a proxy's existing connection count, then by its daemon pool utilization, and lastly by its message backlog.

The proxy-based load balancing strategy is configured within a  definition using a  element that is set to proxy. For clarity, the following example explicitly specifies the strategy. However, the strategy is used by default if no strategy is specified and is not required in a proxy scheme definition.

说的比较模糊,在weblogic作为前端来连入后台coherence cluster的情况下,我们模拟实际的生产环境,看一看实际的运作

针对proxy节点的proxy-override.xml

*

distributed-scheme

distributed-scheme

DistributedCache

50

1

LocalSizeLimited

true

false

LocalSizeLimited

LRU

500

BINARY

1048576

48h

ExtendTcpProxyService

10

192.168.0.101

9099

proxy

true

针对storage节点的storage-override.xml

POFSample

distributed-pof

distributed-pof

DistributedCache

50

true

true

针对客户端的client.xml

*

extend-dist

extend-dist

ExtendTcpCacheService

192.168.0.101

9100

192.168.0.101

9099

10s

5s

另外一个客户端的配置文件client-2.xml

*

extend-dist

extend-dist

ExtendTcpCacheService2

192.168.0.101

9099

192.168.0.101

9100

10s

5s

通过proxy-server.cmd启动两个proxy节点,会监听在9099和9100端口

"%java_exec%" -server -showversion -Dtangosol.coherence.mode=prod -Dtangosol.coherence.management.remote=true -Dtangosol.coherence.cacheconfig=E:\wls12c\coherence\bin\proxy-override.xml %java_opts% -cp "%coherence_home%\lib\coherence.jar" com.tangosol.net.DefaultCacheServer %*

通过storage-cmd启动一个storage节点

"%java_exec%" -server -showversion -Dtangosol.coherence.mode=prod -Dtangosol.coherence.management.remote=true -Dtangosol.coherence.management=all %java_opts% -Dtangosol.coherence.cacheconfig=E:\wls12c\coherence\bin\storage-override.xml -cp "%coherence_home%\lib\coherence.jar" com.tangosol.net.DefaultCacheServer %*

在weblogic的setDomainEnv.cmd文件中加入

set JAVA_OPTIONS=%JAVA_OPTIONS% -Dtangosol.coherence.cacheconfig="E:\wls12c\coherence\bin\client.xml" -Dtangosol.coherence.tcmp.enabled=false

set CLASSPATH=E:\wls1212\coherence\lib\coherence.jar;%CLASSPATH%

然后部署一个web应用,核心是一个jsp文件coput.jsp,批量放入10000个对象

/p>

"http://www.w3.org/TR/html4/loose.dtd">

setName

String mysession;

//private final ClassLoader loader = null;

NamedCache cache12;

cache12 = CacheFactory.getCache("POFSample");

for (int i=0;i<10000;i++) {

//String key = "hello";

cache12.put (i, "CacheValue=eric"+i);

}

%>

put 10000 records success.........

启动weblogic访问,主要连到了9099的proxy server

没有压力的时候,通过jvisualvm监控的proxy的线程如下,可以看到有每个都有10个空闲线程:

通过jmeter运行20个线程的压力,压力主要压在weblogic server

压力上来时候线程如下

可以看到当空闲线程为0,并且有6个在backlog等待时,都没有分到另外一个proxy.

结论如下:

Coherence将weblogic server的一个实例当成是一个客户端,并不是基于这个客户端内部的thread进行负载均衡(这不是bug,而是产品设计如此)

WebLogic Server和Coherence建立的是长连接,除非在超时时间外没有线程访问会断开,在压力比较大的时候,weblogic server会一直用这个连接,并不管这个连接是否已经用完。

Proxy设置的线程数是有限的,最大512条,proxy占用的资源也是有限的,在压力大的时候可能这个proxy会缓慢甚至挂掉,所以最好的办法还是要把压力分散到不同的proxy上面去。

但当多个weblogic实例上来时会进行负载均衡。严格来说,coherence集群是按照client端的NIC和port进行负载均衡的。

修改coput.jsp如下:

也就是会根据不同的thread id,选择加载不同的xml,实现均分。

/p>

"http://www.w3.org/TR/html4/loose.dtd">

setName

String mysession;

//private final ClassLoader loader = null;

NamedCache cache12;

ConfigurableCacheFactory factory1 = null;

int threadid = (int)Thread.currentThread().getId();

System.out.println("Thread id="+ threadid);

if ((threadid % 2) == 0) {

factory1 = new DefaultConfigurableCacheFactory("E:\\wls12c\\coherence\\bin\\client-2.xml", Thread.currentThread().getClass().getClassLoader());

} else {

factory1 = new DefaultConfigurableCacheFactory("E:\\wls12c\\coherence\\bin\\client.xml", Thread.currentThread().getClass().getClassLoader());

}

cache12 = factory1.ensureCache("POFSample", Thread.currentThread().getClass().getClassLoader());

for (int i=0;i<10000;i++) {

//String key = "hello";

cache12.put (i, "CacheValue=eric"+i);

}

%>

put 10000 records success.........

再次进行压力测试,如下:

可以看到压力以及分在两个proxy上.

后台weblogic日志,在根据threadid调用.

coherence mysql_Coherence代理的负载均衡相关推荐

  1. 懂点 Nginx 反向代理与负载均衡,是面试加分项没有之一

    点击上方"方志朋",选择"置顶公众号" 技术文章第一时间送达! 学到老活到老 前端圈一直很新,一直要不停的学习,而且在进入大厂的路上,还要求熟悉一门后台语言等等 ...

  2. 介绍下Nginx 反向代理与负载均衡

    Nginx的代理功能与负载均衡功能是最常被用到的,这篇就开门见山,先描述一些关于代理功能的配置,再说明负载均衡详细. Nginx 代理服务的配置说明 1.设置 404 页面导向地址 error_pag ...

  3. 使用Nginx实现服务器反向代理和负载均衡

    前言 同事总问我Nginx做反向代理负载均衡的问题,因此特意留下一篇扫盲贴! 直接部署服务器的风险 假设,我开发了一个网站,然后买了一台Web服务器和一台数据库服务器,直接部署到公共网络上.如下图,网 ...

  4. Nginx之反向代理与负载均衡实现动静分离实战

    Nginx之反向代理与负载均衡实现动静分离实战 什么是反向代理与负载均衡 Nginx仅仅作为Nginx  proxy反向代理使用的,因为这个反向代理功能表现的效果是负载均衡集群的效果. 负载均衡指的是 ...

  5. nginx的反向代理及负载均衡

    查看内核版本号: uname  -r 查看Linux发行版本 :cat /etc/issue 或cat /etc/release 查看bash 版本 : bash  --version <?xm ...

  6. nginx反向代理相关 负载均衡及优化

    一.反向代理 1.1.upstream简介 nginx的upstream可以同时实现反向代理和负载均衡,目前upstream支持5种方式的分配 1.轮询(默认) 每个请求按时间顺序逐一分配到不同的后端 ...

  7. 微服务部署HTTP反向代理、负载均衡工具Træfɪk

    from: https://docs.traefik.cn/ Træfɪk 是一个为了让部署微服务更加便捷而诞生的现代HTTP反向代理.负载均衡工具. 它支持多种后台 (Docker, Swarm, ...

  8. nginx的反向代理以及负载均衡模块的使用

    内容: 1.何为代理 2.nginx的反向代理模块以及使用 3.nginx的负载均衡模块以及使用 一.何为代理 代理,由字面意思可以理解为代为服务的是意思. 代理服务技术是一门很古老的技术,是在互联网 ...

  9. Nginx-从零开始使用nginx实现反向代理及负载均衡

    文章目录 环境说明 安装Nginx 安装必须的依赖库 3个 源码安装 yum安装 安装nginx 启动Nginx 常用操作命令 使用非root用户启动nginx 搭建应用 Nginx 做反向代理 + ...

  10. Nginx入门教程-简介、安装、反向代理、负载均衡、动静分离使用实例

    场景 Nginx入门简介和反向代理.负载均衡.动静分离理解 https://blog.csdn.net/BADAO_LIUMANG_QIZHI/article/details/102790862 Ub ...

最新文章

  1. 恭喜你们,碰到了问题
  2. javascript检测对象中是否存在某个属性判断方法小结
  3. arm remapping控制输入_解析机器视觉中运动控制卡与PLC的区别
  4. Power Strings_JAVA
  5. Flutter 调用地图软件(高德、百度、腾讯、苹果)同时实现另类国际化
  6. 使用WildFly和Java EE 7映像与Docker提供者一起流浪
  7. python整数预测_时间序列预测全攻略(附带Python代码) | 36大数据
  8. 使用libjpeg进行JPEG图像解码
  9. 识别浏览器的JavaScript引擎的方法
  10. Ubuntu-mv,cp 命令
  11. 单片机 MSP430 G2553 F5529 蜂鸣器 音乐 音乐播放器
  12. 对接ERP和MES,使用低代码定制生产计划管理(APS)系统
  13. 统计APP下载量--发现安卓下载大文件使用多线程下载方式
  14. python写窗体程序_python写窗口
  15. 虚拟机NAT模式的网络设置
  16. <MySQL>表中添加和删除字段
  17. 单代号网络图计算例题_工程人如何绘制进度计划?(双代号网络图、横道图等)...
  18. 论文笔记:WWW 2019 Heterogeneous Graph Attention Network
  19. fcpx:ProTrailer PrimeTime for Mac(60个电影预告宣传片3D文字大标题)
  20. [Maven实战](9)传递性依赖

热门文章

  1. Html5中,input标签所有Type类型介绍
  2. 自适应中值滤波器和自适应局部(均值)滤波器的设计 python+matlab各实现
  3. 诗歌九 声律启蒙(云对雨,雪对风,晚照对晴空)
  4. 流量卡之家:物联网僵尸网络和DDoS攻击:构建网络风险防火墙
  5. MT8516芯片原理图资料(6MIC_RESERVE_4MIC_ARRA)
  6. VMware Esxi 下载地址
  7. Python微信自动回复脚本
  8. 冯 • 诺依曼体系结构
  9. 三四线城市的房地产泡沫率先崩盘?
  10. iPhone 13不会自动锁屏该怎么解决?