theory Archives - Digital Tool Factory blog

The Digital Tool Factory Blog

How to explain caching to clients

'Translator' photo (c) 2010, Mace Ojala - license: http://creativecommons.org/licenses/by-sa/2.0/I recently implemented a quick performance fix on a client’s site recently by implementing caching.  I explain caching with the following metaphor.

Imagine that your site is a book.  A book written in a weird mix of Latin, Sanskrit and Old Norse.    It’s precise,  complicated and requires translation into English by an expert translator before it can be read by the public.

Your web server translates the book.  Anytime, someone tries to read the book they cannot read it directly; they need someone (the web server) to translate the book.  This can take a lot of time and energy for the translator to do, but it has to be done.

 

A simple version of the process

To clarify, the process works like this

  1. Person makes a request, i.e. “what does that book say? [Non Resource Intensive Step]
  2. The translator looks at the book, and makes a careful translation into modern day English of the book from the original Latin, Sanskrit, and Old Norse.    This can take a long time [Resource Intensive Step].
  3. After the translator completes the translation he sends it on it’s way to the person who made the request [Non Resource Intensive Step].
  4. The person who makes the request receives the translation and the interaction is complete [Non Resource Intensive Step].

That all sounds good, but the problem is that the four step process has to happen each and every time anyone makes a request, especially the resource intensive step two.  So, if a web page gets 1000 requests an hour, resource intensive step #2 runs 1000 times.

 

The first request with caching

Now imagine if the translator makes a copy of the English translation after he sends it out the first time.  The first time someone makes a request for a translation the process looks like this.

  1. Person makes a request, i.e. “what does that book say? [Non Resource Intensive Step]
  2. The translator checks to see if there are any photocopies of the translation that are less than an hour old [Non Resource Intensive Step]
  3. The translator looks at the book, and makes a careful translation into modern day English of the book from the original Latin, Sanskrit, and Old Norse.    This can take a long time. [Resource Intensive Step]
  4. After the translator completes the translation he makes photocopies of the translation. [Non Resource Intensive Step]
  5. Then the translator sends the photocopy of the translation on it’s way to the person who made the request. [Non Resource Intensive Step]
  6. The person who makes the request receives the translation and the interaction is complete. [Non Resource Intensive Step]

Subsequent requests with caching

Subsequent requests for the book look like this

  1. Person makes a request, i.e. “what does that book say? [Non Resource Intensive Step]
  2. The translator sends the photocopy of the translation on it’s way to the person who made the request. [Non Resource Intensive Step]
  3. The person who makes the request receives the translation and the interaction is complete. [Non Resource Intensive Step]

The first time someone makes a request the process runs a little slower, but since each subsequent request for the book omits all of the resource intensive steps, the whole process take up much less time and fewer resources, making for a much lower delivery time on average, e.g. for every 1000 requests for a page, resource intensive step #2 runs 1 time, not 999 times.

Making a photocopy is pretty close to caching.  The web server makes a copy of the page it just created and sends it on it’s way to web browsers.

 

What are the downsides of caching?

What are the downsides of caching, and why doesn’t everyone use it?   I’ve seen two main reasons not to use caching.

  1. The contents of the book can change unexpectedly.  If it does, then the translator is handing out old editions of the book.  That might be fine for some sites, but for others it might be catastrophic   For example, if a blog serves up a slightly out of date version of a post no one will care that much, but if a stock market application serves up old stock prices people will care a lot.  With caching, the translation/web page can be up to an hour old.
  2. It makes debugging much harder if everyone sees slightly different versions of the same thing.

That’s how I explain caching to clients.  I’ve always had people find the metaphor clear and easy to understand.


18
Mar 13


Written By Steve French

 

Exploring the long tail topics of my personal knowledge

Stop and ThinkOne lesson I learned (not from anything specifically said, purely a deduction) from this excellent Mixergy interview with Brian Crane of LuckyGunner.com is to NOT weave  small thoughts into the big picture, but to instead let them be small thoughts. Apparently LuckyGunner.com succeeds by chasing the long tail.  Therefore I am going to keep the “How To Fix” and “Code Sample” series, but keep  the meta blogging about business and network theory to a minimum.

Now that I see all this written out I have the thought that I should finalize the public Stronico sites.  I had tentatively scheduled public sites for about six months from now, but perhaps they should be moved up.  The public sites would be public accessible, read only Stronico accounts,  viewable to all but only updatable by administrators, sort of the wikipedia of social network diagrams.  The first few would be based on either my particular local knowledge or publicly available knowledge.  The first few public sites would:

  • The current Atlanta independent music scene, defined as bands, bookers, clubs, musicians etc and the like.   (present day and adaptable)
  • The East Atlanta small business community, and by East Atlanta I mean more than the Village.  I am defining East Atlanta as East Atlanta (the neighborhood), Ormewood Park, Grant Park, Woodland Heights, and Rebel Forest.
  • The Atlanta Woodworking Community – both craftsmen and vendors
  • The Atlanta Guitar community, i.e.  people who buy, sell, and treasure find musical instruments (defined as those costing over $2,000)
  • The Atlanta graphic design community, both firms and designers
  • The Atlanta Microsoft ecosystem, players, institutions, and firms.
  • The American used Sterling Silver Market,  including merchants, manufactures, wholesalers and museums.
  • The Metro Atlanta convention industry

Should any of these sites get any amount of traffic they could be sponsored by an industry leader like Stomp and Stammer or the Metro Atlanta Chamber of Commerce.

I realize that this blog post is a poorly written answer to a question that no one asked, that’s most of the internet when you think about it

Creative Commons Licensephoto credit: DWRose

 

This post originally appeared on the Stronico blog – with the absorption of Stronico into Digital Tool Factory this post has been moved to the Digital Tool Factory blog


30
Sep 10


Written By Steve French

 

How I engineer my life for maximum productivity

Keep Out Experiment In ProgressSo far 2010 has been the year of gradual improvements in life, health and productivity.  I made most of these changes based on what I learned in Brain Rules.  Here is a snapshot of my changes so far:

General Improvements:

  • No more smoking (though it did take two months to get my concentration back)
  • 8 hours of sleep per night (up from 6)
  • Minimal alcohol consumption (I never drank that much, but I now drink alcohol once a month or less.  I think I’m more sensitive to sugars than anything else)
  • Six hours or more of intense aerobic exercise a week cycling, and 11 of mild exercise (walking the new dog).    I think I’m close to the optimal level of physical activity for maximum brain function.

Workplace Improvements Continue reading →


10
May 10


Written By Steve French

 

Everyone should read Brain Rules by John Medina

Brain CoralSeveral months ago I finished reading Brain Rules by John Medina and I’ve been raving about it ever since.  Medina is a noted brain researcher and the book contains the 12 things he wishes the lay public knew.

The 12 things (with my notes in bold and italic)

  1. EXERCISE | Rule #1: Exercise boosts brain power. – The most important chapter.  Short version – if you exercise your brain will be smarter and it won’t get dementia.  I’ve put this to the test, and I am more focused with exercise than without.
  2. SURVIVAL | Rule #2: The human brain evolved, too. – Not that memorable, good background information.
  3. WIRING | Rule #3: Every brain is wired differently.- Not that memorable, good background information.
  4. ATTENTION | Rule #4: We don’t pay attention to boring things.- Intuitive,  and general background information
  5. SHORT-TERM MEMORY | Rule #5: Repeat to remember. – Important, counter intuitive info on memory.
  6. LONG-TERM MEMORY | Rule #6: Remember to repeat.- Important, counter intuitive info on memory.
  7. SLEEP | Rule #7: Sleep well, think well. – The second most informative chapter.  I had always thought of sleep as a time of rest, it turns out to be a very active process for the brain.   Sleep is when the brain cleans and restocks itself.
  8. STRESS | Rule #8: Stressed brains don’t learn the same way. – I had no idea that stress was the physical reaction that it is.  This is the third most important chapter.
  9. SENSORY INTEGRATION | Rule #9: Stimulate more of the senses. – Good advice for graphic designers.
  10. VISION | Rule #10: Vision trumps all other senses. –  mostly background information.
  11. GENDER | Rule #11: Male and female brains are different . – we knew this already, but Medina tells us how male and female brains differ.
  12. EXPLORATION | Rule #12: We are powerful and natural explorers. –  mostly background information.

From this book I have made the following changes in life Continue reading →


03
May 10


Written By Steve French

 

Is an Ivy League education pointless for creative people?

IVE•RI•TAS came across some of Richard Florida’s work online yesterday (Florida is the author of “The Creative Class” and the creator of the notion that creative people should self-segregate) and I began wondering: why do Ivy League institutions produce so few creative people? Continue reading →


29
Apr 10


Written By Steve French

 

The three types of wealth – Money, Time, and Clan

Contando DinheiroAfter reading this article on the phenomenon of Farmville I revised my notions of wealth.  I previously categorized wealth in the following two ways:

  • Owning Money – how much money do you have in the bank account, or can be converted to cash quickly.  Most people regard money wealth as the only wealth
  • Owning Time – How much time do you have in the average week/month/year that is under your control?  Do you spend 90 hours a week working in a job you hate?   Do you spend 30 hours a week doing housework, maintaining electronic gear, smiling at people you don’t care about, or commuting?   If so, you possess little time, no matter how much money you can spend.  Tim Ferriss is the best explainer of this notion.  Read his blog (and book).  (I include  his book, The Four Hour Workweek on my all time top ten list of books.  I intend to write a time-wealth calculator at some point.)

Up until reading the Farmville article I limited my definitions of wealth to the above two categories.  Reading the article crystallized my notion of clan wealth.

Please note, I’m using the Southern American definition of Clan, which I define as a group of people related by blood, marriage, friendship, or history of friendship which has an intricate network of mutual obligations and debts and acts as one unit on divisive issues.  (Please also note, nothing in this post relates to the KKK).  In American pop history the Hatfield and the McCoy groups serve as the best example of clans.

 

This post originally appeared on the Stronico blog – with the absorption of Stronico into Digital Tool Factory this post has been moved to the Digital Tool Factory blog

Continue reading →


22
Apr 10


Written By Steve French

 

Lessons from Joseph Kennedy

I read the Wikipedia entry on Joseph Kennedy (JFK and Ted’s father) and his business life fascinated me.  Particularly I was struck by the following passage (describing his time in the stock market in the Great Crash) as :

Kennedy survived the crash “because he possessed a passion for facts, a complete lack of sentiment and a marvelous sense of timing.”

The above tendencies are usually descibed as “shrewd”, but it is informative to see the tendencies listed out like that. Continue reading →


14
Apr 10


Written By Steve French

 

The Turner Rule in Marketing and Branding

good timesOver the years I have met many alumni of the Turner Empire (CNN/Turner Broadcasting/Turner Enterprises/WCW/TBS/Braves/Hawks, etc) and most of them have told me some version of the following story.

[Setup – In the early days of CNN and Turner Broadcasting Ted Turner would prowl his office building and drop in unannounced into random meetings.   One day he walked into a meeting where people were planning a cross-channel week-long special on dinosaurs] Continue reading →


12
Apr 10


Written By Steve French

 

Ways to be smarter – I’ll be testing some of these soon

Inside
Via some Twitter link I can no longer find, I stumbled across these two posts.

  • Nootropics: their effects, their risks, and where to get them – I think I’ll be picking up some Thiamine and sticking with that, as the others seem a bit scary.  It is a fascinating bit of research though.  Nootropics are “Smart Drugs”
  • How to get Smarter – these are all fairly basic, but I intend to find some way to test them as part of my measuring everything possible campaign of 2010.

The first link is far better than the first, but you should read them both.  Upgrade your wetware!

Creative Commons License photo credit: Andrew Mason

 

This post originally appeared on the Stronico blog – with the absorption of Stronico into Digital Tool Factory this post has been moved to the Digital Tool Factory blog


24
Mar 10


Written By Steve French

 

Thoughts on predictable software scheduling

Schedule 2/6
While pondering installing Visual Studio 2010, as well as thinking how all software is moving to a subscription basis, I had the thought – why not do two predictable releases a year?  The first release, say in January, would be whatever new features were in place by that date.  The second release, say in July, would be a pure performance and usability release, as the development team would spend half the year optimizing and tweaking the code, as well as fixing all bugs.  Any new “Features” would have at least six months to cook in the minds of the developers and would be implemented on a much stronger code base. Continue reading →


25
Feb 10


Written By Steve French

 




Copyright 2011 Digital Tool Factory. All Rights Reserved. Powered by raw technical talent. And in this case, WordPress.