带复制的基于局部性最少链接(Locality-Based Least Connections with Replication Scheduling)
2008-11-05 22:46
537 查看
带复制的基于局部性最少链接调度(Locality-Based Least Connections with Replication Scheduling,以下简称为LBLCR)算法也是针对目标IP地址的负载均衡,目前主要用于Cache集群系统。它与LBLC算法的不同之处是它要维护从一个目标IP地址到一组服务器的映射,而LBLC算法维护从一个目标IP地址到一台服务器的映射。对于一个“热门”站点的服务请求,一台Cache 服务器可能会忙不过来处理这些请求。这时,LBLC调度算法会从所有的Cache服务器中按“最小连接”原则选出一台Cache服务器,映射该“热门”站点到这台Cache服务器,很快这台Cache服务器也会超载,就会重复上述过程选出新的Cache服务器。这样,可能会导致该“热门”站点的映像会出现在所有的Cache服务器上,降低了Cache服务器的使用效率。LBLCR调度算法将“热门”站点映射到一组Cache服务器(服务器集合),当该“热门”站点的请求负载增加时,会增加集合里的Cache服务器,来处理不断增长的负载;当该“热门”站点的请求负载降低时,会减少集合里的Cache服务器数目。这样,该“热门”站点的映像不太可能出现在所有的Cache服务器上,从而提供Cache集群系统的使用效率。
LBLCR算法先根据请求的目标IP地址找出该目标IP地址对应的服务器组;按“最小连接”原则从该服务器组中选出一台服务器,若服务器没有超载,将请求发送到该服务器;若服务器超载;则按“最小连接”原则从整个集群中选出一台服务器,将该服务器加入到服务器组中,将请求发送到该服务器。同时,当该服务器组有一段时间没有被修改,将最忙的服务器从服务器组中删除,以降低复制的程度。LBLCR调度算法的流程如下:
LBLCR调度算法流程
假设有一组服务器S = {S0, S1, ..., Sn-1},W(Si)表示服务器Si的权值, C(Si)表示服务器Si的当前连接数。ServerSet[dest_ip]是一个关联变量,表示 目标IP地址所对应的服务器集合,一般来说它是通过Hash表实现的。WLC(S)表示 在集合S中的加权最小连接服务器,即前面的加权最小连接调度;WGC(S)表示在 集合S中的加权最大连接服务器。Now为当前系统时间,lastmod表示集合的最近 修改时间,T为对集合进行调整的设定时间。 if (ServerSet[dest_ip] is NULL) then { n = WLC(S); if (n is NULL) then return NULL; add n into ServerSet[dest_ip]; } else { n = WLC(ServerSet[dest_ip]); if ((n is NULL) OR (n is dead) OR (C(n) > W(n) AND there is a node m with C(m) < W(m)/2))) then { n = WLC(S); if (n is NULL) then return NULL; add n into ServerSet[dest_ip]; } else if (|ServerSet[dest_ip]| > 1 AND Now - ServerSet[dest_ip].lastmod > T) then { m = WGC(ServerSet[dest_ip]); remove m from ServerSet[dest_ip]; } } ServerSet[dest_ip].lastuse = Now; if (ServerSet[dest_ip] changed) then ServerSet[dest_ip].lastmod = Now; return n;
此外,对关联变量ServerSet[dest_ip]也要进行周期性的垃圾回收(Garbage Collection),将过期的目标IP地址到服务器关联项进行回收。过期的关联项是指哪些当前时间(实现时采用系统时钟节拍数jiffies)减去最近使用时间(lastuse)超过设定过期时间的关联项,系统缺省的设定过期时间为24小时。
相关文章推荐
- 基于局部性的最少链接(Locality-Based Least Connections Scheduling)
- CentOS配置MySQL基于日志点的复制Binary Log File Position Based Replication
- mysql同步复制抛Got fatal error 1236 Slave can not handle replication events with the checksum
- mysql基于replication实现最简单的M-S主从复制
- 基于事实证据的进度计划/Evidence Based Scheduling
- mysql同步复制报Slave can not handle replication events with the checksum that master 错误
- Statement based replication with Stored Functions, Triggers and Events
- 17.1.1.7 Setting Up Replication with New Master and Slaves 设置复制对于新的Master和Slaves:
- Mysql 复制 配置详解, Replication with Master/Slave
- mysql同步复制报Slave can not handle replication events with the checksum that master 错误
- 17.1.1.7 Setting Up Replication with New Master and Slaves 设置复制对于新的Master和Slaves:
- Apply SOA Design Patterns with WCF (5) WCF Based ASP.NET DataSouce Control (基于WCF的数据源控件)
- 17.1.1.7 Setting Up Replication with New Master and Slaves 设置复制对于新的Master和Slaves:
- LeetCode OJ:Copy List with Random Pointer(复制存在随机链接的链表)
- Apply SOA Design Patterns with WCF (5) WCF Based ASP.NET DataSouce Control (基于WCF的数据源控件)
- [翻译Joel On Software]基于事实证据的进度计划/Evidence Based Scheduling
- 17.1.1.7 Setting Up Replication with New Master and Slaves 设置复制使用新的master和slaves:
- 17.1.2.1 Advantages and Disadvantages of Statement-Based and Row-Based Replication 基于语句和行的复制的优势和劣势
- 17.1.1.8?Setting Up Replication with Existing Data设置复制使用存在的数据
- DBSCAN(Density-Based Spatial Clustering of Applications with Noise,具有噪声的基于密度的聚类方法)