Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
December 28, 2022 04:20 pm GMT

Basics of the Internet

There isagreat book called High Performance Browser Networking byIlya Grigorik that contains basic knowledge about networking and data transfer optimizations. Inthis book author writes the following about CDNs:

Content delivery network (CDN) services provide many benefits, but chief among them isthe simple observation that distributing the content around the globe, and serving that content from anearby location tothe client, enablesus tosignificantly reduce the propagation time ofall the data packets.

Wemay not beable tomake the packets travel faster, but wecan reduce the distance bystrategically positioning our servers closer tothe users! Leveraging aCDN toserve your data can offer significant performance benefits.

When you think aboutit, you probably agree with the fact that CDNs make the user experience better, because they speed upwebsite loading. But... wait aminute! How does the CDN doit?

You might say, Well, when auser loads files from CDN, they are loaded from the nearest server tothis user. Easy-peasy. Yeah, but how does ithappen ifweuse the one and only domain name for the content?

InUploadcare weoffer our clientsa CDN along with other optimizations, and weknow alot about the technologies that are used tomake the content delivery fast, reliable, and secure. Inthis small series ofarticles weare going toshare this knowledge with you and explain the magic behind the CDN.

Wiring the thingsup

Letus start with basic networking. Lets say wehave two computers that should communicate with each other:

Try toimaging that these shapes are real computers

The solution issimple wire them and the job isdone:

The grey line isanEthernet cable

Yeah, itworks. When computerA wants tosend amessage tocomputerB, ittransfers the data through the port where the cable isconnectedto. Its easy todetect when the communication channel isoccupied, because there are only two users ofthis channel. Theres noproblem with addressing due tothe same reason.

However, this solution ishard toscale. What should wedowhen wehave five computers instead oftwo? Sure, wecan connect them toeach other, but...

Pentagram!

You see that communication quickly becomes aproblem. Its easier tosummon Satan with these wires rather than build aclear network. Not only doweneed alot more cables now, but also each computer should have four ports. Moreover, when wewant toadd anew computer tothis network, wehave tofind away toadd anew port toeach existing computer! The topology ofthis network isway too complex.

Incommunication networks topology isthe arrangement ofthe elements. There are physical and logical topologies. Physical topology isthe placement ofthe various components ofthe network, while logical topology ishow data flows within anetwork.

Inour case, every device isconnected toeach other, which means that wehavea fully connected network, physically and logically. Toreduce the number ofcables wemay choose adifferent topology. For example, each computer may beconnected toits neighbors onthe left and onthe right only:

Way better. Nosatanism this time!

This iscalled a ring network. Asyou see, this type ofnetwork does not require too many cables and each computer may have two ports only, but the tradeoff isthe necessity oftransferring data through the intermediate computers while trying toreach the destination.

Even though using intermediate computers isnt that bad, there isamuch more important flaw inaring network. The connection relies onthe availability ofthe nodes. Ifone node ofthe ring isbroken, then the signal cant betransferred properly.

There are different topologies which solve different problems. E.g. instead ofusing aring network wemight use one central wire towhich all the computers are connected. Thatis, wewould get a bus network:

Itlooks like atypical USA suburbs road system

Now our network does not rely oncomputers, but itwill bebroken ifthe central wire (usually called a bus, a backbone ora trunk) does not work properly. This type ofnetwork isharder tomaintain, because you have tobeable tocheck and repair every inch ofthe backbone.

Tosolve the maintenance problem described above, wemay use ahelper device which will receive data from acomputer and distribute itthrough the network. The device iscalled a hub, while the topology ofthis kinds ofnetwork iscalled a star:

Stellar thing inthe center isahub

Even though this network may bebroken byshutting down the hub, its much easier tomaintain instead ofcontrolling along cable, wehave tocontrol only one device. Also, its much easier toconnect new nodes just plug the cable into the hub, and itworks.

Inreal life weuse star networks athome. All the devices are usually connected toone router that receives messages and distributes them when necessary. The Internet itself isa hybrid network, which iscombined from the myriads ofsmall networks, each one ofthose may use any physical orlogical topology.

The Internet hierarchy

Alright, wehave anetwork athome that may look like this:

Hope you dont really have afridge with Wi-Fi though

But what happens onthe next level? What isthe way ofyour request toGoogle? Lets see.

First ofall, your request will land onthe computer that will process it aGoogle server:

Yeah, Iknow, mydrawing skills are blessed byGod

But the request doesnt gostraight tothe Google server.

Your router connects you with alarger network owned byyour Internet Service Provider (ISP). Same goes with the Googles computer:

Bythe way, usually ahome router isnot connected directly toanISP. There are more routers and other devices between them

Each ofthose ISPs maintains its own network for many ofthe local networks, not only for yours and Googles.

Ifyou are connected tothe same ISP asyour Google server youre lucky, because the data may betransferred inside the providers network which isfast, secure and reliable:

Eh.. Sergey? Larry?

But inthe real world itisnot possible toconnect everyone using only one ISP. There are hundreds and thousands ofproviders. Each ISP has tocommunicate with each other tomake the Internet work properly.

So, the closest toreal life example may look like this:

Inreality even this scheme isnot possible

You might see the problem here. Ifall the ISPs should connect toeach other directly then wemay encounter the same situation wegot atthe start ofthis article tons ofwire! Thats why they are connected using hubs called Internet Exchange Points, or IXPs.

Ifwecontinue adding entities tothis scheme, wewill run out ofshapes. Please, send halp

Our network isalready complicated, but there isone more problem geography.

What ifyou live inSpain, while the Google computer lives inthe USA? Well, they should beconnected insome way, right?

Color coding isthe same; wesimply put the network onthe map

This way isanunderwater cable! You may think that this isajoke, butno, itisnot. The continents are connected toeach other using undersea cables. Itmay seem unreliable, and infact sometimes itis. But its still the best way toconnect everything:

The cable isnot that thick though

Now itlooks like weknow how toconnect two computers using the Internet. But heres where things become really mad.

First, there are lots ofISPs.

Second, there are lots ofIXPs.

Third, there are lots ofundersea cables! Check the map ofthem dated 2021:

Atthe moment when were writing this article, there are 485 cables laying inthe oceans

Finally, not every ISP isconnected directly toIXP. Sometimes they are connected toparent ISPs.

Even this isnot the end, the cables are different: some ofthem transmit the signal faster, others doitslower. Whats more important, some ofthem cost more than others touse. You dont think that the connection between ISPs and IXPs isfree ofcharge, doyou? ISPs pay toeach other and IXPs touse the network each ofthem have. Some providers charge more, others charge less.

Thats why the signal your computer sends usually does not gobythe shortest path. The signal goes bythe cheapest one.

Transmission medium

A transmission medium isasystem orsubstance weuse totransfer the signal. When devices are connected toeach other using Wi-Fi, the medium isair. When yourPC isconnected toyour router, the medium isusuallya copper wire. The backbone ofthe Internet the undersea cables ismadeof optic fiber.

The medium defines the conditions inwhich the communication can bedone.

For instance, copper wires are affected byany electrical noise. Thats why the twisted pair isactually twisted toprevent electromagnetic interference. Such cables also maybe covered with aspecial material which shields the transmitted signal.

Atthe same time, optical fiber does not care about electrical noise, because its just alight pipe. Even more, due tothe techniques used totransfer the data, the speed oftransmission maybe much higher inoptical fiber than incopper wire!

Now you may say, The Internet isbased onundersea cables and this iskinda sick. Why not use satellites ifwecan transmit data through the air?

Sure, itispossible toconnect computers using satellites. E.g. GPS uses satellites and itworks. First ofall, its cheaper tosimply wire the computersup. Besides, the network laying onthe ground (orinthe sea) ismuch easier torepair.

Moreover, lets dothe quick math. Lets recall the connection wedescribed earlier. Lets say that the orange dot was Nashville, USA, while the white dot was Zaragoza, Spain:

According tothis map our ISPs office issomewhere inIberian System, huh

The distance between these cities is7200kilometers. Ifweconnect them using adirect wire, the signal transmitted from Zaragoza will reach Nashville in36milliseconds, because the speed oflight inoptic fiber isaround 200000km/s (its 1.5 lower than inthe vacuum).

Atthe same time, there might beasatellite somewhere inthe middle ofthe sky, between Zaragoza and Nashville. Historically, communication satellites were deployedon geostationary orbit, the altitude ofwhich is35786kilometers. Our signal should gofrom Zaragoza tothe satellite and then from the satellite toNashville.

Lets omit trigonometry and say that the total distance is2 35786kilometers, which is71572km.

Atthe same time, the speed ofthe signal that goes tothe satellite and back isapproximately 300000km/s, because radio waves are used for transferring the signal. The total trip time is238ms.

So, the time that signal goes from Zaragoza toNashville bydirect wire is36milliseconds. For the satellite this time is238ms.

We have not said anything about the fact that all those intermediate points, such asISPs, IXPs and the rest ofthem, slows the signal down, making the real transferring time bigger than 36ms. But atthe same time, wehavent said anything about the quality ofthe signal, which isusually not sogood for transmissions over the air.

So, you see why the world isstill using cables. Inthe foreseeable future, the status quo may change, due tomassive deployment ofsatellites (e.g.byStarlink) toa low Earth orbit. Lower altitude allows the satellites tomaintain aconnection with much less latency.

However, its highly unlikely that the current wired infrastructure disappears, which means that ifyou maintain anInternet service you have touse services like CDNs toserve data closer tousers.

Inthe next article ofthis series wewill see how the signal isencoded during the transfer and figure out how tointercept requests toinspect them.

Originally published by Igor Adamenko in Uploadcare Blog


Original Link: https://dev.to/uploadcare/basics-of-the-internet-mdh

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To