博威---云架构决胜云计算

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1611|回复: 0

进程交换和快速交换

[复制链接]
发表于 2008-10-12 07:11:30 | 显示全部楼层 |阅读模式
进程交换和快速交换


进程交换:按包负载
快速交换:按目标负载

1、负载均衡和cisco CEF
   基于目标网络的负载均衡是根据目标地址分配负载。假设到一个网络存在两条路径,那么发往该网络中第一个目标的数据包从第一条路径通过,发往网络中第二个目标的数据包通过第二条路径,发往此网络中第三个目标的所有数据包还通过第一条路径,依此类推。这就是cisco cef使用的缺省负载均衡方式。实际上是按照源目地址对进行负载均衡。所在发往特定目标地址的流量只要源地址相同都会从相同的接口出站,而不同源目地址对的流量可能会从下一个接口出站。

举例子来说,比如主机PC有1、2两条链路联入网络,当依次访问A、B、C、D四个资源访问时,在per-destination情况下是:
A固定走1,B走2,C走3,D走4……
后面可以类推,这样可能在均衡方面做得不是很好。
如果是per-packet方式,无论访问哪一个资源,都是按照包的方式
1,2,1,2,1,2,出去
这样虽然很均衡。但是会有一些应用上的问题
主要是用在load balancing中,load balancing是分为per packet 和 per destination两种类型的
fast switching是对应于per destination的,也就是说对于同样的目标地址,选择的路径是一样的,在这个过程中,路由器最初只lookup routing table一次,然后把学到的route存在一个high speed cache中,以后同样目标地址的包过来就用这个条目以相同的路径发送。这种类型占用少量的cpu,因此叫做fast switching,但是balancing效果在某些情况下不好
process switching是对应于per packet的,也就是说路由器对每一个包都要lookup routing table选择route,因此耗费了cpu资源,因此叫做process(处理) switching,balancing效果好


IOS performs per destination load sharing on exit interfaces configured with fast switching. Fast switching is the default IOS switching mode in some routers.
Fast switching works as follows:
1、When a router switches the first packet to a particular destination, a route table lookup is performed and an exit interface is selected.
2、The necessary data-link information to frame the packet for the selected interface is then retrieved (from the ARP cache, for instance), and the packet is encapsulated and transmitted.
3、The retrieved route and data-link information is then entered into a fast switching cache.
4、As subsequent packets to the same destination enter the router, the information in the fast cache allows the router to immediately switch the packet without performing another route table and ARP cache lookup.
While switching time and processor utilization are decreased, fast switching means that all packets to a specific destination, not source-destination pair, are routed out the same interface. When packets addressed to a different host on the same network enter the router and an alternate route exists, the router may send all packets for that destination on the alternate route. Therefore, the best the router can do is balance traffic on a per destination basis.

Process switching simply means that for every packet, the router performs a route table lookup, selects an interface, and then looks up the data link information. Because each routing decision is independent for each packet, all packets to the same destination are not forced to use the same interface. To enable process switching on an interface, use the command no ip route-cache for IPv4. You don't have to do anything to enable process switching for IPv6. It is enabled by default.
Like many design choices, per packet load balancing has a price. The traffic may be distributed more evenly among the various links than with per destination load balancing, but the lower switching time and processor utilization of fast switching are lost.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|boway Inc. ( 冀ICP备10011147号 )

GMT+8, 2024-11-24 04:59 , Processed in 0.090251 second(s), 16 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表