下载

5下载券

加入VIP
  • 专属下载特权
  • 现金文档折扣购买
  • VIP免费专区
  • 千万文档免费下载

上传资料

关闭

关闭

关闭

封号提示

内容

首页 Varnish Cache 原理说明文档

Varnish Cache 原理说明文档

Varnish Cache 原理说明文档

张宴
2007-08-29 0人阅读 举报 0 0 暂无简介

简介:本文档为《Varnish Cache 原理说明文档pdf》,可适用于IT/计算机领域

TheVarnishRoadshowVerdensGangPresentsALinproProductionTheVarnishRoadshowstarringTheVarnishHTTPacceleratorDesignedandcodedby:PoulHenningKampProjectinfrastructure:DagErlingSmørgravBasedonanideaby:AndersBergContentmanagementsystemFromWikipedia,thefreeencyclopediaJumpto:navigation,searchAcontentmanagementsystem(CMS)isacomputersoftwaresystemusedtoassistitsusersintheprocessofcontentmanagementCMSfacilitatestheorganization,control,andpublicationofalargebodyofdocumentsandothercontent,suchasimagesandmultimediaresourcesACMSoftenfacilitatesthecollaborativecreationofdocumentsSuggestedaddition:CMSsystemsusuallypublishcontentviaaterminallyslowHTTPserver,andthereforeneedHTTPaccelerationRFCcastlistWebbrowsersCansometimescacheperuserdataCannevercacheperuserdataCMSsystemAHTTPAcceleratorisnotaHTTPcacheCachingpolicycanbetailoredtoCMSsystemandsitepoliciesRFCcomplianceas”originserver”ThewebsiteVGnoisoneofNorwayslargestintermsoftrafficClassicalnewssite:rapidlychangingcontentsinaslowCMSsystemSquidcachesusedasacceleratorsUnhappywithperformanceandstabilityMultimediaarmofNorvegiannewspaper”VerdensGang”SignificantlossSlowresponseTerriblepeakhandlingObviously,usingaclientsidecacheforserveraccelerationisaskingfortroubleButtherearenobetterOSSalternativesBesides,whydoesSquidsucksobadlySquidisanantiquesoftwaredesignRAMDISKCPUBusRAMDISKCPU(andbesides,wehavethisoperatingsystemwhichvirtualizesallofit)Notyourdadscomputeranymore:CPUsCoresCachesTheVirtualPageCacheformerlyknownas”RAM”Objects,possiblyonstorageSquidmovesdatabetweenRAManddiskSquiddoesnotusevirtualmemoryatallKerneldefinitivelyschedulesdatabetweenRAManddiskThefightmultipliesdiskIObytimesRAMDISK(filesystem)RAMDISK(filesystem)DISK(paging)Iknowwhatyou'rethinking,proc:'DidhesendSIGHUPorSIGTERM'Well,totellyouthetruth,I'veforgottenmyselfinallthisexcitementButbeingasthisisSIGKILL,themostpowerfulsignalinUNIX,andwouldblowyourmemoryclean,you'vegottoaskyourselfaquestion:'DoIfeellucky'Well,doya,procFightingthekernelfromuserlandisplainstupidStartingfromscratch:VarnishisaHTTPacceleratoronlyBetterconfigurationBettermanagement(Much)fasterContentManagementFeatures$ cat etcfoobarconf# foobard configuration file# copied from exampleconf#        svend # updated to new version#        knud # various changes#        valdemar # DON'T MESS WITH THIS!!!WhatisitaboutconfigurationfilesHDXHSVVaCS=allocationmodulus=⊕ℵ∰(feij)# overflow queue default=overflowqueue=processbackwards=ifacldoesnotaclset= {        }invertacls=oddaclreset = {  ! }VCLVarnishConfigurationLanguagesubvclrecv{if(reqrequest!="GET"reqrequest!="HEAD"){pass}if(reqhttpExpect){pipe}if(reqhttpAuthenticate||reqhttpCookie){pass}lookup}WhyYetAnotherLanguageWhynotsimplyuse{PERL,Tcl,Python,Ruby}TheprogrammerswillnotbeprogrammersSpeedDidyoumiss”domainspecific”ButyouneedtowriteacompilerWithoutthehazzleofarchitecturefitting,(whichregisters,whichinstructionsc)acompilerisreallyjustatextprocessingappWecompileVCLtoCandusecc()inlinesofcodeManagingVarnishCommandLineInterfaceforrealtimecontrolManagementWorkerprocesssplit:ManagercanrestartworkerAllowspriviledgeseparationContainsthreadingtoworkerprocessClusterControllerManagerCacherChildProcMgtCmdLineInitializationParamsArgsCmdLineStorageLogStatsAcceptherderWorkerthreadsGrimReaperCcompilerSharedobjectCmdLineWebinterfaceCMSinterfaceSMSinterfaceCLIinterfaceOnebinaryprogramSharedMemorylogwriterstatsadhocBackendHashingVCLcompilerWatchdogVarnisharchitectureThe:amCheatSheet:#scpfromhost:varnishd#varnishdbmywebservera:#sshdnshostndcreloadPerformanceandspeedProgramforperformanceUsemodernfeatures:VirtualMemorysendfile(),acceptfilters(),kqueue()(andeveryothertrickinthebook)●char*p=●strlen(p)●memcpy(p,q,l)●Locking●SystemCall●ContextSwitch●DiskAccess●FilesystemoperationCPUMemoryProtectionMechanicalssPerformancePricelistFILE *flogflog = fopen(”varlogmylog”, ”a”)fprintf(flog, ”s Something went wrong with sn”,    timestamp(), foostr(object))fflush(flog)Filesystemoperation,calledonceDiskIO,calledmiotimesClassicalloggingishorriblyexpensive:∙,,*=minuteschar *logp, *logefd = open()logp = mmap(, size)loge = logp  sizelogp = LOGERRORlogp = sprintf(logp  ,     ”Something went bad with s”, foostr(obj))logp  logp = LOGENDlogp = LOGENTRYlogp =   logpMemoryandarithmetic,miocallsFilesystemops,calledonceLoggingtosharedmemoryisalmostfree:∙,,*=secondsVarnishtop()–logfile”top”programWhatismymostpopularURL$ varnishtop ­i rxurl    tmvjs     sistenytthtml     includeglobalartjs     csshovedcss     gfkannngif     gfkannnggif     gfkfronttipsvgpng      cssufrontcss     tgif     gfkplugif     cssfrontcss     gfkmingif      cssblogcss        Referer: http:wwwvgno    Referer: http:vgno     Referer: http:wwwvgno     Referer: http:wwwvgnopubvgarthbsartid=     Referer: http:wwwvgnoexportTransactmenuhtml      Referer: http:wwwvgnopubvgarthbsartid=     Referer: http:wwwvgnopubvgarthbsartid=     Referer: http:wwwvgnoexportTransacttophbs     Referer: http:wwwnettbynouser     Referer: http:wwwvgnosportfotball     Referer: http:wwwvgnopubvgarthbsartid= Wheredoesmytrafficcomefrom $ varnishtop ­i rxheader ­I RefererVarnishhist()Responsetimehistogram | | | | | | | | | | | | | | || |||||||||| |           #  #  ##        ##            #­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­­|e­     |e­     |e­     |e­     |e­     |e      |e      |eCacheHitsCacheMisses::Hitrate ratio:                        Hitrate avg:                              Client connections accepted                Client requests received                Cache hits                          Cache hits for pass                         Cache misses                         Backend connections initiated                            Backend connections recyles                             Backend connections unused                           N struct srcaddr               ­          N active struct srcaddr                           N struct sessmem               ­          N struct sess                          N struct object                          N struct objectheadRealtimestatisticsviasharedmemoryCLImanagement$ telnet localhost Trying Connected to localhostEscape character is '^'paramshow      defaultttl           secondsthreadpools          poolsthreadpoolmax       threadsthreadpoolmin       threadsthreadpooltimeout   secondsoverflowmax          httpworkspace        bytessesstimeout          secondspipetimeout          secondssendtimeout          secondsautorestart         on boolCLImanagementparamshow overflowmax      overflowmax                     Default is                 Limit on overflow queue length in                percent of threadpoolmax parameter                                     NB: We don't know yet if it is a good                idea to change this parameter                Caution advisedCLImanagementhelp      Available commands:ping timestampstartstopstatsvclload <configname> <filename>vclinline <configname> <quotedVCLstring>vcluse <configname>vcldiscard <configname>vcllistparamshow ­l <param>paramset <param> <value>help commandurlpurge <regexp>dumppool”Minusdddebugging”Daemonshavetraditionallytaken'd'tomean”runinforegroundwithdebugging”Varnishallowsyoutosendtheprocessinto”daemonmode”whenstartedwithdNoneedtostopstartagain,onceyou'rehappywithhowitisrunningContentManagementFeatures:Instantpurges(URLorregexp)TTLCachingpolicycontrolinVCLLoadSituationmitigationinVCLVersionfeatures:GZIP,Edgesideincludes,Vary:etcSquidVarnishSquidserversVarnishserversserversW=MWhyMWh*kg=tCOequivFurthersavings:NetworkequipmentRackspaceCoolingSystemAdminHours$ netstat ­I bge             input         (bge)           output   packets  errs      bytes    packets  errs      bytes colls                                                              ^C$ uptime:PM  up  days,  :,  user, load averages: , , SampleMinMaxMedianAverageStddevFull,,,,fractile,,,,(alltimesareinmicroseconds)objsMbitsWedon'treallyknowhowfasthaveseenMbitshaveheardkobjshavenothitthelimityetVarnishversionstatusApproxklinesofcode(squidsources:k)AverysolidfoundationdesigncodewisePrettydarngoodqualityforaversionstilltoomany”assert(foo)*XXXfixthis*”Pickingupmoreandmoreusers(happyusers,asfarasIcantell)VersionplansBugfixesMoreVCLfeaturesGZIPcompressionPrefetchingVary:processingEdgeSideIncludes”ESI”Sponsorscontact:perbuerlinpronovar·nish(värʹnĭsh)naApaintcontainingtrvvar·nished,var·nish·ing,var·nish·esTocoverwithvarnishTogiveasmoothandglossyfinishtoTogiveadeceptivelyattractiveappearancetoglossoverhttp:varnishcacheorgReferenceOS:FreeBSD,UbuntuPackagesavailable:Yes!Portableto:anyreasonablePOSIXCommercialsupport:LinpronophkFreeBSDorg

用户评价(4)

  • 113.89.134.184 感觉不出来

    2010-03-30 00:08:04

  • 10.218.20.140 最新的2.0版本varnish原理研究成果请去ncache 的官方网站下载 ncache.org 或者直接用这个链接吧 http://ncache.googlecode.com/files/varnish.pdf

    2008-12-02 18:42:42

  • 221.221.152.246 使用Varnish代替Squid做网站缓存加速器的详细解决方案 http://blog.s135.com/read.php/313.htm

    2007-12-08 20:23:05

  • 221.221.152.246 使用Varnish代替Squid做网站缓存加速器的详细解决方案 http://blog.s135.com/read.php/313.htm

    2007-12-08 20:22:38

关闭

新课改视野下建构高中语文教学实验成果报告(32KB)

抱歉,积分不足下载失败,请稍后再试!

提示

试读已结束,如需要继续阅读或者下载,敬请购买!

文档小程序码

使用微信“扫一扫”扫码寻找文档

1

打开微信

2

扫描小程序码

3

发布寻找信息

4

等待寻找结果

我知道了
评分:

/47

Varnish Cache 原理说明文档

VIP

在线
客服

免费
邮箱

爱问共享资料服务号

扫描关注领取更多福利