masaori335 commented on code in PR #10923:
URL: https://github.com/apache/trafficserver/pull/10923#discussion_r1422454162


##########
src/iocore/cache/Cache.cc:
##########
@@ -693,40 +659,56 @@ CacheProcessor::cacheInitialized()
         // Dump some ram_cache size information in debug mode.
         Dbg(dbg_ctl_ram_cache, "config: size = %" PRId64 ", cutoff = %" PRId64 
"", cache_config_ram_cache_size,
             cache_config_ram_cache_cutoff);
+      }
+
+      uint64_t total_cache_bytes     = 0; // bytes that can used in total_size
+      uint64_t total_direntries      = 0; // all the direntries in the cache
+      uint64_t used_direntries       = 0; //   and used
+      uint64_t total_ram_cache_bytes = 0;
+
+      for (int i = 0; i < gnvol; i++) {
+        Stripe *stripe          = gvol[i];
+        int64_t ram_cache_bytes = 0;
 
-        for (i = 0; i < gnvol; i++) {
-          stripe = gvol[i];
-          double factor;
-          if (gvol[i]->cache == theCache && 
gvol[i]->cache_vol->ramcache_enabled) {
-            ink_assert(gvol[i]->cache != nullptr);
-            factor = static_cast<double>(static_cast<int64_t>(gvol[i]->len >> 
STORE_BLOCK_SHIFT)) / theCache->cache_size;
+        if (stripe->cache_vol->ramcache_enabled) {
+          if (http_ram_cache_size == 0) {
+            // AUTO_SIZE_RAM_CACHE
+            ram_cache_bytes = stripe->dirlen() * DEFAULT_RAM_CACHE_MULTIPLIER;
+          } else {
+            ink_assert(stripe->cache != nullptr);
+            ink_assert(theCache != nullptr);
+
+            double factor = 
static_cast<double>(static_cast<int64_t>(stripe->len >> STORE_BLOCK_SHIFT)) / 
theCache->cache_size;
             Dbg(dbg_ctl_cache_init, "CacheProcessor::cacheInitialized - factor 
= %f", factor);
-            gvol[i]->ram_cache->init(static_cast<int64_t>(http_ram_cache_size 
* factor), stripe);
-            ram_cache_bytes += static_cast<int64_t>(http_ram_cache_size * 
factor);
-            
Metrics::Gauge::increment(stripe->cache_vol->vol_rsb.ram_cache_bytes_total,
 
-                                      static_cast<int64_t>(http_ram_cache_size 
* factor));
-          } else if (gvol[i]->cache_vol->ramcache_enabled) {
-            ink_release_assert(!"Unexpected non-HTTP cache volume");
+            ram_cache_bytes = static_cast<int64_t>(http_ram_cache_size * 
factor);
           }
+
+          stripe->ram_cache->init(ram_cache_bytes, stripe);
+          total_ram_cache_bytes += ram_cache_bytes;

Review Comment:
   Now, `ram_cache_bytes` represents the size of ram_cache in the stripe and 
`total_ram_cache_bytes` is sum of them.
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to