1 / 30

Performing Better and Provisioning Less with Caching

Performing Better and Provisioning Less with Caching. Jason Fish Purdue University @ jasondfish. SlashDot Effect When a popular website links to a smaller site, causing a massive increase in traffic - Wikipedia. Syllabus Effect

natan
Download Presentation

Performing Better and Provisioning Less with Caching

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Performing BetterandProvisioning LesswithCaching Jason Fish Purdue University @jasondfish

  2. SlashDot Effect When a popular website links to a smaller site, causing a massive increase in traffic - Wikipedia

  3. Syllabus Effect When excitement and worry at the start of the semester causes a massive increase in traffic

  4. Assignment Effect When an online assignment is due and causes a massive increase in traffic

  5. Performance is a feature, and just like any other feature, it must be continuously monitored and tested • James Socol • Mozilla’s Community Platform Manager http://www.flickr.com/photos/philippeleroyer/2070899672

  6. Database Caching • Saving the results of a database query so that they can be used in the future

  7. 97%

  8. ASP.NET C# public static Person GetPersonByID(intpersonID) { var person = Cache.Get(“Person_GetPersonByID” + personID.ToString()); if (person == null) { person = from p in people where p.id = personID select p; Cache.Insert(“Person_GetPersonByID” + personID.ToString(), person); } return (Person)person; } http://msdn.microsoft.com/en-us/library/system.web.caching.cache.aspx

  9. ColdFusion <cfquery name=“getPersonByID” datasource=“MyDataSourceName” cachedwithin=“#CreateTimeSpan(0,6,0,0)#”> select PersonID, PersonName, PersonAddress from People where PersonID = <cfqueryparam value=“#url.personid#” cfsqltype = “CF_SQL_INTEGER”> </cfquery> http://help.adobe.com/en_US/ColdFusion/9.0/CFMLRef/WSc3ff6d0ea77859461172e0811cbec22c24-7fae.html

  10. PHP <?php $mysqli = new mysqli(“host”, “user”, “password”, “database”); $res = $mysqli ->query( “/*” . MYSQLND_QC_ENABLE_SWITCH . “*/” . “Select PersonID, PersonName From People where PersonID = 1” ); var_dump($res->fetch_assoc()); $res->free(); ?> http://php.net/manual/en/mysqlnd-qc.quickstart.caching.php

  11. Expires Header The Expires Header tells the client to use the cached version of a component until a date in the future

  12. 93% 98%

  13. ASP.NET <configuration>   <system.webServer>      <staticContent>         <clientCachecacheControlMode="UseExpires"httpExpires="Tue, 19 Jan 2038 03:14:07 GMT" />      </staticContent>   </system.webServer></configuration> http://www.iis.net/configreference/system.webserver/staticcontent/clientcache

  14. ColdFusion <cfheader name=“Expires” value=“Sat, 12 Jan 2019 17:00:00 GMT”> <cfsetmyImage = imageRead(expandPath(“image.jpg”))> <cfcontent type=“image/jpg” variable= “#imageGetBlob(myImage)#”> http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=Tags_g-h_07.html

  15. PHP <?php $offset = 60*60*24*14; $expire = ‘Expires: ' . gmdate ('D, d M Y H:i:s', time() + $offset) . ' GMT'; header ($expire); ?> http://php.net/manual/en/function.header.php

  16. ASP.NET http://miniprofiler.com/ http://nuget.org/ http://stackoverflow.com/ http://www.hanselman.com/blog/NuGetPackageOfTheWeek9ASPNETMiniProfilerFromStackExchangeRocksYourWorld.aspx

  17. : Mini Profiler : <cfsettingshowDebugOutput=“Yes”> : Zend IDE DBG Extension APD Extension Xdebug Extension

  18. SQL Server Profiler http://msdn.microsoft.com/en-us/library/ms181091.aspx

  19. Free for up to 25 simultaneous users • Academic discounts available • Easy to use • Produces easy to understand reports http://loadstorm.com/

  20. developer.yahoo.com/yslow/ developers.google.com/speed/

  21. purdue.edu/studio

More Related