Chapter 7: Static Meets Dynamic Adding Caches to Reduce Costs
This chapter excerpt is from "Scalable Internet Architectures", by Theo Schlossnagle, Copyright 2007 by Sams Publishing, ISBN 067232699x. Reprinted with permission, all rights reserved. To review a complete Table of Contents, please visit: www.samspublishing.com/title/067232699x
Chapter 6, "Static Content Serving for Speed and Glory," walked you through building a high-capacity static content serving system using a web caching system as the core technology. That software was responsible for fetching static content from "master" servers and peddling the cached content efficiently and inexpensively.
Why is the problem so different when the content is no longer static? Why can't we use the exact same solution presented in Chapter 6 for dynamic content?
Think of a website as if it were a phone book. A cache is a piece of paper that sits next to your phone book on which you record all the numbers you look up. Sounds like a good idea, right? So much so that you will probably tape that piece of notebook paper to the front of your phone book because you are likely to be interested only in a small subset of the information contained in the book and just as likely to be interested in the same information time and time again. Sounds perfect, right? But the analogy is flawed. Static content on a website is like a phone book, but imagine how difficult it would be to use your "paper cache" if the numbers inside the phone book constantly changed or if numbers differed based on who was looking them up. This is why caching dynamic content poses a more difficult problem than caching static content.
One misconception about caches is due to the misalignment of the computing-centric definition and the English definition of the word cache. In English, a cache is a place to store things often out of sight or in secret, and that definition assumes that it will be there when you return for it. A computer cache is only meant to speed acquisition of data; if it is missing when you look for it, you incur what is called a cache miss. This miss costs you nothing but time.
Caches are everywhere, from the "registers" on your CPU to L1/L2 CPU cache to disk drives to name servers to web systems–and the list goes on. Caches are fundamental engineering tools both inside and outside technology. If they are everywhere, how do you tell if a cache is a web cache? Let's define our web architecture as components directly creating browser-digestible content. This definition eliminates many architectural components that use caches: load balancers, databases, networking equipment, disk drives, and so on. This leaves us with web servers and application servers (glorified web servers).
Web servers are squished right in the middle of our spectacular architectural sandwich. Web caches are caching components of any type that operate directly on web servers or between web servers and their adjacent layers as depicted in Figure 7.1.
Performance Tuning Has Its Limits - Why are we talking about caching and not application performance tuning? This is an important question and deserves attention. Our goal is to demonstrate techniques that can be used as building blocks for scalable systems–and caching is such a technique. Application tuning can only increase performance, and you'll note that the title of this book is not High Performance Internet Architectures. That is not to say that the concepts herein do not perform well, but rather that they focus on scalability and leave high-performance programming, tuning, and tweaking to other books.
Why are scalability and performance different? This is explored in detail in the introduction, but it deserves a few more words. No matter how fast you make your application, you will be limited if it does not scale horizontally.
To put it another way, if your application performance can be increased by 10%, 5%, or perhaps 1% by doubling your hardware, you are in big trouble. Moore's law says that your computer will be twice as fast in 18 months, so if you want to double your capacity, call me in a year and a half. On the other hand, if your application and architecture are designed to be able to leverage 60% or more performance by doubling your architecture, you can scale your system up today. Those percentages are arbitrary, and each architecture will have its own horizontal scaling efficiency. 100% means a perfectly (horizontally) scalable architecture, and 0% means an architecture that scales vertically, so performance tuning is your only option–so aim high.
Practical Task Scheduling Deployment
July 20, 2016 12:00 pm CDT
One of the best things about the UNIX environment (aside from being stable and efficient) is the vast array of software tools available to help you do your job. Traditionally, a UNIX tool does only one thing, but does that one thing very well. For example, grep is very easy to use and can search vast amounts of data quickly. The find tool can find a particular file or files based on all kinds of criteria. It's pretty easy to string these tools together to build even more powerful tools, such as a tool that finds all of the .log files in the /home directory and searches each one for a particular entry. This erector-set mentality allows UNIX system administrators to seem to always have the right tool for the job.
Cron traditionally has been considered another such a tool for job scheduling, but is it enough? This webinar considers that very question. The first part builds on a previous Geek Guide, Beyond Cron, and briefly describes how to know when it might be time to consider upgrading your job scheduling infrastructure. The second part presents an actual planning and implementation framework.
Join Linux Journal's Mike Diehl and Pat Cameron of Help Systems.
Free to Linux Journal readers.Register Now!
- SUSE LLC's SUSE Manager
- Murat Yener and Onur Dundar's Expert Android Studio (Wrox)
- Managing Linux Using Puppet
- My +1 Sword of Productivity
- Non-Linux FOSS: Caffeine!
- Doing for User Space What We Did for Kernel Space
- Google's SwiftShader Released
- SuperTuxKart 0.9.2 Released
- LiveCode Ltd.'s LiveCode
- Parsing an RSS News Feed with a Bash Script
With all the industry talk about the benefits of Linux on Power and all the performance advantages offered by its open architecture, you may be considering a move in that direction. If you are thinking about analytics, big data and cloud computing, you would be right to evaluate Power. The idea of using commodity x86 hardware and replacing it every three years is an outdated cost model. It doesn’t consider the total cost of ownership, and it doesn’t consider the advantage of real processing power, high-availability and multithreading like a demon.
This ebook takes a look at some of the practical applications of the Linux on Power platform and ways you might bring all the performance power of this open architecture to bear for your organization. There are no smoke and mirrors here—just hard, cold, empirical evidence provided by independent sources. I also consider some innovative ways Linux on Power will be used in the future.Get the Guide