When Memcached Beats Redis

But there are two specific scenarios in which Memcached could be preferable. The first is for caching small and static data, such as HTML code fragments. Memcached’s internal memory management, while not as sophisticated as Redis’, is more efficient because Memcached will consume comparatively less memory resources for metadata. Strings, which are the only data type that are supported by Memcached, are ideal for storing data that’s only being read because strings require no further processing.

.. Memcached’s data eviction mechanism uses an LRU (Least Recently Used) algorithm and somewhat arbitrarily evicts data that’s similar in size to the new data. Redis, by contrast, allows for fine-grained control over eviction though a choice of six different eviction policies. Redis also employs more sophisticated approaches to memory management and eviction candidate selection.

.. Last but not least, Redis offers replication. Replication can be used for implementing a highly available cache setup that can withstand failures and provide uninterrupted service to the application.

Gunicorn: WSGI Server

Gunicorn ‘Green Unicorn’ is a Python WSGI HTTP Server for UNIX. It’s a pre-fork worker model ported from Ruby’s Unicorn project. The Gunicorn server is broadly compatible with various web frameworks, simply implemented, light on server resources, and fairly speedy.

 

Django Cache Versioning

But there are some problems with this approach. For one, the first (uncached) request still takes the full 3.5 seconds.

.. Django supports “versioning” of cache records. If you specify a version number in your cache.set(key, value, version=my_version) call, then a corresponding cache.get(key, version=some_other_version) call will not return any data. Using versioning, we can change things around and store the user’s current ‘version’ in the cache. When we want to get the cached data set, we specify the user’s cached version number. In this way, we are able to invalidate old cache entries without searching through the cache for all of a user’s cached items. An example will help clarify:

How the “performance revolution” came to athletics—and beyond.

And since many studies show that getting more sleep leads to better performance, teams are now worrying about that, too. The N.B.A.’s Dallas Mavericks have equipped players with Readiband monitors to measure how much, and how well, they’re sleeping.

.. The quality of classical musicians has improved dramatically as well, to the point that virtuosos are now, as the Times music critic Anthony Tommasini has observed of pianists, “a dime a dozen.” Even as the number of jobs in classical music has declined, the number of people capable of doing those jobs has soared, as has the calibre of their playing. James Conlon, the conductor of the Los Angeles Opera, has said, “The professional standards are higher everywhere in the world compared to twenty or forty years ago.” Pieces that were once considered too difficult for any but the very best musicians are now routinely played by conservatory students.

.. When John Madden coached the Oakland Raiders, he would force players to practice at midday in the middle of August in full pads; Don Shula, when he was head coach of the Baltimore Colts, insisted that his players practice without access to water. Today, teams are savvier about maximizing the benefits of practices, and sometimes that means knowing when not to practice. The Portland Trail Blazers, pioneers in using data to protect players’ health, will sometimes tell a lagging player to lay off practicing, lest he injure himself. To coaches of Madden and Shula’s generation, this would have sounded like mollycoddling. But last season the Trail Blazers had the healthiest team in the N.B.A.

.. Which raises a question: what are the fields that could have become significantly better over the past forty years and haven’t?

There are obvious examples. Customer service seems worse than it once was. Most companies underinvest in it, because they see it purely as a cost center, rather than a source of potential profits, and so workers are undertrained. Customer-service centers have often been set up to maximize the very things—speed and volume—that make for a poor customer experience. Continuous improvement is of no use if you’re not improving the right things.

.. If American teachers—unlike athletes or manufacturing workers—haven’t got much better over the past three decades, it’s largely because their training hasn’t, either.