Hello dear lector, if you are reading this is because everything is working. What I mean by “is working”? Well, you will understand it at the end of this post. Nowadays, if you are one of those people that haven’t studied anything related to Information Technology, this would be like magic or maybe just something that works without knowing what’s going on. A great example is when you write in your web browser an URL, and in a few minutes, you get the page you are requesting. So, where this information comes from, there is someone in another computer sending back responses to this request? Too many questions, right? But don’t worry, we are here to learn.
您好亲爱的讲师,如果您正在阅读这是因为一切正常。 我的意思是“正在工作”? 好吧,您将在本文结尾处理解它。 如今,如果您是尚未研究过与信息技术相关的任何内容的人之一,这就像是魔术,或者只是某种在不知道发生了什么的情况下有效的东西。 一个很好的例子是,当您在Web浏览器中编写一个URL,并在几分钟后,您得到了所请求的页面。 那么,此信息来自何处,另一台计算机中是否有人发回对此请求的响应? 问题太多了吧? 但请放心,我们在这里学习。
In this opportunity, our focus will be on what happens when you type holbertonschool.com in your browser and press enter. I invite you to get comfortable and ready to learn what’s going on under the hood when you request an URL.
借此机会,我们的重点将放在您在浏览器中键入holbertonschool.com并按Enter时会发生什么。 我邀请您开始准备并准备好学习当您请求URL时幕后的情况。
Beginning of magic
乙 eginning的魔法
The communication in society and even in nature has an important role. As an example, both humans and animals use it to transmit information to their equals. The same happens in the IT world. The real power that computers have is communication between them. For this reason, since you get in touch with a computer, you probably have sent information to many others. And currently, this information transmission is done via Bluetooth, wireless connections, or optic fiber (most used).
社会乃至自然界的交流都起着重要作用。 例如,人类和动物都使用它来将信息传递给他们的同等人。 在IT世界中也是如此。 计算机具有的真正功能是它们之间的通信。 因此,由于您与计算机取得联系,因此您可能已将信息发送给许多其他人。 目前,这种信息传输是通过蓝牙,无线连接或光纤(最常用)完成的。
As well as humans and animals use different languages and rules to communicate, the computer also does. In the world of computers, they use something called TCP/IP (stands for Transmission Control Protocol / Internet Protocol). In simple terms, this protocol suite is a set of standardized rules that computers use to communicate over a network (private network or Internet). That means that every computer is a node in a huge network like the Internet or a private network.
人类和动物使用不同的语言和规则进行交流,计算机也一样。 在计算机世界中,它们使用称为TCP / IP(传输控制协议/ Internet协议的缩写)的东西。 简单来说,该协议套件是计算机用来通过网络(专用网络或Internet)进行通信的一组标准化规则。 这意味着每台计算机都是庞大的网络(如Internet或专用网络)中的节点。
The role of TCP / IP
TCP / IP的作用
In detail, this suite of rules based on these two protocols have the following roles:
详细地,基于这两个协议的这套规则具有以下作用:
IP → Intenet Protocol is the system in charge of obtaining addresses where data must be sent.
IP→Intenet协议是负责获取必须发送数据的地址的系统。
TCP → Transmission Control Protocol, on the other hand, is in charge of handling error checking and packet ordering.
另一方面,TCP→传输控制协议负责处理错误检查和数据包排序。
![Image for post](https://miro.medium.com/max/9999/1*Yw4ZxyewfRivevtVWSOFcg.png)
So, imagine you want to transfer information from computer A to computer B. This protocol suite is in charge of determining the origin from which data must be sent and the destiny that is going to receive this information (IP’s). Furthermore, once destiny and origin are known, the data is sent as packages of data over the network, having under control that information is not going to be lost or broken.
因此,假设您想将信息从计算机A传输到计算机B。此协议套件负责确定必须从中发送数据的来源以及将要接收此信息(IP)的目的地。 此外,一旦知道了目的地和起源,就可以在控制信息不会丢失或破坏的情况下,将数据作为数据包通过网络发送。
Before describing what happens when you type an URL in your web browser and press enter, let’s know more about another relevant protocol. While TCP/IP allows computers to exchange information there must be another protocol that specifies the rules for transmission of webpages over the network, and it is called HTTP (stands for HyperText Transfer Protocol).
在描述在Web浏览器中键入URL并按Enter时会发生什么之前,让我们进一步了解另一种相关协议。 尽管TCP / IP允许计算机交换信息,但必须有另一个协议指定在网络上传输网页的规则,该协议称为HTTP(代表超文本传输协议)。
This protocol relies on a request-response approach in which the client is your web browser and the server is another computer that is hosting the web page you are requesting. However, this protocol is not pretty secure to send information over the network. This due to the lack of encryption of the packages of data sent. So, any information that is transmitted from one computer to another can be intercepted and easy to understand. For this reason, exists the secure version of HTTP is called HTTPS (stands for HyperText Transfer Protocol Secure).
该协议依赖于请求-响应方法,其中客户端是您的Web浏览器,服务器是另一台托管您正在请求的网页的计算机。 但是,此协议在网络上发送信息并不十分安全。 这是由于缺少对发送的数据包的加密的原因。 因此,从一台计算机传输到另一台计算机的任何信息都可以被拦截并且易于理解。 因此,存在HTTP的安全版本称为HTTPS(代表“超文本传输协议安全”)。
How HTTPS works?
HTTPS如何工作?
HTTPS protocol works in the same way as HTTP, but its difference is that the data transfer is encrypted to increase security. This helps users to sent sensitive data, such as passwords, credit card information, or private business information.
HTTPS协议的工作方式与HTTP相同,但不同之处在于,对数据传输进行了加密以提高安全性。 这有助于用户发送敏感数据,例如密码,信用卡信息或私人企业信息。
To make encryption possible SSL technology is used to establish authenticated and encrypted links between networked computers. For this, SSL uses something called certificates, which are digital documents in which the identities of network entities are bind to cryptographic key pairs (private and public key). In this way, a computer that is communicating with another through HTTPS uses an SSL certificate can encrypt the outgoing and decrypt the incoming information.
为了使加密成为可能,SSL技术用于在联网计算机之间建立经过身份验证和加密的链接。 为此,SSL使用称为证书的东西,这是数字文档,其中网络实体的身份绑定到加密密钥对(私钥和公钥)。 这样,通过HTTPS与另一台计算机进行通信的计算机使用SSL证书可以对输出进行加密,并对输入的信息进行解密。
Sending the request
S结束请求
Here we are, you already know how computers communicate securely over a network such as the Internet. Now, lets see what happens next when you type https://holbertonschool.com and press enter.
在这里,您已经知道计算机如何通过网络(例如Internet)安全地通信。 现在,让我们看看当您键入https://holbertonschool.com并按Enter时接下来会发生什么。
For any communication process, there must be a transmitter and a receptor of information. In this situation, the transmitter is going to be your computer using the web browser and the receptor must be the computer (also known as a server ) that is hosting the content of the Holberton school webpage. Once you press enter in your web browser the communication process begins. The first step is knowing where the browser must send the request. Wait we have the name of the web page already is not enough? Well, this name is important but while you specify the address when you send something by mail the same happens in the world of computers. To know this, let me introduce to you our web directory called DNS (stands for Domain Name System).
对于任何通信过程,必须有信息的发送者和接受者。 在这种情况下,发送者将是使用Web浏览器的计算机,而接收者必须是承载Holberton学校网页内容的计算机(也称为服务器)。 在Web浏览器中按Enter键后,通信过程开始。 第一步是知道浏览器必须在哪里发送请求。 等待我们拥有的网页名称已经不够吗? 嗯,这个名称很重要,但是当您通过邮件发送邮件时指定地址时,在计算机领域也是如此。 要知道这一点,让我向您介绍我们的称为DNS(即域名系统)的Web目录。
How DNS works and its usage
DNS的工作方式及其用法
As we say above, the first step is knowing where information must go, in other words, what is the address of the computer that hosts the web page you are requesting. So, the principal role of DNS is converting a hostname (such as www.twitter.com) into a computer-friendly IP address (such as 132.138.1.3). In this way, when you request a webpage, a translation is done between what you type into your web browser (www.twitter.com) and the machine-friendly address (IP) necessary to locate the resource you want. However, there is more going on under the hoods in this translation process. To know more about it check this link.
就像我们上面说的,第一步是知道信息必须到哪里,换句话说,托管您所请求的网页的计算机的地址是什么。 因此,DNS的主要作用是将主机名(例如www.twitter.com )转换为计算机友好的IP地址(例如132.138.1.3)。 这样,当您请求网页时,将在您在Web浏览器( www.twitter.com )中键入的内容与查找所需资源所需的机器友好地址(IP)之间进行转换。 但是,在此翻译过程中,还有很多事情正在进行。 要了解更多信息,请查看此链接。
Once this step finish and your browser get already the IP of the server where your website is, then it sends the request.
完成此步骤后,您的浏览器已经获取了您网站所在服务器的IP,然后它将发送请求。
Until here lets make something clear. If you think on a small scale may be the request sent by your browser is directly received by the server that hosts your webpage. However, webpages such as www.facebook.com, www.twitter.com, or www.holbertonschool.com can’t afford to have weak web infrastructure designs. Furthermore, sites like these manage a lot of requests per day or even per second. That means that is a kind of infrastructure like that there would be a SPOF (single point of failure) that would affect the response of the requests received. For these reasons, the request sent by your web browser is attended first by something called Load Balancer.
直到这里让我们弄清楚。 如果您认为规模较小,则托管您网页的服务器会直接收到浏览器发送的请求。 但是,诸如www.facebook.com , www.twitter.com或www.holbertonschool.com之类的网页无法承受较弱的Web基础结构设计。 此外,此类站点每天甚至每秒都会管理大量请求。 这意味着这是一种基础架构,就像会有一个SPOF(单点故障)会影响收到的请求的响应一样。 由于这些原因,您的Web浏览器发送的请求首先要由负载均衡器来处理。
What is a Load Balancer?
什么是负载均衡器?
Considering the number of request for a specific webpage, Load Balancers, are thought as a tool that helps to make your content always available. Their role consists of taking all the incoming requests and redirect them to the servers in which the website you are requesting, is located. To do this, they use a predetermined algorithm that establishes the logic of load deployment. In this way, the load could be distributed depending on factors like server capacity, type of request, server status (enable or disable), or many other variables. Furthermore, its principal objective is to give always the fastest response and the most efficient and effective use of the available resources.
考虑到对特定网页的请求数量,负载均衡器被认为是有助于使您的内容始终可用的工具。 它们的作用是接收所有传入的请求并将它们重定向到您所请求的网站所在的服务器。 为此,他们使用预定的算法来建立负载部署的逻辑。 这样,可以根据服务器容量,请求类型,服务器状态(启用或禁用)或许多其他变量等因素来分配负载。 此外,其主要目标是始终以最快的速度响应并最有效地利用可用资源。
![Image for post](https://miro.medium.com/max/9999/0*8IfqWYIU29xKccln.png)
Additionally, as a load balancer is used in high scale web infrastructures to attend an enormous quantity of requests, also another tool is used to control the incoming and outgoing traffic to the infrastructure where webpage content is stored. This tool is called a firewall. And as the name says, it’s a wall that allows or denies access from requests to different ports. In this way, this security software analyzes each request to determine if it comes from a not secure IP address or if it’s asking for access permissions to illegal ports.
此外,由于负载平衡器用于大规模Web基础结构中以处理大量请求,因此还使用另一种工具来控制到存储网页内容的基础结构的传入和传出流量。 此工具称为防火墙。 顾名思义,它是一堵墙,允许或拒绝从请求到不同端口的访问。 这样,此安全软件将分析每个请求,以确定该请求是否来自不安全的IP地址,或者是否正在请求对非法端口的访问权限。
Accepted Request
一个 ccepted请求
![Image for post](https://miro.medium.com/max/9999/1*c5iMugOrbdK5dEz070qwFA.png)
After the success of this authentication process did by the firewall, the load balancer establishes which server is going to respond to the request. Then, the request is redirected to the selected server where it reaches the Web server.
防火墙成功完成此身份验证过程后,负载平衡器将确定哪个服务器将响应该请求。 然后,该请求被重定向到到达Web服务器的所选服务器。
What is a web server?
什么是网络服务器?
Web server is a piece of software that is in charge of attending requests and giving a response to a specific request. It serves static content such as HTML pages, images, videos, text files, etc.
Web服务器是一种软件,负责出席请求并响应特定请求。 它提供静态内容,例如HTML页面,图像,视频,文本文件等。
When the request of www.holbertonschool.com arrives at the webserver it starts looking around directories in the computer to find the content needed and when it’s found, it returns a response with the content of this file. This response is finally interpreted by your web browser which renders the information of the webpage and shows it finally on your screen.
当www.holbertonschool.com的请求到达网络服务器时,它开始在计算机中的目录中四处查找以查找所需的内容,当找到该内容时,它将返回包含此文件内容的响应。 您的网络浏览器最终会对此响应进行解释,该浏览器将呈现网页信息并将其最终显示在屏幕上。
Great! You already have the content of holbertonschool.com on your screen, but wait a moment is just static content is not it? All buttons, forms, and interactions with the webpage are not available yet. And here is where the Application server takes place.
大! 您已经在屏幕上拥有holbertonschool.com的内容,但是请稍等一下是静态内容吗? 所有按钮,表单以及与网页的交互尚不可用。 这是应用程序服务器所在的位置。
Application server
应用服务器
This server is a piece of software that is in charge of the business logic. In simple terms, what this server does is serve dynamic content. This means that this tool helps our servers to respond to requests with functional webpages that allow interactions such as sending forms, pressing buttons, and so on. Furthermore, it communicates with databases and manages user information.
该服务器是负责业务逻辑的软件。 简而言之,该服务器要做的是提供动态内容。 这意味着该工具可以帮助我们的服务器使用功能强大的网页来响应请求,这些网页允许进行交互,例如发送表单,按下按钮等。 此外,它与数据库进行通信并管理用户信息。
So, you make the request and the dynamic content of the webpage is returned by the webserver, working together with the application server. But where the application server gets the information about any update to the webpage data or validates user information such as passwords or usernames? Well, all that information is stored inside a Database.
因此,您发出请求,网页的动态内容由Web服务器与应用程序服务器一起返回。 但是,应用服务器在哪里获取有关网页数据的任何更新的信息,或者在哪里验证用户信息(例如密码或用户名)? 好吧,所有这些信息都存储在Database中 。
Database
数据库
A database is an organized collection of data. Is the place in which all business data is stored as tables and records (rows). They could be a relational or non-relational database. Their importance of this tool is the facility to access, modify, update, manage, and organize the information of a business.
数据库是有组织的数据集合。 是将所有业务数据存储为表和记录(行)的地方。 它们可以是关系数据库或非关系数据库。 该工具的重要性在于可以访问,修改,更新,管理和组织业务信息。
It is used when you request a webpage and, the application server needs to access some information relevant to give a response.
当您请求网页时,将使用它,并且应用程序服务器需要访问一些与响应有关的信息。
Now in a high-level approach, we could say that the request of the holbertonschool.com webpage is interpreted by the load balancer. Then, distributed to a server in which the response reaches the web-server, that working together with the application server and the database sends back a response with the content of holbertonschool.com, as awesome as magic.
现在,从高级的角度讲,我们可以说holbertonschool.com网页的请求是由负载均衡器解释的。 然后,将响应分发到服务器,其中响应到达Web服务器,该服务器与应用程序服务器和数据库一起工作,发送回带有holbertonschool.com内容的响应,真是太神奇了。
![Image for post](https://miro.medium.com/max/9999/1*1qFcx80x48QRLDEhVPGNIQ.png)
Finally, after going through the main tools that work under the hoods when you request https://holbertonschool.com we know now what means that everything is working when you receive as a response this post after request it. Thanks for your time.
最终,在您访问https://holbertonschool.com并了解了幕后工作的主要工具之后,我们现在知道,当您收到请求后的回复时,这意味着一切正常。 谢谢你的时间。