diff --git includes/bootstrap.inc includes/bootstrap.inc
index abb7a06..c30465a 100644
--- includes/bootstrap.inc
+++ includes/bootstrap.inc
@@ -2006,7 +2006,19 @@ function _drupal_bootstrap_page_cache() {
       exit;
     }
     else {
-      header('X-Drupal-Cache: MISS');
+      // Cache miss. Avoid a stampede.
+      require_once DRUPAL_ROOT . '/' . variable_get('lock_inc', 'includes/lock.inc');
+      lock_initialize();
+      $name = '_drupal_bootstrap_page_cache';
+      if (!lock_acquire($name, 1)) {
+        // Some other request is building cache. Wait, then re-run this function.
+        lock_wait($name);
+        return _drupal_bootstrap_page_cache();
+      }
+      else {
+        // Proceed with page build. We cache the result, and release the lock.
+        header('X-Drupal-Cache: MISS');
+      }
     }
   }
 }
diff --git includes/common.inc includes/common.inc
index 63510d6..1e7e059 100644
--- includes/common.inc
+++ includes/common.inc
@@ -4540,6 +4540,7 @@ function drupal_page_set_cache() {
         $cache->data = gzencode($cache->data, 9, FORCE_GZIP);
       }
       cache_set($cache->cid, $cache->data, 'cache_page', $cache->expire, $cache->headers);
+      lock_release('_drupal_bootstrap_page_cache');
     }
     return $cache;
   }
@@ -5183,7 +5184,7 @@ function drupal_render_cache_get($elements) {
   }
   $bin = isset($elements['#cache']['bin']) ? $elements['#cache']['bin'] : 'cache';
 
-  if (!empty($cid) && $cache = cache_get($cid, $bin)) {
+  if ($cache = cache_get($cid, $bin)) {
     // Add additional libraries, JavaScript, CSS and other data attached
     // to this element.
     if (isset($cache->data['#attached'])) {
@@ -5192,7 +5193,18 @@ function drupal_render_cache_get($elements) {
     // Return the rendered output.
     return $cache->data['#markup'];
   }
-  return FALSE;
+  else {
+    // Cache miss. Avoid a stampede.
+    if (!lock_acquire($cid, 1)) {
+      // Some other request is building cache. Wait, then re-run this function.
+      lock_wait($cid);
+      return drupal_render_cache_get($elements);
+    }
+    else {
+      // Proceed with rendering, cache the result, and then release the lock.
+      return FALSE;
+    }
+  }
 }
 
 /**
@@ -5228,6 +5240,7 @@ function drupal_render_cache_set(&$markup, $elements) {
   $bin = isset($elements['#cache']['bin']) ? $elements['#cache']['bin'] : 'cache';
   $expire = isset($elements['#cache']['expire']) ? $elements['#cache']['expire'] : CACHE_PERMANENT;
   cache_set($cid, $data, $bin, $expire);
+  lock_release($cid);
 }
 
 /**
