最新评论 (0)


The Internet: Packets, Routing and Reliability

互联网科普系列:包 路由器与可靠性
[song counts down: 7, 6, 5, 4, 3, 2, 1] The Internet: Packets, Routing, and Reliability
大家好 我是林恩 目前是Spotify(全球最大串流音乐服务商)的一名软件工程师
Hi, my name is Lynn. I’m a software engineer here at Spotify and I’ll be the first to admit
首先 我招认我经常将互联网可靠性视为理所当然
that I often take for granted the reliability of the internet. The sheer amount of information
庞大的信息量在互联网中嗡嗡活动是惊人的但是 每一份数据是如何可靠地发送给你的
zooming around the internet is astonishing. But how is it possible for every piece of
data to be delivered to you reliably? Say you want to play a song from Spotify. It seems
like your computer connects directly to Spotify servers and Spotify sends you a song on a
但是 事实上 那不是互联网工作的方式
direct, dedicated line. But actually, that’s not how the internet works. If the internet
were made of direct, dedicated connections it would be impossible to keep things working
不可能仍保持工作 特别是不能保证每一条电线 每一台电脑持续工作
as millions of users join. Especially since there is no guarantee that every wire and
相反 网上传输数据很少以直达的形式
computer is working all the time. Instead, data travels on the internet in a much less
许多年前 大概是二十世纪七十年代早期
direct fashion. Many many years ago, in the early 1970s my partner Bob Kahn and I began
我和我的搭档Bob Kahn开始设计现在所谓的互联网
working on the design of what we now call the internet. Bob and I had the responsibility
and the opportunity to design the internet’s protocols and its architecture. So we persisted
因此 我们一直坚持参与互联网的成长和演变过程 包括现在
in participating in the internet’s growth and evolution for all of this time up to and
including the present. The way information gets transferred from one computer to another
它不需要固定的路径 事实上 在电脑间会话时
is pretty interesting. It need not follow a fixed path, in fact, your path may change
你的路径可能改变 网络信息从一台电脑到另一台电脑
in the midst of a computer to computer conversation. Information on the internet goes from one
computer to another in what we call a packet of information and a packet travels from one
place to another on the internet a lot like how you might get from one place to another
由于交通堵塞或道路状况 每次你出行时
in a car. Depending on traffic congestion or road conditions, you might choose or be
forced to take a different route to get to the same place each time you travel. And just
并且 正如你可以用车运输各种物品一样
as you can transport all sorts of stuff inside a car, many kinds of digital information can
各种数字信息都可以用IP包来传输 但是也有些限制
be sent with IP packets but there are some limits. What if for example you need to move
例如 假设你需要将航天飞机从工厂移动到发射台
a space shuttle from where it was built to where it will be launched. The shuttle won’t
它并不适合放在卡车里运输因此它需要被拆分为零件 使用一队卡车来运载
fit in one truck so it needs to be broken down into pieces, transported using a fleet
它们可能会走不同的路线 并且可能在不同的时间到达目的地
of trucks. They could all take different routes and might get to the destination at different
一旦所有部件全部抵达 就能重新将这些部件组装为完整的航天飞机
times. But once all the pieces are there, you can reassemble the pieces into the complete
准备就绪后 就可以发射了在互联网中 数据以相似的方式工作
shuttle and it will be ready for launch. On the internet the details work similarly. If
如果你想发送一副很大的图片给你的朋友 或者上传到网站
you have a very large image that you want to send to a friend or upload to a website,
that image might be made up of 10s of millions of bits of 1s and 0s, too many to send along
太多了以至于不能用一个包发送 因为它的数据在电脑上
in one packet. Since it’s data on a computer, the computer sending the image can quickly
break it into hundreds or even thousands of smaller parts called packets. Unlike cars
不像汽车或卡车 这些数据包没有司机 不能选择自己的路线
or trucks these packets don’t have drivers and they don’t choose their route. Each packet
has the internet address of where it came from and where it’s going. Special computers
互联网中特殊的电脑叫做路由器 它就像一个交警一样保证数据包可以顺利的通过网络来移动
on the internet called routers act like traffic managers to keep the packets moving through
如果一条路线堵塞了 每个包都可能会选择不同的路线
the networks smoothly. If one route is congested, individual packets may travel different routes
through the internet and they may arrive at the destination at slightly different times
or even out of order. Let’s talk about how this works. As part of the internet protocol,
作为互联网协议的一部分 每个路由器跟踪发送出的数据包的每条途径
every router keeps track of multiple paths for sending packets, and it chooses the cheapest
available path for each piece of data based on destination IP address for the packet.
这种情况下 最佳不意味着开销而是时间和一些非技术因素 例如公司间的政治关系等
Cheapest in this case doesn’t mean cost, but time and non-technical factors such as politics
通常 数据最佳路线不一定是直接到达
and relationships between companies. Often the best route for data to travel isn’t necessarily
the most direct. Having options for paths makes the network fault tolerant. Which means
那意味着即使出现相当可怕的错误 网络仍可以继续发送数据包
the network can keep sending packets even if something goes horribly, horribly wrong.
This is the basis for a key principle of the internet: reliability. Now, what if you want
现在 如果你想要一些数据但是并不是所有数据都被发送会怎么样? 假如你想要听歌
to request some data and not everything is delivered? Say you want to listen to a song.
怎样才能100%确保接收到所有的数据 歌曲可以完美的播放呢?
How can you be 100% sure all the data will be delivered so the song plays perfectly?
给大家介绍一个新的最佳好友 TCP(传输控制协议)
Introducing your new best friend, TCP (transmission control protocol). TCP manages the sending
TCP负责发送并接收你数据包中的全部数据 有点儿像挂号信服务
and receiving of all your data as packets. Think of it like a guaranteed mail service.
当你在你的设备上请求一首歌时 音乐服务网站将歌拆分为许多数据包发送出去
When you request a song on your device, Spotify sends a song broken up into many packets.
当你的数据包到达时 TCP核对全部清单 返回确认
When your packets arrive, TCP does a full inventory and sends back acknowledgements
表示每个数据包均已收到 如果所有的数据包都已到达 TCP签收 然后你就可以放歌了
of each packet received. If all packets are there, TCP signs for your delivery and you’re
如果TCP发现某些数据包丢失了 它就不会签收
done. (song plays) If TCP finds some packets are missing, it won’t sign, otherwise your
你的歌就不能完美地播放 或者歌曲的部分会丢失
song won’t sound as good or portions of the song could be missing. For each missing or
对于每个丢失的或不完整的数据包 音乐服务网站会重新发送 一旦TCP核实了接收到了被请求歌曲数据包
incomplete packet, Spotify will resend them. Once TCP verifies the delivery of many packets
for that one song request, your song will start to play. What’s great about the TCP
它们拥有可扩展性 可以同时处理8台或8百万台设备
and router systems is they’re scalable. They can work with 8 or 8 billion devices. In fact,
事实上 因为容错性和冗余性原则 我们添加越多点路由器
because of these principles of fault tolerance and redundancy, the more routers we add the
互联网就越可靠另一个伟大之处在于 我们可以扩展互联网的同时
more reliable the internet becomes. What’s also great is we can grow and scale the internet
without interrupting service for anybody using it. The internet is made of hundreds of thousands
of networks and billions of computers and devices connected physically. These different
这些不同的系统使得互联网彼此连接 相互交流 一起工作的原因是
systems that make up the internet connect to each other, communicate with each other,
and work together because of agreed upon standards for how data is sent around on the internet.
计算设备 或路由器 沿着网络帮助数据到达它们指定的位置
Computing devices, or routers along the internet, help all the packets make their way to the
如果必要的话 按顺序排好
destination where they’re reassembled, if necessary, in order. This happens billions
用户发送电子邮件 浏览网页 视频聊天
of times a day, whether you and others are sending an email, visiting a web page, doing
使用手机APP 或者当传感器 设备之间互相通信时数据传输这件事
a video chat, using a mobile app, or when sensors or devices on the internet talk to
each other.