Encryptionhttp

http://www.anquye.com/  时间:2021-03-20  阅读:()
PublishedSeptember16th,2015NGINX,Inc.
HTTP/2forWebApplicationDevelopers2HTTP/2forWebApplicationDevelopersTableofContents3Introduction4HTTP/1.
xSoFar5PresentingHTTP/210TestingHTTP/2OnYourSite14Conclusion15Appendix:TheStoryofSPDY16AdditionalResources3HTTP/2forWebApplicationDevelopersIntroductionAsyoumayalreadyknow,HTTP/2isthenewversionofHyperTextTransportProtocol(HTTP),whichwasreleasedasanIETFstandardinearly2015.
HTTP/2supportisnowavailableinsomewebservers,includingNGINX,andinrecentversionsofmostwebbrowsers.
HTTP/2usesasingle,multiplexedconnection,replacingthemultipleconnectionsperdomainthatbrowsersopenedupinHTTP/1.
x.
HTTP/2compressesheaderdataandsendsitinaconcise,binaryformat,ratherthantheplaintextformatusedpreviously.
Byusingasingleconnection,HTTP/2reducestheneedforseveralpopularHTTP/1.
xoptimizations,makingyourwebapplicationssimpler.
HTTP/2iscloselytiedtoSSL.
WhileSSLisnotrequiredbytheHTTP/2specification,allwebbrowsersreleasedsofarwillonlyrunHTTP/2ifawebsitealsousesSSL.
HTTP/2speedsupSSL-enabledwebsitesandmakeswebapplicationssimpler.
WeencourageyoutotestHTTP/2inyourwebapplications,withaviewtomovingontothenewprotocol.
NGINXplayedaleadingroleintheadoptionofSPDY,theprecursorofHTTP/2,andNGINXsoftwareisoftenusedforSSLtermination,amongotherroles.
SoweexpectNGINXtoplayasignificantroleinsupportingimplementationofHTTP/2.
ThiswhitepaperdescribestheobstaclestowebperformancethatareinherentinHTTP/1.
x,theimprovementsfoundinHTTP/2,howtoimplementHTTP/2withNGINX,andhowtounwindHTTP/1.
xoptimizationstomaximizeHTTP/2performance.
ProTip:IfyouwanttoenableHTTP/2andstarttestingthenewprotocolimmediately,youcanjumptothesection,TestingHTTP/2onYourSite.
4HTTP/2forWebApplicationDevelopersHTTP/1.
xSoFarHTTPwasintroducedalongsideHTMLintheearly1990s,whenthewebfirstappeared.
AnHTTPconnectioncouldonlyhandleonemessageatatimeandcouldnotbereused.
Earlywebpagesweresimple;text,headers,andperhapsafewimages,sothisconnectionmodelwassufficient.
Aswebpagesgrewtoincludeimagefiles,CSS,andJavaScript,asingleconnectionwasnolongersufficient.
Manywebpagestodayhavemorethan100separateelements.
Toreducepageloadtimes,browserscreatedmultipleconnectionsatonce-usuallysixtoeight-toallowforsomeparallelisminfiletransfer.
HTTP/1.
1wasintroducedin1999toaddresssomeissueswiththeoriginalHTTP.
Thisupdatetothestandardformalizedthepracticeofusingkeepaliveconnections-connectionsthatcanbere-used.
However,keepaliveconnectionsarestillsubjecttohead-of-lineblocking;arequestforalargefileholdsupmanysubsequentrequestsforsmallerfiles.
ConnectionusageinHTTP/1.
xalsoworksagainstwidespreadadoptionofSSL.
SSLneedsextracyclestoestablishanewconnection,becauseeachconnectionhastobeauthenticated.
Theuseofmultipleconnectionsmeansmorewaittimeforinitialhandshakingtocomplete.
DevelopersuseseveraloptimizationstogetthemostoutoftheavailableconnectionswithHTTP/1.
x:Domainsharding-Filesareparceledouttomultiplesubdomains,withthebrowseropeningsixtoeightconnectionsforeachone.
Thisincreasesparallelisminfiletransferbutaddsmoreconnectionoverhead.
Imagesprites-Imagesarecombinedinonelargefileforefficientdownloading,andeachindividualimageisretrievedbylookup.
Usersmustwaituntilthecombinedfilearrivesbeforetheycanseeanyimagesfromit.
ThelargefilesunderminecachingandtieupRAM.
Concatenatingcodefiles-Allcodeofagiventype(JavaScript,CSS,etc.
)goesintoasinglefile.
Thissavesonconnectionsbutunderminescaching,makestheuserwaitforallthecodebeforeanyofitcanrun,andconsumesextraRAM.
Inliningfiles-CSScode,JavaScriptcode,andevenimagesareinserteddirectlyintotheHTMLfile.
Thisreducesconnectionusage,buttakesupextraRAM,andinitialpagerenderingisdelayeduntiltheenlargedHTMLfilefinishesdownloading.
Theseoptimizationsalsoaddextrastepstodevelopmentanddeploymentworkflows.
Andfinally,extraconnectionsopenedbybrowsers-multipliedbytheuseofdomainsharding-putstrainonnetworks.
Thankfully,theseconnection-relatedtricksarerenderedunnecessarybyHTTP/2andcanbeeliminatedunderthenewstandard.
5HTTP/2forWebApplicationDevelopersPresentingHTTP/2HTTP/2allowsforfaster,moreefficient,moresecuredatatransferinmostapplications.
HTTP/2isbasedonSPDY,afast,non-standardwebtransportprotocolthatwasintroducedbyGooglein2009.
HTTP/2retainsthesamesemanticsasHTTP/1.
1.
ThisincludesHTTPmethodssuchasGETandPOST,statuscodessuchas404(pagenotfound),URLs,andhowheaderfieldsaredefinedandused.
Whileretainingthesecharacteristics,HTTP/2addsfivekeyfeatures:Single,PersistentConnection-Onlyoneconnectionisusedforeachwebpage,asshowninthefigure.
Thesameconnectionisusedaslongasthewebpageisopen.
Multiplexing-Requestsandrepliesareprioritizedandmultiplexedontoseparatestreamswithinthesingleconnection.
Whentheconnectionisstable,"headoflineblocking"-makingeverytransferwaitforallprevioustransferstocomplete-iseliminated.
HeaderCompressionandBinaryEncoding-Headersarecompressedusinganew,separate,securestandard,HPACKcompression,whichreducestheamountofdatacrossingthenetwork.
Headerinformationissentincompact,binaryformat,notasplaintext.
Prioritization-Requestsareassignedlevelsofdependencyandrequestsatthesamelevelareprioritized.
Theserverusesthisinformationtoorderandassignresourcestofulfillingrequests.
SSLEncryption-HTTP/2allowsyoutoaddSSLsupportwith,insomecases,noperformancepenalty,makingyoursitemoresecure.
HowdoesHTTP/2overcometheperformanceoverheadimposedbySSLonHTTP/1.
xTherearefourkeytechniques:1.
HavingasingleconnectionminimizesSSLhandshaking.
2.
Headersarecompressed,reducingthetimeneededtosendthem.
3.
Multiplexingmeansfiletransfersdon'twaitonotherrequests.
4.
Filesdon'tneedtobein-lined,concatenated,orsprited,socachingcanworkoptimally.
Whencomparedtoanon-SSLimplementation,thereisstillSSLperformanceoverheadforauthenticatingthesingleconnectionandforencryptinganddecryptingdata,butthisremaining6HTTP/2forWebApplicationDevelopersoverheadshouldbemoreorlessoffsetbytheperformanceimprovementsinHTTP/2.
YoucanbeginusingHTTP/2foryourwebsitesandwebapplicationswithoutunderstandingitsinternals,butthisinformationcanhelpyouknowwhattoexpectfromHTTP/2intermsofperformancewithyourwebcontent.
Note.
TheHTTP/2specificationalsoincludesserverpush,inwhichtheserversendsfileslistedinapage'sHTMLbeforethey'rerequested.
ServerpushisnotsupportedinNGINX'scurrentimplementationofHTTP/2.
Single,PersistentConnectionLikedrivingacardownanarrowalleyway,anHTTP/1.
1canonlycarryonefileatatime.
AnHTTP/2connectionismultiplexed,allowingdifferentrequestsandresponsestosharethesameconnection.
ThisdifferenceisthebasisformanyofHTTP/2'sbenefits.
AnHTTP/2connectionhasthreeelements:Messages-Arequestorresponse.
Streams-Acallandresponsechannelthatcarriesmessagesintwodirectionssimultaneously.
Aconnectioncanhaveasmanystreamsasneeded.
Frames-Messagesarebrokendownintoframesforsending.
Eachframehasaheaderthatidentifiesitsmessageandstream,soframesfromdifferentmessagescanbeintermixedintherequestorresponsedirectionofastream.
ThefigureshowsthetrafficflowoveranHTTP/2connection.
Twostreams,eachwitharequestandaresponsechannel,carrymultiplexedrequestsandresponses.
Eachrequestandresponseisindependentoftheothers.
7HTTP/2forWebApplicationDevelopersMultiplexingThesingleconnectionusedbyHTTP/2supportsmultiplexing,allowingittobesharedflexiblybypendingrequestsandresponses.
Thetableshowsthetypicalwebbrowser'spage-loadingprocesswithHTTP/1.
1vs.
HTTP/2.
BoldtextintheHTTP/1.
1columnhighlightshowHTTP/1.
1requiresmoretime,moresteps,andmoredatatobetransferred.
HTTP/1.
1PageLoadHTTP/2PageLoad1.
Createsixtoeightconnections.
1.
Createasingleconnection.
2.
RequestHTMLpage.
2.
RequestHTMLpage.
3.
ReceiveHTMLpage.
3.
ReceiveHTMLpage.
4.
DecodeHTMLpage.
4.
DecodeHTMLpage.
5.
RequestfirstsixtoeightfilesincludedintheHTMLpage,noprioritiesordependencies.
(Requestshaveuncompressed,plain-textheaders.
)5.
RequestallfilesincludedintheHTMLpage,withprioritiesanddependencies.
(Requestshavecompressed,binaryheaders.
)6.
Oneachconnection,waitforrequestedfiletoarrive.
(Filesreturned,multiplexedonsingleconnection,asready.
)7.
Requestnextfileonnow-openconnection.
--8.
Repeat6-7foreachremainingfile.
--9.
Closesixconnections.
8.
Closesingleconnection.
ThestepsthatarefasterandmoreefficientforHTTP/2are:1.
Creatingandclosingconnections-HTTP/2createsasingleconnection;HTTP/1.
1createssixtoeight,ormanymoreifdomainshardingisinuse.
2.
Waitingtomakerequests-HTTP/2makesallrequeststogether,withmultiplexingandprioritizationtodeliverhigh-priorityresourcesasquicklyaspossible.
HTTP/1.
1makessixtoeightrequests,thenwaitstoreceiveresponsesbeforemakingadditionalrequests,oneatatimeoneachconnectionasitbecomesavailable.
3.
Sendinglessheaderdata-UnlikeHTTP/1.
1,headerdataforHTTP/2iscompressed,puttinglessdataonthewire.
HeaderCompressionandBinaryEncodingInHTTP/1.
x,headerdataissentasplaintext.
InHTTP/2,headerdataforthesingle,multiplexedconnectioniscompressedaccordingtothenewHPACKstandard,whichusesHuffmancoding.
Headerdataisalsosentinbinaryformat,furtherreducingfilesize.
Headercompressionisnotalwaysabigpositive.
CompressingheaderdataaddsCPUoverhead.
IncaseswheretheuncompressedrequestheaderfitsinasingleTCPpacket,compressiondoesn'thelp.
Forresponses,headerdataisoftenmuchsmallerthantheaccompanyingdata,sothebenefitofheadercompressionissmallaswell.
Bothcompression8HTTP/2forWebApplicationDevelopersandbinaryencodingmakeforobscurityindebugging,comparedtoplaintext.
Telnetcannolongerbeusedfordebugging,butWiresharksupportsHTTP/2.
InHPACKcompression,astatictablecontainsknownheaderfieldsandcommonvalues,eachassignedanindexnumber.
Asheadertransmissionstarts,valuesinthestatictablereplacetextstringsintheheader.
Asheadertransmissioncontinues,adynamictableisbuiltupaswell,assigningcodestonewheader-valuepairs.
Thedynamictableisusedasfieldsrepeatwithinthesession.
Testingshowscompressionofgreaterthan50%onheaderssentbytheclientandnearly90%onheaderssentbytheserver,probablyduetogreateruseofthedynamictableastheconnectionisused.
ThefigureshowsHPACKinuse.
Asthetransferstarts,thestatictable(middlecolumn,top)alreadyhasheader-valuepairssuchas:methodGET(index2).
Astheactualrequestheadersareprocessed,aheader-inpairthatisnotinthestatictable,user-agentMozilla/5.
0,isaddedtothedynamictable(middlecolumn,bottom,index62).
Theencodedheadersthenincludetheindexvalues2and62,ratherthanthemuchlongerheader-valuepairsthattheyrepresent.
PrioritizationHavingasingle,multiplexedconnectionmeansthattheorderinwhichresponsesarereceivedmakesabigdifferenceinperformance.
SoHTTP/2streamshaveaprioritizationweight,whichisanintegerbetween1(lowestpriority)and256(highest),andanystreammaybemadedependentonanother.
Theprioritizationschemeisusedtodeterminetheorderinwhichfilesarerequestedandinwhichtheserverretrievesdata.
Inanoptimalimplementation,forinstance,CSSandJavaScriptfilesaregivenahigherprioritythanimagefiles.
Thisallowscodefilestobedownloadandrunquickly,preventingdelays.
Thecombinationofdependenciesandweightscanbeexpressedasa"prioritizationtree",asshowninthefigure.
TheservercanallocateCPU,memory,andbandwidthtosupporttheprioritizationexpressedbytheclient.
9HTTP/2forWebApplicationDevelopersInthefigure,thelastexampleisthemostcomplex.
First,streamDgetsallavailableresources;streamEandstreamCthensharetheavailableresourcesequally;andstreamAandBthensharetheavailableresources,withstreamAgettingthree-fourthsoftheavailableresources.
Dependenciesandweightscanbechangedbytheclientonthefly,inresponsetouserinteractionandothernewinformation.
Multiplexingandprioritizationoperatetogreatesteffectwhentherearemultiplerequestsoperatinginparallel.
Whenevaluatingperformance,youarelikelytofindthatadvantagesofHTTP/2areless,andtheperformanceslowdownduetoSSLgreater,forverylargefilesandstreamingmediafilessuchasaudioandvideo.
TheremaybecaseswhereHTTP/1.
xwithoutSSLisrequiredforacceptableperformance.
ProTip:Considertestingperformanceandusersuccessonvarioussitetasks-articlesviewed,filedownloads,purchasesmade-beforeandafterHTTP/2implementation.
Seeifsiteresponsetimeimproves,asitshouldwithHTTP/2,andifso,whetheruserscompletemoretasksonthefastersite.
SSLEncryptionSSLisnotarequirementofHTTP/2perse,butcurrentlyshippingbrowsersonlysupportHTTP/2ifserversupportforHTTP/2isenabledandSSLisinuse.
FuturebrowsersupportforHTTP/2isalsolikelytorequireSSLsupport.
AccordingtotheTrustworthyInternetMovement,nearly25%ofthemostpopularwebsitesimplementSSLsite-wide,whereasonly10%didsoin2012.
SSLsitesincludeGoogleSearch,Gmail,andGoogleDocs,aswellasFacebookandYahoo!
.
NewconnectionsareexpensivewithSSL;eachrequiresacomputationallyintensiveexchangeofkeys–typically,anRSA2kpublic/privatekeypair.
But,underHTTP/2,onlyoneinitialconnectionisneeded,insteadofsixtoeightunderHTTP/1.
x(morewithdomainsharding).
IfyoualreadyuseSSLthenmovingtoHTTP/2,withitssingle,persistentconnection,willcutSSLoverhead.
If,notusingSSLalready,youadditinamovetoHTTP/2,youwilllikelyseetheslowdownfromSSLmoreorlessoffsetbytheperformancebenefitfromHTTP/2.
Formoredetailsonsecureconnections,andquotesfromFacebook,Google,Twitterandothersastothemanageabilityoftheassociatedoverhead,seethewebsite,IsTLSFastYet.
10HTTP/2forWebApplicationDevelopersTestingHTTP/2onYourSiteYoucaneasilyimplementHTTP/2inawebapplicationthatalreadyusesNGINXorNGINXPlus.
Inmostcases,NGINXwillbeinfrontofotherwebservers,providingcapabilitiessuchasloadbalancing,contentcaching,andSSLtermination.
TurningonHTTP/2ontheNGINXserverenablesHTTP/2forclientcommunications,butdoesn'taffecttheotherservers,sinceNGINXusesHTTP/1.
xorotherappropriateprotocoltocommunicatewiththem,asshowninthefigure.
ManyoftheinfrastructurechangesrequiredtoaddHTTP/2supporttoyourwebsitewillbeautomaticfromthepointofviewofbothusersandwebsiteoperators.
Onceyou'veappliedthebetapatchtoNGINX,therearejustafewthingsyouneedtodotouseHTTP/2atyoursite:1.
SSL-enableyourwebsite.
2.
Installup-to-dateSSLsoftware.
3.
TurnonHTTP/2supportinNGINX.
4.
UnwindHTTP/1.
1optimizationsthatreduceperformanceforHTTP/2.
Assoonasthefirstthreestepsarecompleted,browsersthatsupportHTTP/2willuseitwhenrequestingwebcontent.
Then,asconvenient,unwindanyperformanceoptimizationsthatyou'veimplementedforHTTP/1.
1,asdescribedbelow.
MakingthesechangeswillsimplifyyourwebapplicationsandimprovetheperformanceofyourwebsiteunderHTTP/2.
Note.
Forfastperformancetodayinproductionenvironments,considerusingSPDY/3.
1onNGINXorNGINXPlus.
SPDYiscurrentlysupportedbymorewebbrowserversionsthanHTTP/2andworkswithearlierversionsofSSL.
CaveatsAfewnotesaboutHTTP/2withNGINXandNGINXPlus:Serverpush-TheHTTP/2serverpushfeatureisnotsupportedinthispatchandwillnotbesupportedinthefirstproduction-readyreleasewithHTTP/2support.
Serverpushmayappearinfuturereleases.
11HTTP/2forWebApplicationDevelopersHTTP/1traffic-EvenafteryouenableHTTP/2,trafficfromolderbrowserversionsthatdonotsupportHTTP/2willcontinuetocommunicatewithyourwebapplicationusingHTTP/1(currentlyabout50%each).
ExpecttotestagainstHTTP/1.
xandsupportit,evenasyourHTTP/2sharegrows,forseveralyearstocome.
SPDYremoved–NGINXversionswithHTTP/2enabledbydefault,asdescribedinStep3below,nolongersupportSPDY.
SPDYisbeingdeprecatedbyGoogleasofearly2016,sothereisnoneedtosupportboth.
1.
SSL-EnableYourWebsiteTheHTTP/2specificationdoesnotrequirethatSSLbeinforce,butcurrentbrowsersdo.
SoSSL-enableyourwebsitetogetitreadyforHTTP/2.
Followthesesteps:1.
GetanSSLcertificate.
Newproviders,somefree,haverecentlycomeonline.
2.
Updateembeddedlinksfromhttptohttps,orhaveNGINXredirectallyouruserstotheSSL-encryptedsitewiththecodesnippetbelow.
server{listen80;location/{return301https://$host$request_uri;}}WithSSLenabled,whenauseraccessesyoursiteusinganHTTP/2-awarewebbrowser,thebrowserwillattempttoconnecttoyourwebserverusingHTTP/2.
Note:YouwillneedtoassessperformancebeforeandaftermovingtoSSLandbeforeandaftermovingtoHTTP/2.
Thisincludesresponsetimeandpeakcapacity.
Besurethatyourhostservercanstillhandlethesameloadaspreviously,bothintermsofresponsetimeandCPUusage.
2.
InstallUp-to-DateSSLSoftwareandLinktoItTheNGINXimplementationofHTTP/2usestheApplicationLayerProtocolNegotiation(ALPN)extensiontoTLS.
PriortoenablingHTTP/2,youmustinstallOpenSSL1.
0.
2,whichincludesALPNsupport,oralaterversion,onyourNGINXservers.
ThenlinktoOpenSSL,asdescribedinStep5ofthisNGINXblogpost.
Note.
Currently,theFirefox(Firefoxversion39)andChrome(Chromiumversion44)browsersalsosupportHTTP/2negotiationusingNextProtocolNegotiation(NPN),whichisavailableinOpenSSL1.
0.
1andlater.
Thissupportisdeprecatedandisduetoberemovedfromthebrowsersinspring2016.
However,fornow,youcanrunonOpenSSL1.
0.
1usingNPNifneeded.
3.
TurnOnHTTP/2inYourServerInordertofinishthemovetoHTTP/2,yourwebserverneedstobereadytoreceiveHTTP/2requests.
YouwillalsowanttoaddanHTTP/1.
x-to-HTTP/2redirector.
12HTTP/2forWebApplicationDevelopersNGINXPlususerssimplyneedtousetheHTTP/2-enabledpackagenginx-plus-http2.
ForNGINXopensource,useVersion1.
9.
6orlater.
ForanyHTTP/2-enabledversionofNGINX,dothefollowing:1.
Addthehttp2parameterand,ifnotalreadyinplace,thesslparameter,toexistinglistendirectives-butfirst,addaURLredirectorforHTTP/1.
x:server{listenserver_namereturn80;nginx.
com;301https://www.
nginx.
com$request_uri;}server{listen443sslhttp2default_server;ssl_certificateserver.
crt;ssl_certificate_keyserver.
key;…}2.
RestartNGINX:#nginx-sreload3.
VerifythatHTTP/2isindeedbeingused.
OnegoodwaytodothisistousetheHTTP/2andSPDYindicatorpluginforGoogleChrome.
Thefigureshowstheplugininuse;abluelightningboltinthebrowseraddressbarshowsthatHTTP/2isactive.
Thewebpageshowstheprotocolas"h2",shortforHTTP/2.
13HTTP/2forWebApplicationDevelopersIfyouhaveanyproxydevices,suchasloadbalancers,ContentDeliveryNetworks(CDNs),andWebApplicationFirewalls(WAFs),theyshouldbemovedbehindtheNGINXserver,sothattheclientcommunicateswithNGINXfirst.
Note:IfyouwanttostaywithHTTP/1forserver-to-servercommunications,youneedtodeployanHTTP/2-to-HTTP/1proxy.
YoucanputanNGINXserverinfrontofyourotherserversasanHTTP/2gatewayandforSSLtermination,asNGINXsupportsHTTP/2connectionsfromwebclientsandautomaticallyusesHTTP/1forcommunicationwiththeserversitisproxying.
4.
ReviewHTTP/1.
1OptimizationsUnderHTTP/2,HTTP/1.
xoptimizationsarelikelytohurtperformance,soyoushouldconsiderremovingthem.
Here'sabrieflistingofthechangestoconsiderandthepotentialbenefits:Domainsharding.
Hostfileswithinasingledomaintosatisfyallrequests.
Thiscutsconnectionoverheadandsimplifieswebsitemanagement.
(IfsomeoralloftheURLsthatyoucurrentlyusecanberesolvedtoasingledomain,andyouhaveawildcardSSLcertificatethatcoversallofthesubdomainsinuse,HTTP/2willtreatthemasone,effectivelyoverridingsharding.
)Imagespriting,concatenatedfiles,inlinedfiles.
Considerremovingorreducingspritingofimages,concatenationofcodefiles,andinliningofdataintoHTMLfiles.
BreakingupcombinedfilescancuttheinitialHTMLfiledownloadtime;reducelonginitialwaitsforlargerfilestodownload;cutsthememoryfootprintofyourwebpage,asyoudon'tneedtokeepbigimageandcodefilesinmemory;andallowscachingtoworkproperlyatalllevels,fromthebrowseronup.
Keepingfilesseparatealsosimplifiesworkflowforsitecreationandmaintenance.
YoumayneedtoexperimenttofindoutwhatpracticesyieldoptimalperformanceunderHTTP/2.
AccessingmanysmallfilesmayslowperformanceevenunderHTTP/2.
Also,largerfilesmightcompressbetterthansmallerfiles,duetoalargercompressioncontext.
Considertestingtoidentifyinstanceswherelimiteduseofimagespriting,fileconcatenation,andfileinliningmightstillbenefitperformance,evenunderHTTP/2.
(Forinstance,youmayfinditworthwhiletospriteagroupofimageswhichmakeupapagenavigationblock.
)Alimitedimplementationofshardingmayalsooffermodestperformanceadvantages,evenintheHTTP/2context.
IfyouuseaCDN,youwillneedtoevaluatewhetheritstilldeliversimprovedperformanceunderHTTP/2.
WhenyoudoimplementHTTP/2,youhavetheopportunityforanaturalexperiment-achancetodocomparisontestinginareal-worldenvironment.
Manyofyouruserswillbeusingbrowserversionsthatdon'tsupportHTTP/2;otheruserswillbeusingbrowserversionsthatdo.
YoucancompareandcontrastperformanceonthetwoprotocolstohelpyouoptimizeyourcodeforHTTP/2performancewithoutaffectingperformancefortheremainingHTTP/1/xuserstoomuch.
ProTip.
Bereadyforincreasedworkintesting,asyouwillneedtotestnewreleasesonbothHTTP/1.
x,forbrowserversionsthatonlysupportthat,andHTTP/2forup-to-datebrowserversions.
14HTTP/2forWebApplicationDevelopersConclusionHTTP/2isanexcitingnewoptionforwebapplications.
Itprovidesstrongsupportformoresecure,simpler,fastersites.
Inadditiontotakingthespecificstepsabove,youmayneedtoconsiderotherimplementationapproaches.
ToimplementHTTP/2inamixedserverenvironment,youcanuseNGINXasanHTTP/2gateway,withSSLterminationincluded.
SimplyputanNGINXserverinfrontofotherserversandenableHTTP/2,asdescribedabove.
TheNGINXserverwillspeakHTTP/1.
xorHTTP/2tobrowsers,asrequired,andHTTP/1.
xandotherprotocolstoproxiedservers.
Youmayalsoneedtoreviewotherimplementationstrategies.
Forinstance,underHTTP/2,CDNsmaylosesomeoftheiradvantage;thebenefitsofusingfasterservers,orserversoneortwostepsclosertotheuser,maybeoffsetbytheextraoverheadofopeningupadditionalconnectionstoaccesstheCDNservers.
(AccordingtotheHTTPArchive,about40%ofthetop1000sitesuseaCDN,sothishasbigimplicationsforsitearchitecture.
)WithHTTP/2,thedomainshardingthat'seasilyimplementedthroughCDNsisnolongeranadvantage,whiletheextrahandshakingneededtoaccessseparateserverswillhurtperformance,withlessoffsettingadvantageduetomultipleconnectionsforfiletransfer.
YouandothersmayfindnewanddifferentperformancetechniquesthathelpyourwebapplicationunderHTTP/2.
Expecttofindlivelyonlinediscussionsaboutthebestwaystousethenewprotocol.
Wehopethiswhitepaperisausefulearlystepinyourjourneytowardgainingthesimplicity,siteperformanceimprovements,andsecurityofferedbyHTTP/2foryourwebapplications.
15HTTP/2forWebApplicationDevelopersAppendix:TheStoryofSPDYSPDYistheprecursortoHTTP/2.
SPDYwasinitiallydevelopedbyGoogleandintroducedin2009asanopen,experimental,non-standardprotocolforspeedinguptheweb.
InmanywaysitisthefoundationforHTTP/2,andisinuseacrossroughly5%ofwebsitesasofAugust2015.
SPDYwasdesignedtospeedupwebsiteswhilerequiringminimalchangesintheinfrastructureoftheInternet.
ThekeytechniquesusedarethesamethatwenowseeinHTTP/2:UseasingleInternetconnection,withrequestsandresponsesmultiplexedonit.
Usebinaryformat,ratherthanplaintext,forheaders.
Compressheaders.
Prioritizerequestsandresponseswithinthesingleconnection.
RequireSSLonallsitesthatsupportthenewprotocol.
SPDYachievedsignificantperformanceimprovementsformostwebsites,withsomepagesloadingmorethan50%faster.
ForSPDYtobeuseful,bothwebserversandwebclientsneedtosupportit.
NGINXisbyfarthemostpopularwebserverthatsupportsSPDY;asofthiswriting,about77%ofsitesthatuseSPDYuseNGINX.
Currently,mostbrowserversionsinactiveusesupportSPDY.
Google,Facebook,andTwitteruseSPDY,andWordPresssiteshavebeenthelargestgeneratorsofSPDYtraffic.
(WordPressrunsonNGINX.
)HTTP/2isbasedonSPDY,withafewchanges.
Themajorchangesare:CompressionisbyHPACKinsteadofZLIB.
HTTP/2makestheprioritizationschememorecomplexandmorepowerful.
DuringtheyearsinwhichHTTP/2wasbeingdeveloped,SPDYwasusedtotestalternativesforusewithinHTTP/2.
WhenHTTP/2wasstandardizedinmid-2015,SPDYsupportwasdeprecated,andSPDYusageisnowexpectedtodecreasesteadily.
16HTTP/2forWebApplicationDevelopersAdditionalResourcesFollowingareafewkeyresourcesforunderstandingHTTP/2:SPDYwhitepaper-TheGoogleChrometeamintroducedSPDYwithawhitepaper.
SPDYblogpost-Google'sIlyaGrigorikexplainssomeSPDYdetails.
HTTP/2Wikipediaentry-IncludesdifferenceswithHTTP/1.
x.
HTTP/2talkandslidedeck-IlyaexplainsthebenefitsofHTTP/2.
HTTP/2RFCandFAQ-TheofficialspecificationforHTTP/2,publishedasaRequestforComment(RFC)onGithub,plusFrequentlyAskedQuestions(FAQ).
HPACKdefinition-TheRFCforHPACKcompression.
OverclockingSSL-Write-upofatalkonSSL/TLShandshakeperformancecosts,includinghandshaking.
HTTP/2chapter-ThechapteronHTTP/2fromIlya'sbook,HighPerformanceBrowserNetworking.
HTTP/2Tradeoffs-Google'sWilliamChancarefullyanalyzesHTTP/2plusesandminuses.
NGINXPlansforSupportingHTTP/2-OwenGarrettofNGINXdescribesthecompany'ssupportforSPDYandplanstosupportHTTP/2.

个人网站备案流程及注意事项(内容方向和适用主机商)

如今我们还有在做个人网站吗?随着自媒体和短视频的发展和兴起,包括我们很多WEB2.0产品的延续,当然也包括个人建站市场的低迷和用户关注的不同,有些个人已经不在做网站。但是,由于我们有些朋友出于网站的爱好或者说是有些项目还是基于PC端网站的,还是有网友抱有信心的,比如我们看到有一些老牌个人网站依旧在运行,且还有新网站的出现。今天在这篇文章中谈谈有网友问关于个人网站备案的问题。这个也是前几天有他在选择...

HostKvm香港VPS七折:$5.95/月KVM-2GB内存/40GB硬盘/500GB月流量

HostKvm是一家成立于2013年的国外主机服务商,主要提供VPS主机,基于KVM架构,可选数据中心包括日本、新加坡、韩国、美国、俄罗斯、中国香港等多个地区机房,均为国内直连或优化线路,延迟较低,适合建站或者远程办公等。商家本月针对香港国际机房提供特别7折优惠码,其他机房全场8折,优惠后2G内存香港VPS每月5.95美元起,支持使用PayPal或者支付宝付款。下面以香港国际(HKGlobal)为...

ftlcloud(超云)9元/月,1G内存/1核/20g硬盘/10M带宽不限/10G防御,美国云服务器

ftlcloud怎么样?ftlcloud(超云)目前正在搞暑假促销,美国圣何塞数据中心的云服务器低至9元/月,系统盘与数据盘分离,支持Windows和Linux,免费防御CC攻击,自带10Gbps的DDoS防御。FTL-超云服务器的主要特色:稳定、安全、弹性、高性能的云端计算服务,快速部署,并且可根据业务需要扩展计算能力,按需付费,节约成本,提高资源的有效利用率。点击进入:ftlcloud官方网站...

http://www.anquye.com/为你推荐
工信部约谈电信去工信部网站投诉电信是否有效网易网盘关闭入口网易网盘 怎么没有了太空国家世界上第一个把人类送入太空的国家是哪国?对对塔101,简单学习网,对对塔三个哪个好西部妈妈网我爸妈在云南做非法集资了,钱肯定交了很多,我不恨她们。他们叫我明天去看,让我用心的看,,说是什么...甲骨文不满赔偿不签合同不满一年怎么补偿www.20ren.com有什么好看的电影吗?来几个…钟神发跪求钟神发名言出处,A站大神看过来www.119mm.comwww.kb119.com 这个网站你们能打开不?kb123.net连网方式:wap和net到底有什么不一样的
韩国服务器租用 vps虚拟服务器 a2hosting 便宜域名 双12活动 服务器日志分析 realvnc 中国特价网 台湾谷歌地址 京东商城0元抢购 工信部icp备案号 共享主机 域名接入 网络空间租赁 国外ip加速器 空间租赁 备案空间 免费的域名 广州虚拟主机 工信部网站备案查询 更多