技术开发 频道

Kamus详解RAC环境中的负载均衡

  当某个实例的监听收到客户端连接请求,将会统筹考虑RAC环境中各个节点的负载情况,然后将该连接传递到具有最小负载的节点的最小负载实例上。

  1. Instance_A is locally registered with Listener_A and remotely registered with Listener_B. Instance_B is registered locally with Listener_B and remotely with Listener_A.

  2. Client connection #1 goes to Listener_A. Based on load information provided by PMON, Listener_A routes the incoming client to the locally registered instance, Instance_A.

  Listener_A.log:

  13-FEB-2004 11:05:02 * (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=prod)

  (CID=(PROGRAM=)(HOST=clienthost)(USER=oracle))) *

  (ADDRESS=(PROTOCOL=tcp)(HOST=10.10.10.10)(PORT=20108)) * establish * prod * 0

  1. client connection #2 goes to Listener_A. With updated load information provided by PMON, Listener_A routes the client to the remotely registered instance, Instance_B.

  Listener_A.log:

  13-FEB-2004 11:05:02 * (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=prod)

  (CID=(PROGRAM=)(HOST=clienthost)(USER=oracle))) *

  (ADDRESS=(PROTOCOL=tcp)(HOST=10.10.10.10)(PORT=20108)) * establish * prod * 0

  Listener_B.log:

  13-FEB-2004 11:05:02 * (CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=prod)

  (CID=(PROGRAM=)(HOST=clienthost)(USER=oracle))(INSTANCE_NAME=Instance_B)) *

  (ADDRESS=(PROTOCOL=tcp)(HOST=10.10.10.10)(PORT=20110)) * establish * prod * 0

  在10gR2版本之后,节点和实例的负载计算通过lbscore来完成.这样可以改善Call Storm场景下负载不均衡的现象。

  可以通在sqlnet.ora文件中添加监听的trace(TRACE_LEVEL_LISTENER = 16)来获取lbscore的产生情况。

  lbscore由两个动态值决定:”goodness” 和 “delta”,这两个值均由PMON来定期更新,计算公式如下:

Lbscore = Goodness (Received from PMON update)
Delta
= New Delta (Received from PMON update)

  在PMON定期更新的间隔,应对于每个新连接的建立,监听会自己更新Lbscore,计算公式是:

Listener Lbscore = Lbscore(previous) + Listener Delta。
0
相关文章