Upload
others
View
3
Download
0
Embed Size (px)
Citation preview
Monday,February29,2016
Caffeine
CaffeinereducesnetworklatencyinnativeiOSapplications.
Thisdocumentempiricallydiscussesthefollowingtwospecificitems:
• Theamountoflatencyreduced• Whatcharacteristicsaffectlatencyreduction
Abstract
We collocate a server in Switzerland and repeatedlydownload images from it using an iOS Simulator. Inconducting downloads of a series of images, we find thatfully encrypted Caffeine has 4.5x-8.5x greater throughputthanHTTPS showing a just as great decrease in perceivednetwork latency. We find Caffeine’s improvements overHTTPS to be consistent despite network congestion orotherwiseadverseconditions(packetloss,lotofdevicesonthenetwork,etc).
AHistoricalExperiment:ConsumerTechnologyoverTime
AnOSXserverinZurichSwitzerlandcontainstwenty-fourimagesofgreat
achievement—fromEdison’s1877cylinderphonographtoMusk’sSpaceX.Theseimagestotal1.615506MB.Smallerversionsoftheseimagesarebelow.
1 2 34
5 67
8
9 1011
12
13
14
1516
17
18
19
20
21
22 23
24
Thesetwenty-fourimagesaredownloadedfromtheserverinSwitzerlandto
aniOSsimulatorinCambridge,Massachusettsconsecutivelyfromoldesttonewest(1to24).Thesizesinbytesofeachindividualimagearebelow.
1 1069412 944823 52574 956555 514686 52407 1661998 150919 15400910 3877211 1293212 6551513 6548614 7848015 1470316 7345117 5560518 5575019 1672220 1335821 30949722 4266923 7125924 6965TotestHTTP/Sdownloads,weusethetraditionalNSURLSessionprovidedbyApple’sFoundationLibrary.Totestouralternativeapproachtomobilenetworking,weuseCaffeine’sprovidedAPIs.
Methodology
InattempttoscientificallyevaluatethedifferencebetweenCaffeineandHTTPSasitpertainstoimages,wetookthefollowingsteps.Note:Alldatawascollectedfromwithinthesame100-meterradiusincludingnoothersmartphones/laptops.AlltestswererunontheHarvardUniversitysecureWiFi.Theresultsinthisstudymaybemoredramaticthaniftheclientandserverwereinthesamecountry(U.S.toU.S.connection,e.g.).Weplantotestthisvariableintheimmediatefuture.
1. InCambridge,MA,starttheclientonaniPhone6simulatorrunningiOS9.2fromXcodev7.2
2. InZurich,Switzlerlandstartbothbackendservers(CaffeineandApache)onOSXElCapitan10.11.3with2.48GHzprocessingpowerand2GBDRAM.
3. PingserverinSwitzerland(usingICMP)100timesandrecordthefollowing:a. Averageping,b. Standarddeviationofpingc. Packetloss.
4. MakeaninitialrequestforimagesfromtheclientusingCaffeinetoremoveTCPSlowstart.
5. InitiateCaffeineclientrequesting24imagesfromCaffeineserver12timeswithnogreaterthan1secondinbetweeneachofthe12times.
6. MakeaninitialrequestforimagesfromclientusingHTTPStoremoveTCPSlowstart
7. InitiateNSURLSessionrequesting24imagesfromApacheserver12timeswithnogreaterthan1secondinbetweeneachofthe12times.
8. Repeatsteps3-7foratotalof10timeswherethenumberofimagesrequestedissomedifferentmultipleofthree(3,6,9,…27,30–after24images,wereuseimagesfromthebeginning)
Results
Forevery10sets(eachwithanadditional3images)oftrials(12forCaffeine,12forHTTPS),wehavethefollowingresults.
0.398 0.413 0.434 0.399 0.385 0.386 0.388 0.386 0.397 0.422 0.389 0.397
2.603 2.486 2.6532.271
2.649 2.603 2.486 2.404 2.4
3.317
2.4072.818
0
0.5
1
1.5
2
2.5
3
3.5
1 2 3 4 5 6 7 8 9 10 11 12
SecondsElapsed
TrialsfromCambridge,Mass.Meanping117ms(+-1.3ms)3.3%pl
PostTCPSlowstart:DownloadDurationsfor3images(0.20668mb)
Caffeine
HTTPS
0.619 0.6011.082 0.898 0.645 0.613 0.597 0.61 0.649 0.648 0.645 0.62
4.757 4.516 4.705 4.7445.331
4.759 4.5985.022
4.696 4.5114.866 5.01
0
1
2
3
4
5
6
1 2 3 4 5 6 7 8 9 10 11 12
SecondsElapsed
TrialsfromCambridge,Mass.Meanping118ms(+-1.1ms)
PostTCPSlowstart:DownloadDurationsfor6images(0.359043mb)
Caffeine
HTTPS
1.234
3.619
2.319
1.262 1.15 1.1482.067
1.146 1.183 1.1491.934
1.263
7.688 7.877.257 7.491 7.319 7.487 7.483 7.518 7.518 7.32
8.1577.233
0
1
2
3
4
5
6
7
8
9
1 2 3 4 5 6 7 8 9 10 11 12
SecondsElapsed
TrialsfromCambridge,Mass.Meanping120ms(+-11.7ms)0.0%pl
PostTCPSlowstart:DownloadDurationsfor9images(0.694342mb)
Caffeine
HTTPS
1.529 1.255 1.244 1.249 1.244 1.212 1.248 1.246 1.213 1.214 1.214 1.28
10.38411.08411.5310.751
10.1099.66510.32710.941
11.426
10
11.15610.985
0
2
4
6
8
10
12
14
1 2 3 4 5 6 7 8 9 10 11 12
SecondsElapsed
TrialsfromCambridge,Mass.Meanping(117ms(+-1.4ms)
PostTCPSlowstart:DownloadDurationsfor12images(0.811561mb)
Caffeine
HTTPS
1.92 1.867
3.4042.67
3.4562.67 2.099 2.201
3.655 3.122.419
3.035
12.454
14.776
13.10313.25312.83513.581
12.08313.003
12.16513.51
12.301
14.993
0
2
4
6
8
10
12
14
16
1 2 3 4 5 6 7 8 9 10 11 12
SecondsElapsed
TrialsfromCambridge,Mass.Meanping134ms(+-35.2ms)0.0%pl
PostTCPSlowstart:DownloadDurationsfor15images(0.970230mb)
Caffeine
HTTPS
1.835 2.502 1.837 1.834 1.8123.07
2.017 1.8682.999 2.958 2.752 2.581
15.34515.99916.164
14.90815.78315.60315.49716.083
14.6815.444
18.333
15.483
0
2
4
6
8
10
12
14
16
18
20
1 2 3 4 5 6 7 8 9 10 11 12
SecondsElapsed
TrialsfromCambridge,Mass.Meanping137ms(+-42.0ms)6.7%pl
PostTCPSlowstart:DownloadDurationsfor18images(1.176910mb)
Caffeine
HTTPS
3.411 3.4874.663
3.528 2.7493.839 3.956
2.619 2.67 2.953 2.7484.492
19.74317.78316.96516.80216.748
17.63216.4516.935
17.35116.46817.252
18.542
0
5
10
15
20
25
1 2 3 4 5 6 7 8 9 10 11 12
SecondsElapsed
TrialsfromCambridge,Mass.Meanping131ms(+-33.5ms)1.0%pl
PostTCPSlowstart:DownloadDurationsfor21images(1.329273mb)
Caffeine
HTTPS
3.756 2.991 3.009 3.0363.843
3 3 3.407 2.952 3.032 2.955 2.986
19.95618.96119.42119.67419.15719.61218.956
20.27720.32621.334
22.282
19.254
0
5
10
15
20
25
1 2 3 4 5 6 7 8 9 10 11 12
SecondsElapsed
TrialsfromCambridge,Mass.Meanping113ms(+-36.4ms)
PostTCPSlowstart:DownloadDurationsfor24images(1.615506mb)
Caffeine
HTTPS
3.672 2.9924.108
2.772 2.988 2.754 2.737 2.686 2.855 3.254 2.7414.663
20.82921.0521.33221.43321.83121.83
23.49121.12921.784
22.70220.82921.116
0
5
10
15
20
25
1 2 3 4 5 6 7 8 9 10 11 12
SecondsElapsed
TrialsfromCambridge,Mass.Meanping126ms(+-56.0)0.0%pl
PostTCPSlowstart:DownloadDurationsfor27images(1.822186mb)
Caffeine
HTTPS
3.823 3.835 3.839 3.837 3.545.777
4.493 4.025 3.793 3.989 3.991 3.821
26.07624.60624.52624.52324.82524.69525.663
25.96227.55127.40327.325
24.578
0
5
10
15
20
25
30
1 2 3 4 5 6 7 8 9 10 11 12
SecondsElapsed
TrialsfromCambridge,Mass.Meanping119ms(+-5.3ms)0.0%pl
PostTCPSlowstart:DownloadDurationsfor30images(2.028866mb)
Caffeine
HTTPS
Across-sectionallookattheaverageresults:
0.39950.685581.262331.62283
2.709672.338753.42625
3.96953.18517
4.06358
2.59142
4.79292
10.65733
7.52842
13.17142
15.77683
17.38925
19.98867
21.613
25.64442
-5
0
5
10
15
20
25
30
1 2 3 4 5 6 7 8 9 10
SecondsElapsed
Imagesets(eachperiodrepresentsanadditional3images)
AverageDownloaddurationsforsetsofimages(3,6,9,...,27,30)
Caffeine
HTTPS
Across-sectionallookatthemedianresults:
Onaverage,Caffeineisanywherefrom400%-850%fasterthanHTTPS.Therearesomeanomaliesinthedatasuchasthe4thperiodinthemediangraph(above).Thiscanbeexplainedbywavesofcongestiononthenetwork,orlatencyoverseas.Acrosstheboard,theimprovementgainsofCaffeineoverHTTPSremainrelativelyconsistent.Becauseeachperiodreceivesanadditional3images,theirtotaldatasizedoesnotincreaselinearlylikethetotalnumberofrequests.Forexample,anadditional3
0.397 0.6325 1.245 1.248
2.67 2.25953.449 3.477 2.9215
3.838
2.5445
4.7505
10.846
7.489
13.053
15.55
17.1085
19.979521.3825
25.244
0
5
10
15
20
25
30
1 2 3 4 5 6 7 8 9 10
SecondsElapsed
Imagesets(eachperiodrepresentsanadditional3images)
MedianDownloadDurationsforsetsofimages
Caffeine
HTTPS
imagesfetchedfromtheserveralwaysresultsin3additionalrequests,buttheamountoftotaldataforeachofthoserequestsisvariable.Tonormalizethisvariation,wedeterminetheaveragethroughput(bytes/second).
ThisgraphmuchmoreclearlydisplaysthedifferenceofCaffeine.Itdescribeshowmuchdatacan“fitthroughthepipe”persecond.OntheX-axis,thetotalnumberofrequestsincreasesby3periodically.Intimesofnetworkstressorcongestion,suchasinthe3rdperiodabove(9requests),theperformanceofHTTPSprorateswiththeperformanceofCaffeine.ThissuggeststhatCaffeine’sperformancerelativetoHTTPSremainsconsistentdespiteunpredictablenetworksphenomena(severeweather,congestion,miscellaneouslatency).
0
100000
200000
300000
400000
500000
600000
700000
800000
1 2 3 4 5 6 7 8 9 10
Averagebytestransm
ittedpersecond
Trials(eachperiodrepresentsamultipleof3requests)
AverageThroughputforaseriesofimagerequests
Caffeine
HTTPS
ThepercentagegainofCaffeineversusHTTPSisshownbythegraphbelow.
TheminimumaveragemultiplierimprovementofCaffeineoverHTTPSshownbythisgraphis~450%,whilethemaximumis~850%.
ClosingRemarks WhendevelopingCaffeine,wecontinuallyaskedwhatisactuallynecessaryforiOSapplicationnetworkingenvironments.Thisapproachhasresultedinthereductionofalotof(whatturnouttobe)unnecessaryfeatures/datainHTTP.TheamountofbloatandlatencyincipienttoHTTPsurprisedusquitealot. Forthcomingresearchincludequantitativeanalysesofresourceusage—determininghowmuchbandwidth,CPU,battery-lifewouldbesavedinaCaffeinatedenvironment. Caffeine,asfarasweknow(andwe’velooked),isthefastestwaytosenddatainiOSrequest-responsearchitectures.Weknowthisisthefutureofnetworking,andwearelookingforthoseintrepidearlyadopters.Emailusbeyondjava@caffei.net
Thefutureisalreadyhere—it’sjustnotevenlydistributed.—WilliamGibson
0x1x2x3x4x5x6x7x8x9x
1 2 3 4 5 6 7 8 9 10Caffeinethru/HTTPSthru
Numberofimagerequests(multiplesof3)
AveragePerformanceGainsMultiplesofCaffeineComparedto
HTTPS