Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions doc/admin-guide/monitoring/statistics/core/cache-volume.en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,28 @@ a configuration with only one cache volume: :literal:`0`.
.. ts:stat:: global proxy.process.cache.volume_0.ram_cache.hits integer
:type: counter

Accumulates the number of hits to the LRU RAM cache for this volume.

.. ts:stat:: global proxy.process.cache.volume_0.ram_cache.misses integer
:type: counter

Accumulates the number of misses to the LRU RAM cache for this volume. Note that this count includes hits to the other memory caches, including the last open read and aggregation buffer caches, so it may not represent the total number of cache accesses that go to disk.

.. ts:stat:: global proxy.process.cache.volume_0.last_open_read.hits integer
:type: counter

Accumulates the number of hits to the last open read cache for this volume. This cache stores the most recent read operation for each open cache volume.

.. ts:stat:: global proxy.process.cache.volume_0.aggregation_buffer.hits integer
:type: counter

Accumulates the number of hits to the aggregation buffer for this volume. This buffer stores data fragments that are on their way to be written to disk for write aggregation.

.. ts:stat:: global proxy.process.cache.volume_0.all_memory_caches.misses integer
:type: counter

Accumulates the number of misses to all memory caches (LRU RAM cache, last open read cache, and aggregation buffer) for this volume. This represents the total number of cache accesses that go to disk for this volume.

.. ts:stat:: global proxy.process.cache.volume_0.ram_cache.total_bytes integer
:type: gauge
:units: bytes
Expand Down
23 changes: 23 additions & 0 deletions doc/admin-guide/monitoring/statistics/core/cache.en.rst
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,30 @@ Cache

.. ts:stat:: global proxy.process.cache.ram_cache.bytes_used integer
.. ts:stat:: global proxy.process.cache.ram_cache.hits integer
:type: counter

Accumulates the number of hits to the LRU RAM cache for all volumes.

.. ts:stat:: global proxy.process.cache.ram_cache.misses integer
:type: counter

Accumulates the number of misses to the LRU RAM cache for all volumes. Note that this includes hits to the other memory caches, including the last open read and aggregation buffer caches, so it may not represent the total number of cache accesses that go to disk.

.. ts:stat:: global proxy.process.cache.last_open_read.hits integer
:type: counter

Accumulates the number of hits to the last open read cache for all volumes. This cache stores the most recent read operation for each open cache volume.

.. ts:stat:: global proxy.process.cache.aggregation_buffer.hits integer
:type: counter

Accumulates the number of hits to the aggregation buffer for all volumes. This buffer stores data fragments that are on their way to be written to disk for write aggregation.

.. ts:stat:: global proxy.process.cache.all_memory_caches.misses integer
:type: counter

Accumulates the number of misses to all memory caches (LRU RAM cache, last open read cache, and aggregation buffer) for all volumes. This represents the total number of cache accesses that go to disk.

.. ts:stat:: global proxy.process.cache.ram_cache.total_bytes integer
.. ts:stat:: global proxy.process.cache.read.active integer
.. ts:stat:: global proxy.process.cache.read_busy.failure integer
Expand Down
3 changes: 3 additions & 0 deletions src/iocore/cache/CacheProcessor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1126,7 +1126,10 @@ register_cache_stats(CacheStatsBlock *rsb, const std::string &prefix)
rsb->ram_cache_bytes_total = ts::Metrics::Gauge::createPtr(prefix + ".ram_cache.total_bytes");
rsb->ram_cache_bytes = ts::Metrics::Gauge::createPtr(prefix + ".ram_cache.bytes_used");
rsb->ram_cache_hits = ts::Metrics::Counter::createPtr(prefix + ".ram_cache.hits");
rsb->last_open_read_hits = ts::Metrics::Counter::createPtr(prefix + ".last_open_read.hits");
rsb->agg_buffer_hits = ts::Metrics::Counter::createPtr(prefix + ".aggregation_buffer.hits");
rsb->ram_cache_misses = ts::Metrics::Counter::createPtr(prefix + ".ram_cache.misses");
rsb->all_mem_misses = ts::Metrics::Counter::createPtr(prefix + ".all_memory_caches.misses");
rsb->pread_count = ts::Metrics::Counter::createPtr(prefix + ".pread_count");
rsb->percent_full = ts::Metrics::Gauge::createPtr(prefix + ".percent_full");
rsb->read_seek_fail = ts::Metrics::Counter::createPtr(prefix + ".read.seek.failure");
Expand Down
10 changes: 9 additions & 1 deletion src/iocore/cache/CacheVC.cc
Original file line number Diff line number Diff line change
Expand Up @@ -459,11 +459,15 @@ CacheVC::handleRead(int /* event ATS_UNUSED */, Event * /* e ATS_UNUSED */)
} else if (load_from_last_open_read_call()) {
goto LmemHit;
} else if (load_from_aggregation_buffer()) {
io.aio_result = io.aiocb.aio_nbytes;
f.doc_from_ram_cache = true;
io.aio_result = io.aiocb.aio_nbytes;
SET_HANDLER(&CacheVC::handleReadDone);
return EVENT_RETURN;
}

ts::Metrics::Counter::increment(cache_rsb.all_mem_misses);
ts::Metrics::Counter::increment(stripe->cache_vol->vol_rsb.all_mem_misses);

io.aiocb.aio_fildes = stripe->fd;
io.aiocb.aio_offset = stripe->vol_offset(&dir);
if (static_cast<off_t>(io.aiocb.aio_offset + io.aiocb.aio_nbytes) > static_cast<off_t>(stripe->skip + stripe->len)) {
Expand Down Expand Up @@ -514,6 +518,8 @@ CacheVC::load_from_last_open_read_call()
{
if (*this->read_key == this->stripe->first_fragment_key && dir_offset(&this->dir) == this->stripe->first_fragment_offset) {
this->buf = this->stripe->first_fragment_data;
ts::Metrics::Counter::increment(cache_rsb.last_open_read_hits);
ts::Metrics::Counter::increment(stripe->cache_vol->vol_rsb.last_open_read_hits);
return true;
}
return false;
Expand All @@ -531,6 +537,8 @@ CacheVC::load_from_aggregation_buffer()
[[maybe_unused]] bool success = this->stripe->copy_from_aggregate_write_buffer(doc, dir, this->io.aiocb.aio_nbytes);
// We already confirmed that the copy was valid, so it should not fail.
ink_assert(success);
ts::Metrics::Counter::increment(cache_rsb.agg_buffer_hits);
ts::Metrics::Counter::increment(stripe->cache_vol->vol_rsb.agg_buffer_hits);
return true;
}

Expand Down
3 changes: 3 additions & 0 deletions src/iocore/cache/P_CacheStats.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@ struct CacheStatsBlock {
ts::Metrics::Gauge::AtomicType *direntries_total = nullptr;
ts::Metrics::Gauge::AtomicType *direntries_used = nullptr;
ts::Metrics::Counter::AtomicType *ram_cache_hits = nullptr;
ts::Metrics::Counter::AtomicType *last_open_read_hits = nullptr;
ts::Metrics::Counter::AtomicType *agg_buffer_hits = nullptr;
ts::Metrics::Counter::AtomicType *ram_cache_misses = nullptr;
ts::Metrics::Counter::AtomicType *all_mem_misses = nullptr;
ts::Metrics::Counter::AtomicType *pread_count = nullptr;
ts::Metrics::Gauge::AtomicType *percent_full = nullptr;
ts::Metrics::Counter::AtomicType *read_seek_fail = nullptr;
Expand Down
2 changes: 1 addition & 1 deletion tests/gold_tests/headers/gold/accept_webp_cache.gold
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
< Date: ``
< Age: ``
< Connection: keep-alive
< Via: http/1.1 `` (ApacheTrafficServer/`` [uScHs f p eN:t cCHp s ])
< Via: http/1.1 `` (ApacheTrafficServer/`` [uScRs f p eN:t cCHp s ])
< Server: ATS/``
``
4 changes: 2 additions & 2 deletions tests/gold_tests/pluginTest/prefetch/prefetch_cmcd0.gold
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/tests/request.txt 200 TCP_MISS FIN 33 -
/tests/request.txt 200 TCP_HIT - 33 -
/tests/request.txt 200 ``_HIT - 33 -
/tests/prefetch.txt 200 TCP_MISS - 16 tests/request.txt
/tests/prefetch.txt 200 TCP_MISS FIN 34 -
/tests/request.txt 200 ``_HIT - 33 -
/tests/prefetch.txt 208 TCP_HIT - 20 tests/request.txt
/tests/prefetch.txt 208 ``_HIT - 20 tests/request.txt
/tests/prefetch.txt 200 ``_HIT - 34 -
/tests/query?this=foo&that 200 TCP_MISS FIN 41 -
/tests/query?bar=baz 200 TCP_MISS - 16 tests/query
Expand Down
4 changes: 2 additions & 2 deletions tests/gold_tests/pluginTest/prefetch/prefetch_cmcd1.gold
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/tests/request.txt 200 TCP_MISS FIN 33 -
/tests/prefetch.txt 200 TCP_MISS - 16 tests/request.txt
/tests/prefetch.txt 200 TCP_MISS FIN 34 -
/tests/prefetch.txt 200 TCP_HIT - 34 -
/tests/prefetch.txt 200 TCP_``HIT - 34 -
/tests/query?this=foo&that 200 TCP_MISS FIN 41 -
/tests/query?bar=baz 200 TCP_MISS - 16 tests/query
/tests/query?bar=baz 200 TCP_MISS FIN 35 -
/tests/query?bar=baz 200 TCP_HIT - 35 -
/tests/query?bar=baz 200 TCP_``HIT - 35 -
/root.txt 200 TCP_MISS FIN 30 -
/rooted 200 TCP_MISS - 16 root.txt
/rooted 200 TCP_MISS FIN 28 -
Expand Down
6 changes: 3 additions & 3 deletions tests/gold_tests/pluginTest/slice/gold/slice_crr_ident.gold
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ cpuup=/plain sssc=200 pssc=206 phr=DIRECT range=::bytes=0-2:: x-crr-ident=::-::
cpuup=/plain sssc=200 pssc=206 phr=DIRECT range=::bytes=3-5:: x-crr-ident=::Etag "plain":: uid=::plain 1:: crc=TCP_MISS
cpuup=/plain sssc=200 pssc=200 phr=DIRECT range=::-:: x-crr-ident=::-:: uid=::plain:: crc=TCP_MISS
cpuup=/plain sssc=200 pssc=206 phr=DIRECT range=::bytes=0-2:: x-crr-ident=::-:: uid=::plain 0:: crc=TCP_REFRESH_MISS
cpuup=/plain sssc=000 pssc=206 phr=NONE range=::bytes=3-5:: x-crr-ident=::Etag "plain":: uid=::-:: crc=TCP_HIT
cpuup=/plain sssc=000 pssc=206 phr=NONE range=::bytes=3-5:: x-crr-ident=::Etag "plain":: uid=::-:: crc=TCP_MEM_HIT
cpuup=/plain sssc=200 pssc=200 phr=DIRECT range=::-:: x-crr-ident=::-:: uid=::plain:: crc=TCP_MISS
cpuup=/plain sssc=200 pssc=206 phr=DIRECT range=::bytes=0-2:: x-crr-ident=::-:: uid=::chg 0:: crc=TCP_REFRESH_MISS
cpuup=/plain sssc=200 pssc=206 phr=DIRECT range=::bytes=3-5:: x-crr-ident=::Etag "chg":: uid=::chg 1:: crc=TCP_REFRESH_MISS
cpuup=/plain sssc=200 pssc=200 phr=DIRECT range=::-:: x-crr-ident=::-:: uid=::chg:: crc=TCP_MISS
cpuup=/plain sssc=000 pssc=206 phr=NONE range=::bytes=0-2:: x-crr-ident=::-:: uid=::-:: crc=TCP_HIT
cpuup=/plain sssc=000 pssc=206 phr=NONE range=::bytes=3-5:: x-crr-ident=::Etag "chg":: uid=::-:: crc=TCP_HIT
cpuup=/plain sssc=000 pssc=206 phr=NONE range=::bytes=0-2:: x-crr-ident=::-:: uid=::-:: crc=TCP_MEM_HIT
cpuup=/plain sssc=000 pssc=206 phr=NONE range=::bytes=3-5:: x-crr-ident=::Etag "chg":: uid=::-:: crc=TCP_MEM_HIT
cpuup=/plain sssc=200 pssc=200 phr=DIRECT range=::-:: x-crr-ident=::-:: uid=::chg:: crc=TCP_MISS
cpuup=/404.txt sssc=404 pssc=404 phr=DIRECT range=::-:: x-crr-ident=::-:: uid=::-:: crc=TCP_MISS