Talks

Summarized using AI

Peeling Away the Layers of the Network Stack

Ufuk Kayserilioglu • May 05, 2020 • Couch Edition (online)

In this presentation titled "Peeling Away the Layers of the Network Stack," Ufuk Kayserilioglu discusses the fundamental layers of the network stack and their relevance to web developers, particularly those using Ruby on Rails. Understanding these layers can significantly enhance a developer's ability to troubleshoot and optimize web applications. The key points discussed include:

  • Layers of Communication: Communication systems are layered, allowing for changes at various levels without affecting the overall message.
  • Switching Techniques: Circuit switching vs. packet switching is introduced, using analog phone networks and postal services as examples. Packet switching is highlighted as more efficient, akin to how letters are routed through a postal network.
  • OSI Model: Kayserilioglu explains the OSI model with its seven layers: Physical, Data Link, Network, Transport, Session, Presentation, and Application, and introduces TCP/IP as a modern implementation.
  • Data Transmission Process: The process of data transmission is explained step-by-step from the application layer down to the physical layer and back, demonstrating how data is packaged and transmitted across different layers.
  • ARP and ICMP Protocols: The role of the Address Resolution Protocol (ARP) and Internet Control Message Protocol (ICMP) in facilitating communication and diagnostics on networks is discussed.
  • Transport Layer Mechanisms: The presentation contrasts UDP (User Datagram Protocol) as a simple, non-reliable service with TCP (Transmission Control Protocol), which guarantees reliable communication through sequence numbers and acknowledgments.
  • Application Layer Insights: The application layer is addressed, focusing on DNS and how it translates domain names into IP addresses, leading to HTTP requests.
  • Tools for Learning: Two tools, Wireshark and Nmap, are recommended for deeper exploration of network protocols and communications.

Concluding the presentation, Kayserilioglu emphasizes the importance of understanding these network protocols and their implications for developing better web applications. He urges developers to explore beyond their typical coding environments, recognizing the layered architecture enables flexibility and efficiency in communications. This foundational knowledge can profoundly impact how developers troubleshoot and optimize their applications, ultimately enhancing their development skills.

Peeling Away the Layers of the Network Stack
Ufuk Kayserilioglu • May 05, 2020 • Couch Edition (online)

Peeling Away the Layers of the Network Stack by Ufuk Kayserilioglu

"As Rails developers, we depend on network protocols to ensure the products we build are available and accessible to our users. Despite this, many of us are poorly aware of how the layers of the network stack actually work, or why they are there.

Understanding the things that happen between physical signals on the wire and your Rails application will help you hone your craft and level you up. Fortunately, the basic concepts of network protocols are easy to grasp, with a little guidance. So let's walk together through these concepts, and peel away the layers of the network stack one by one."

__________

Ufuk is a Physics PhD turned polyglot software developer. He is currently working as a Senior Production Engineer on the Ruby and Rails Infrastructure Team at Shopify. He has over 20 years of experience working with statically and dynamically typed languages and he brings that to Shopify for the adoption of better Ruby tooling and practices. He currently works remotely from Cyprus where he lives with his beloved wife and wonderful daughter. In his free time, he teaches computer science to high-school students.

RailsConf 2020 CE

00:00:08.870 Hello and welcome to this presentation at RailsConf 2020. I was really looking forward to seeing all of you in Portland this year, but unfortunately, due to the coronavirus, this presentation has to be virtual. I hope you enjoy it, and thank you for joining me.
00:00:21.930 Today, we will be discussing the layers of the network stack. My name is Ufuk Kayserilioglu, and I am a Senior Production Engineer on the Rails and Ruby Infrastructure Team at Shopify. Since you're attending a RailsConf talk, I'm going to assume that you're at least vaguely familiar with Rails, HTML, JavaScript, and CSS. I would also assume that you know a thing or two about HTTP as well.
00:00:38.430 However, for many of us Rails developers, or for most web developers, the lower layers of the network stack remain largely unknown. You might have heard of various acronyms like DNS, TCP, ICMP, and 802.11, and maybe you are familiar with some of them. What I have often observed is that most web developers do not fully grasp the complexities that lie beneath their applications.
00:01:06.899 Nonetheless, understanding the inner workings of the stack you are working on is an essential asset. Even if you are never going to do any low-level programming, being able to troubleshoot different layers of the stack when things go wrong is incredibly useful. Moreover, understanding the mechanics of these lower layers can inform how you build your applications, ultimately making them faster.
00:01:32.909 To illustrate, we all bundle our assets before deploying our Rails applications because we are told it speeds up page renders. But have you ever considered why? If you are unaware of how web browsers work or if you do not understand TCP handshakes and the overhead they introduce, you might not grasp why we bundle our assets. Therefore, more knowledge of the network stack can indeed make you a better web developer and enhance your overall development skills.
00:01:49.979 Today, we will delve deeply into the lower layers of the network stack to gain at least a rudimentary understanding of how things work down there. We all know that communication is challenging, and networks revolve around communication.
00:02:07.600 During these days of social isolation, with remote meetings and messages, I'm sure we all appreciate the joys of face-to-face communication. Communicating face-to-face is already difficult; doing so through various other channels proves even more challenging. Nonetheless, humanity has built incredible communication tools. People have constructed and dismantled entire empires using nothing more than messengers or written communication on parchment paper.
00:02:31.350 This suggests that when we get the fundamentals right, we can communicate quite effectively. If you examine communication closely, you'll discover that the most critical aspects involve layers in the communication channel and the various switching methods utilized within that channel.
00:02:49.440 So, before we move forward to the network stack, let's briefly discuss layers. Communication, like many other human endeavors, is layered. These layers of communication build upon one another. For example, we send letters with ink on paper inside envelopes adorned with addresses. When the recipient opens such a letter, they perceive the ink shapes, recognize words and sentences, derive meaning from them, and transform that meaning into understanding.
00:03:09.532 We must design communication systems wherein each layer serves a specific purpose. For instance, in the letter exchange example, dividing communication into layers allows us to modify some of the layers without altering the underlying message. If the recipient is close by, we can choose to speak to them face-to-face instead of sending a letter. The message remains unchanged, but the lower layers of communication have altered.
00:03:33.640 Next, let’s discuss switching. Switching fundamentally means the method by which communication channels between two entities are accessed. There are primarily two different kinds of switching. The first is circuit switching, an excellent example of which is the analog telephone network.
00:03:49.710 In a circuit-switched network, multiple subscribers are connected to the network. When one subscriber connects with another subscriber, a circuit is established. The voltage along that circuit causes the landlines to ring for the duration of the phone conversation; the circuit must remain connected. If it gets disconnected, the conversation is abruptly terminated. Hence, this is referred to as circuit-switched networking.
00:04:04.260 While circuit switching makes establishing and maintaining communication straightforward, it is highly inefficient. Even when the communication channel is not in use, the resources are still occupied, waiting to be utilized. A real-life representation of circuit switching would be employing a messenger who always waits outside your door, prepared to deliver messages to your friends.
00:04:19.050 Often, this messenger remains idle, awaiting your message. You cannot send another message until the messenger returns with a response. The alternative mode of switching is known as packet switching.
00:04:32.190 A good example of packet switching is the postal network. In the Postal Service, if you wish to communicate with a friend, you write a letter, place it in an envelope, and drop it into a mail collection box. A postal worker collects the letter and takes it to the post office, where it is sorted based on the address on the envelope.”},{
00:04:55.260 From here, it may get dispatched to the head post office, which makes subsequent sorting decisions, such as sending it on a plane to another country. Once the letter reaches the destination country, it is routed to the regional post office and ultimately delivered to your friend's mailbox.
00:05:04.710 There are two important points to note from this process: First, no leg of the communication utilizes any resources while the message is in transit. If you wish to communicate with your friend again, you simply send another letter. Second, message routing seamlessly crosses different networks that operate independently.
00:05:14.850 As such, every point only needs to determine the next point in the route, without having knowledge of where the recipient lives, except for the final postal worker who delivers the message to the intended recipient.
00:05:28.920 This example of packet switching provides us with a blueprint for how we might build our network communication systems. The goal was to standardize networks, and in the early 1980s, some brilliant minds collaborated to create the Open Systems Interconnection (OSI) model.
00:05:45.480 The OSI model consists of seven layers, each with independent responsibilities. These layers, from bottom to top, are: Physical, Data Link, Network, Transport, Session, Presentation, and Application.”},{
00:06:00.450 Together, these seven layers form what we refer to as the network stack. Above this stack lie our applications and services. The OSI model serves as a conceptual reference, while the concrete implementation we will analyze today is the TCP/IP stack.”},{
Explore all talks recorded at RailsConf 2020 CE
+22