Fragmentace

Reasons

ThelinklayerhasthefeatureofmaximumtransmissionunitMTU,whichlimitsthemaximumlengthofdataframes,anddifferentnetworktypeshaveanupperlimit.TheMTUofEthernetis1500,youcanusethenetstat-icommandtocheckthisvalue.IfthereisadatapackettobetransmittedattheIPlayerandthelengthofthedatapacketexceedstheMTU,theIPlayerwillfragmentthedatapacketsothatthelengthofeachfragmentislessthanorequaltotheMTU.WeassumethataUDPdatapacketistobetransmitted,theMTUofEthernetis1500bytes,thegeneralIPheaderis20bytes,theUDPheaderis8bytes,andthepayloadpartofthedataisreservedfor1500-20-8=1472bytes.Ifthedatapartislargerthan1472bytes,fragmentationwilloccur.

Podrobný úvod

Sharding je typ rozdělení databáze, který rozděluje velké databáze na menší, rychlejší a snadněji spravovatelné části. Tyto části se nazývají datové fragmenty. Fragment slova znamená jako malou část celku.

JasonTeesaid:"Inshort,ashardingdatabaseneedstodividethedatabaseintomultiplesmalldatabasesthathavenocommonground,andtheycanbespreadacrossmultipleservers."

p>

Technicallyspeaking,shardingissynonymouswithhorizontalpartitioning.Inpractice,thistermisoftenusedtorefertoalldatabasepartitionsthatmakealargedatabaseeasiertomanage.

Thecoreconceptofshardingisbasedonanidea:thesizeofthedatabaseandthenumberoftransactionsperunittimeonthedatabaseincreaselinearly,andtheresponsetimeofqueryingthedatabaseincreasesexponentially.

Inaddition,thecostofcreatingandmaintainingalargedatabaseinoneplacewillincreaseexponentially,becausethedatabasewillrequirehigh-endcomputers.Conversely,datafragmentscanbedistributedtoalargenumberofmuchcheapercommercialservers.Intermsofhardwareandsoftwarerequirements,datafragmentationisrelativelyunrestricted.

Insomecases,databaseshardingcanbedonesimply.Splittingtheuserdatabasebygeographiclocationisacommonexample.Usersontheeastcoastareassignedtooneserver,andusersonthewestcoastareassignedtoanotherserver.Assumingthatnouserhasmultiplegeographiclocations,thistypeofpartitioniseasytomaintainandcreaterules.

Butdatashardingcanbeamorecomplicatedprocessinsomecases.Forexample,ifadatabaseholdsverylittlestructureddata,shardingmaybeverycomplicated,andtheresultingfragmentationmaybedifficulttomaintain.

Fragmentation

Fragmentationprocess

ForeachIPdatagramsentbythesender,itsidentificationfieldcontainsavalue.Thisvalueiscopiedtoeachfragmentwhenthedatagramisfragmented.Theflagfieldusesonebittoindicate"moreslices".Exceptforthelastslice,everyotherslicethatcomposesthedatagrammustsetthisbitto1.Thefragmentoffsetfieldreferstothepositionofthefragmentoffsetfromthebeginningoftheoriginaldatagram.Inaddition,whenthedatagramisfragmented,thetotallengthofeachfragmentshouldbechangedtothelengthofthefragment.

Nakonec je v poli příznaku nazvaném "nefragmentovaný" bit. Pokud je tento bit nastaven na 1, IP nebude fragmentovat datagram. Místo toho se datagram zahodí a iniciátoru se odešle chybová zpráva ICMP.

AftertheIPdatagramisfragmented,eachfragmentbecomesapacketwithitsownIPheader,andisindependentofotherpacketswhenselectingaroute.Inthisway,thesepiecesofdatagrammaybeoutofsequencewhentheyarriveatthedestination,butthereisenoughinformationintheIPheaderforthereceivingendtoassemblethesepiecesofdatagramcorrectly.

Technické informace

Záhlaví IP obsahuje informace potřebné pro fragmentaci a reorganizaci:

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+-+-+-+

|Identification|R|DF|MF|FragmentOffset|

+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ -+-+-+-+-+-+-+-+-+-+

||||

Identification:TheidentificationfieldoftheIPdatapacketsentbythesenderisasinglevalue,whichiscopiedtoeachsliceduringfragmentation.

R:Nepoužívat.

DF: Bit nefragmentovat, nefragmentovat. Pokud je tento bit nastaven na 1, IPlayer nefragmentuje datagram.

MF:Více fragmentů,"více fragmentů", kromě posledního fragmentu, tento bit musí být nastaven na 1 pro každý další fragment, který tvoří datagram.

FragmentOffset:Thepositionofthefragmentoffsetfromthebeginningoftheoriginaldatapacket.Thenumberofbytesoftheoffsetisthisvaluemultipliedby8.

Inaddition,whenthedatagramisfragmented,thetotallengthofeachfragmentshouldbechangedtothelengthofthefragment.

Související články
HORNÍ