MemStore.cc
Go to the documentation of this file.
1/*
2 * Copyright (C) 1996-2022 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9/* DEBUG: section 20 Memory Cache */
10
11#include "squid.h"
13#include "CollapsedForwarding.h"
14#include "HttpReply.h"
15#include "ipc/mem/Page.h"
16#include "ipc/mem/Pages.h"
17#include "MemObject.h"
18#include "MemStore.h"
19#include "mime_header.h"
20#include "SquidConfig.h"
21#include "SquidMath.h"
22#include "StoreStats.h"
23#include "tools.h"
24
26static const SBuf MapLabel("cache_mem_map");
28static const char *SpaceLabel = "cache_mem_space";
30static const char *ExtrasLabel = "cache_mem_ex";
31// TODO: sync with Rock::SwapDir::*Path()
32
35class ShmWriter: public Packable
36{
37public:
38 ShmWriter(MemStore &aStore, StoreEntry *anEntry, const sfileno aFileNo, Ipc::StoreMapSliceId aFirstSlice = -1);
39
40 /* Packable API */
41 virtual void append(const char *aBuf, int aSize) override;
42 virtual void vappendf(const char *fmt, va_list ap) override;
43
44public:
46
50
53
54 uint64_t totalWritten;
55
56protected:
57 void copyToShm();
59
60private:
63
64 /* set by (and only valid during) append calls */
65 const char *buf;
66 int bufSize;
68};
69
70/* ShmWriter */
71
72ShmWriter::ShmWriter(MemStore &aStore, StoreEntry *anEntry, const sfileno aFileNo, Ipc::StoreMapSliceId aFirstSlice):
73 entry(anEntry),
74 firstSlice(aFirstSlice),
75 lastSlice(firstSlice),
76 totalWritten(0),
77 store(aStore),
78 fileNo(aFileNo),
79 buf(nullptr),
80 bufSize(0),
81 bufWritten(0)
82{
83 Must(entry);
84}
85
86void
87ShmWriter::append(const char *aBuf, int aBufSize)
88{
89 Must(!buf);
90 buf = aBuf;
91 bufSize = aBufSize;
92 if (bufSize) {
93 Must(buf);
94 bufWritten = 0;
95 copyToShm();
96 }
97 buf = nullptr;
98 bufSize = 0;
99 bufWritten = 0;
100}
101
102void
103ShmWriter::vappendf(const char *fmt, va_list ap)
104{
105 SBuf vaBuf;
106 va_list apCopy;
107 va_copy(apCopy, ap);
108 vaBuf.vappendf(fmt, apCopy);
109 va_end(apCopy);
110 append(vaBuf.rawContent(), vaBuf.length());
111}
112
114void
116{
117 Must(bufSize > 0); // do not use up shared memory pages for nothing
118 Must(firstSlice < 0 || lastSlice >= 0);
119
120 // fill, skip slices that are already full
121 while (bufWritten < bufSize) {
123 if (firstSlice < 0)
125 copyToShmSlice(slice);
126 }
127
128 debugs(20, 7, "stored " << bufWritten << '/' << totalWritten << " header bytes of " << *entry);
129}
130
132void
134{
136 debugs(20, 7, "entry " << *entry << " slice " << lastSlice << " has " <<
137 page);
138
140 const int64_t writingDebt = bufSize - bufWritten;
141 const int64_t pageSize = Ipc::Mem::PageSize();
142 const int64_t sliceOffset = totalWritten % pageSize;
143 const int64_t copySize = std::min(writingDebt, pageSize - sliceOffset);
144 memcpy(static_cast<char*>(PagePointer(page)) + sliceOffset, buf + bufWritten,
145 copySize);
146
147 debugs(20, 7, "copied " << slice.size << '+' << copySize << " bytes of " <<
148 entry << " from " << sliceOffset << " in " << page);
149
150 slice.size += copySize;
151 bufWritten += copySize;
152 totalWritten += copySize;
153 // fresh anchor.basics.swap_file_sz is already set [to the stale value]
154
155 // either we wrote everything or we filled the entire slice
156 Must(bufWritten == bufSize || sliceOffset + copySize == pageSize);
157}
158
159/* MemStore */
160
161MemStore::MemStore(): map(nullptr), lastWritingSlice(-1)
162{
163}
164
166{
167 delete map;
168}
169
170void
172{
173 const int64_t entryLimit = EntryLimit();
174 if (entryLimit <= 0)
175 return; // no shared memory cache configured or a misconfiguration
176
177 // check compatibility with the disk cache, if any
178 if (Config.cacheSwap.n_configured > 0) {
179 const int64_t diskMaxSize = Store::Root().maxObjectSize();
180 const int64_t memMaxSize = maxObjectSize();
181 if (diskMaxSize == -1) {
182 debugs(20, DBG_IMPORTANT, "WARNING: disk-cache maximum object size "
183 "is unlimited but mem-cache maximum object size is " <<
184 memMaxSize / 1024.0 << " KB");
185 } else if (diskMaxSize > memMaxSize) {
186 debugs(20, DBG_IMPORTANT, "WARNING: disk-cache maximum object size "
187 "is too large for mem-cache: " <<
188 diskMaxSize / 1024.0 << " KB > " <<
189 memMaxSize / 1024.0 << " KB");
190 }
191 }
192
195
196 Must(!map);
197 map = new MemStoreMap(MapLabel);
198 map->cleaner = this;
199}
200
201void
203{
204 const size_t pageSize = Ipc::Mem::PageSize();
205
206 stats.mem.shared = true;
207 stats.mem.capacity =
209 stats.mem.size =
211 stats.mem.count = currentCount();
212}
213
214void
216{
217 storeAppendPrintf(&e, "\n\nShared Memory Cache\n");
218
219 storeAppendPrintf(&e, "Maximum Size: %.0f KB\n", maxSize()/1024.0);
220 storeAppendPrintf(&e, "Current Size: %.2f KB %.2f%%\n",
221 currentSize() / 1024.0,
223
224 if (map) {
225 const int entryLimit = map->entryLimit();
226 const int slotLimit = map->sliceLimit();
227 storeAppendPrintf(&e, "Maximum entries: %9d\n", entryLimit);
228 if (entryLimit > 0) {
229 storeAppendPrintf(&e, "Current entries: %" PRId64 " %.2f%%\n",
230 currentCount(), (100.0 * currentCount() / entryLimit));
231 }
232
233 storeAppendPrintf(&e, "Maximum slots: %9d\n", slotLimit);
234 if (slotLimit > 0) {
235 const unsigned int slotsFree =
237 if (slotsFree <= static_cast<unsigned int>(slotLimit)) {
238 const int usedSlots = slotLimit - static_cast<int>(slotsFree);
239 storeAppendPrintf(&e, "Used slots: %9d %.2f%%\n",
240 usedSlots, (100.0 * usedSlots / slotLimit));
241 }
242
243 if (slotLimit < 100) { // XXX: otherwise too expensive to count
246 stats.dump(e);
247 }
248 }
249 }
250}
251
252void
254{
255}
256
257uint64_t
259{
260 return 0; // XXX: irrelevant, but Store parent forces us to implement this
261}
262
263uint64_t
265{
266 return Config.memMaxSize;
267}
268
269uint64_t
271{
274}
275
276uint64_t
278{
279 return map ? map->entryCount() : 0;
280}
281
282int64_t
284{
286}
287
288void
290{
291}
292
293bool
295{
296 // no need to keep e in the global store_table for us; we have our own map
297 return false;
298}
299
302{
303 if (!map)
304 return nullptr;
305
306 sfileno index;
307 const Ipc::StoreMapAnchor *const slot = map->openForReading(key, index);
308 if (!slot)
309 return nullptr;
310
311 // create a brand new store entry and initialize it with stored info
312 StoreEntry *e = new StoreEntry();
313
314 // XXX: We do not know the URLs yet, only the key, but we need to parse and
315 // store the response for the Root().find() callers to be happy because they
316 // expect IN_MEMORY entries to already have the response headers and body.
317 e->createMemObject();
318
319 anchorEntry(*e, index, *slot);
320
321 const bool copied = copyFromShm(*e, index, *slot);
322
323 if (copied)
324 return e;
325
326 debugs(20, 3, "failed for " << *e);
327 map->freeEntry(index); // do not let others into the same trap
328 destroyStoreEntry(static_cast<hash_link *>(e));
329 return nullptr;
330}
331
332void
334{
335 if (!map)
336 return;
337
338 Ipc::StoreMapUpdate update(updatedE);
339 assert(updatedE);
340 assert(updatedE->mem_obj);
341 if (!map->openForUpdating(update, updatedE->mem_obj->memCache.index))
342 return;
343
344 try {
345 updateHeadersOrThrow(update);
346 } catch (const std::exception &ex) {
347 debugs(20, 2, "error starting to update entry " << *updatedE << ": " << ex.what());
348 map->abortUpdating(update);
349 }
350}
351
352void
354{
355 // our +/- hdr_sz math below does not work if the chains differ [in size]
357
358 const uint64_t staleHdrSz = update.entry->mem().baseReply().hdr_sz;
359 debugs(20, 7, "stale hdr_sz: " << staleHdrSz);
360
361 /* we will need to copy same-slice payload after the stored headers later */
362 Must(staleHdrSz > 0);
363 update.stale.splicingPoint = map->sliceContaining(update.stale.fileNo, staleHdrSz);
364 Must(update.stale.splicingPoint >= 0);
365 Must(update.stale.anchor->basics.swap_file_sz >= staleHdrSz);
366
367 Must(update.stale.anchor);
368 ShmWriter writer(*this, update.entry, update.fresh.fileNo);
370 const uint64_t freshHdrSz = writer.totalWritten;
371 debugs(20, 7, "fresh hdr_sz: " << freshHdrSz << " diff: " << (freshHdrSz - staleHdrSz));
372
373 /* copy same-slice payload remaining after the stored headers */
374 const Ipc::StoreMapSlice &slice = map->readableSlice(update.stale.fileNo, update.stale.splicingPoint);
375 const Ipc::StoreMapSlice::Size sliceCapacity = Ipc::Mem::PageSize();
376 const Ipc::StoreMapSlice::Size headersInLastSlice = staleHdrSz % sliceCapacity;
377 Must(headersInLastSlice > 0); // or sliceContaining() would have stopped earlier
378 Must(slice.size >= headersInLastSlice);
379 const Ipc::StoreMapSlice::Size payloadInLastSlice = slice.size - headersInLastSlice;
380 const MemStoreMapExtras::Item &extra = extras->items[update.stale.splicingPoint];
381 char *page = static_cast<char*>(PagePointer(extra.page));
382 debugs(20, 5, "appending same-slice payload: " << payloadInLastSlice);
383 writer.append(page + headersInLastSlice, payloadInLastSlice);
384 update.fresh.splicingPoint = writer.lastSlice;
385
386 update.fresh.anchor->basics.swap_file_sz -= staleHdrSz;
387 update.fresh.anchor->basics.swap_file_sz += freshHdrSz;
388
389 map->closeForUpdating(update);
390}
391
392bool
394{
395 if (!map)
396 return false;
397
398 sfileno index;
399 const Ipc::StoreMapAnchor *const slot = map->openForReading(
400 reinterpret_cast<cache_key*>(entry.key), index);
401 if (!slot)
402 return false;
403
404 anchorEntry(entry, index, *slot);
405 inSync = updateAnchoredWith(entry, index, *slot);
406 return true; // even if inSync is false
407}
408
409bool
411{
412 if (!map)
413 return false;
414
415 assert(entry.mem_obj);
416 assert(entry.hasMemStore());
417 const sfileno index = entry.mem_obj->memCache.index;
418 const Ipc::StoreMapAnchor &anchor = map->readableEntry(index);
419 return updateAnchoredWith(entry, index, anchor);
420}
421
423bool
425{
426 entry.swap_file_sz = anchor.basics.swap_file_sz;
427 const bool copied = copyFromShm(entry, index, anchor);
428 return copied;
429}
430
432void
434{
435 assert(!e.hasDisk()); // no conflict with disk entry basics
436 anchor.exportInto(e);
437
438 assert(e.mem_obj);
439 if (anchor.complete()) {
443 } else {
445 assert(e.mem_obj->object_sz < 0);
447 }
448
450
452 mc.index = index;
454}
455
457bool
459{
460 debugs(20, 7, "mem-loading entry " << index << " from " << anchor.start);
461 assert(e.mem_obj);
462
463 // emulate the usual Store code but w/o inapplicable checks and callbacks:
464
465 Ipc::StoreMapSliceId sid = anchor.start; // optimize: remember the last sid
466 bool wasEof = anchor.complete() && sid < 0;
467 int64_t sliceOffset = 0;
468 while (sid >= 0) {
469 const Ipc::StoreMapSlice &slice = map->readableSlice(index, sid);
470 // slice state may change during copying; take snapshots now
471 wasEof = anchor.complete() && slice.next < 0;
472 const Ipc::StoreMapSlice::Size wasSize = slice.size;
473
474 debugs(20, 8, "entry " << index << " slice " << sid << " eof " <<
475 wasEof << " wasSize " << wasSize << " <= " <<
476 anchor.basics.swap_file_sz << " sliceOffset " << sliceOffset <<
477 " mem.endOffset " << e.mem_obj->endOffset());
478
479 if (e.mem_obj->endOffset() < sliceOffset + wasSize) {
480 // size of the slice data that we already copied
481 const size_t prefixSize = e.mem_obj->endOffset() - sliceOffset;
482 assert(prefixSize <= wasSize);
483
484 const MemStoreMapExtras::Item &extra = extras->items[sid];
485
486 char *page = static_cast<char*>(PagePointer(extra.page));
487 const StoreIOBuffer sliceBuf(wasSize - prefixSize,
488 e.mem_obj->endOffset(),
489 page + prefixSize);
490 if (!copyFromShmSlice(e, sliceBuf, wasEof))
491 return false;
492 debugs(20, 8, "entry " << index << " copied slice " << sid <<
493 " from " << extra.page << '+' << prefixSize);
494 }
495 // else skip a [possibly incomplete] slice that we copied earlier
496
497 // careful: the slice may have grown _and_ gotten the next slice ID!
498 if (slice.next >= 0) {
499 assert(!wasEof);
500 // here we know that slice.size may not change any more
501 if (wasSize >= slice.size) { // did not grow since we started copying
502 sliceOffset += wasSize;
503 sid = slice.next;
504 }
505 } else if (wasSize >= slice.size) { // did not grow
506 break;
507 }
508 }
509
510 if (!wasEof) {
511 debugs(20, 7, "mem-loaded " << e.mem_obj->endOffset() << '/' <<
512 anchor.basics.swap_file_sz << " bytes of " << e);
513 return true;
514 }
515
516 if (anchor.writerHalted) {
517 debugs(20, 5, "mem-loaded aborted " << e.mem_obj->endOffset() << '/' <<
518 anchor.basics.swap_file_sz << " bytes of " << e);
519 return false;
520 }
521
522 debugs(20, 5, "mem-loaded all " << e.mem_obj->endOffset() << '/' <<
523 anchor.basics.swap_file_sz << " bytes of " << e);
524
525 // from StoreEntry::complete()
529
530 assert(e.mem_obj->object_sz >= 0);
531 assert(static_cast<uint64_t>(e.mem_obj->object_sz) == anchor.basics.swap_file_sz);
532 // would be nice to call validLength() here, but it needs e.key
533
534 // we read the entire response into the local memory; no more need to lock
535 disconnect(e);
536 return true;
537}
538
540bool
542{
543 debugs(20, 7, "buf: " << buf.offset << " + " << buf.length);
544
545 // from store_client::readBody()
546 // parse headers if needed; they might span multiple slices!
547 const auto rep = &e.mem().adjustableBaseReply();
548 if (rep->pstate < Http::Message::psParsed) {
549 // XXX: have to copy because httpMsgParseStep() requires 0-termination
550 MemBuf mb;
551 mb.init(buf.length+1, buf.length+1);
552 mb.append(buf.data, buf.length);
553 mb.terminate();
554 const int result = rep->httpMsgParseStep(mb.buf, buf.length, eof);
555 if (result > 0) {
556 assert(rep->pstate == Http::Message::psParsed);
557 } else if (result < 0) {
558 debugs(20, DBG_IMPORTANT, "Corrupted mem-cached headers: " << e);
559 return false;
560 } else { // more slices are needed
561 assert(!eof);
562 }
563 }
564 debugs(20, 7, "rep pstate: " << rep->pstate);
565
566 // local memory stores both headers and body so copy regardless of pstate
567 const int64_t offBefore = e.mem_obj->endOffset();
568 assert(e.mem_obj->data_hdr.write(buf)); // from MemObject::write()
569 const int64_t offAfter = e.mem_obj->endOffset();
570 // expect to write the entire buf because StoreEntry::write() never fails
571 assert(offAfter >= 0 && offBefore <= offAfter &&
572 static_cast<size_t>(offAfter - offBefore) == buf.length);
573 return true;
574}
575
577bool
579{
580 if (e.mem_status == IN_MEMORY) {
581 debugs(20, 5, "already loaded from mem-cache: " << e);
582 return false;
583 }
584
585 if (e.mem_obj && e.mem_obj->memCache.offset > 0) {
586 debugs(20, 5, "already written to mem-cache: " << e);
587 return false;
588 }
589
590 if (shutting_down) {
591 debugs(20, 5, "avoid heavy optional work during shutdown: " << e);
592 return false;
593 }
594
595 // To avoid SMP workers releasing each other caching attempts, restrict disk
596 // caching to StoreEntry publisher. This check goes before memoryCachable()
597 // that may incorrectly release() publisher's entry via checkCachable().
598 if (Store::Root().transientsReader(e)) {
599 debugs(20, 5, "yield to entry publisher: " << e);
600 return false;
601 }
602
603 if (!e.memoryCachable()) {
604 debugs(20, 7, "Not memory cachable: " << e);
605 return false; // will not cache due to entry state or properties
606 }
607
608 assert(e.mem_obj);
609
610 if (!e.mem_obj->vary_headers.isEmpty()) {
611 // XXX: We must store/load SerialisedMetaData to cache Vary in RAM
612 debugs(20, 5, "Vary not yet supported: " << e.mem_obj->vary_headers);
613 return false;
614 }
615
616 const int64_t expectedSize = e.mem_obj->expectedReplySize(); // may be < 0
617 const int64_t loadedSize = e.mem_obj->endOffset();
618 const int64_t ramSize = max(loadedSize, expectedSize);
619 if (ramSize > maxObjectSize()) {
620 debugs(20, 5, "Too big max(" <<
621 loadedSize << ", " << expectedSize << "): " << e);
622 return false; // will not cache due to cachable entry size limits
623 }
624
625 if (!e.mem_obj->isContiguous()) {
626 debugs(20, 5, "not contiguous");
627 return false;
628 }
629
630 if (!map) {
631 debugs(20, 5, "No map to mem-cache " << e);
632 return false;
633 }
634
635 if (EBIT_TEST(e.flags, ENTRY_SPECIAL)) {
636 debugs(20, 5, "Not mem-caching ENTRY_SPECIAL " << e);
637 return false;
638 }
639
640 return true;
641}
642
644bool
646{
647 sfileno index = 0;
648 Ipc::StoreMapAnchor *slot = map->openForWriting(reinterpret_cast<const cache_key *>(e.key), index);
649 if (!slot) {
650 debugs(20, 5, "No room in mem-cache map to index " << e);
651 return false;
652 }
653
654 assert(e.mem_obj);
655 e.mem_obj->memCache.index = index;
657 slot->set(e);
658 // Do not allow others to feed off an unknown-size entry because we will
659 // stop swapping it out if it grows too large.
660 if (e.mem_obj->expectedReplySize() >= 0)
661 map->startAppending(index);
662 e.memOutDecision(true);
663 return true;
664}
665
667void
669{
670 assert(map);
671 assert(e.mem_obj);
673
674 const int64_t eSize = e.mem_obj->endOffset();
675 if (e.mem_obj->memCache.offset >= eSize) {
676 debugs(20, 5, "postponing copying " << e << " for lack of news: " <<
677 e.mem_obj->memCache.offset << " >= " << eSize);
678 return; // nothing to do (yet)
679 }
680
681 // throw if an accepted unknown-size entry grew too big or max-size changed
682 Must(eSize <= maxObjectSize());
683
684 const int32_t index = e.mem_obj->memCache.index;
685 assert(index >= 0);
686 Ipc::StoreMapAnchor &anchor = map->writeableEntry(index);
687 lastWritingSlice = anchor.start;
688
689 // fill, skip slices that are already full
690 // Optimize: remember lastWritingSlice in e.mem_obj
691 while (e.mem_obj->memCache.offset < eSize) {
694 if (anchor.start < 0)
695 anchor.start = lastWritingSlice;
696 copyToShmSlice(e, anchor, slice);
697 }
698
699 debugs(20, 7, "mem-cached available " << eSize << " bytes of " << e);
700}
701
703void
705{
707 debugs(20, 7, "entry " << e << " slice " << lastWritingSlice << " has " <<
708 page);
709
710 const int64_t bufSize = Ipc::Mem::PageSize();
711 const int64_t sliceOffset = e.mem_obj->memCache.offset % bufSize;
712 StoreIOBuffer sharedSpace(bufSize - sliceOffset, e.mem_obj->memCache.offset,
713 static_cast<char*>(PagePointer(page)) + sliceOffset);
714
715 // check that we kept everything or purge incomplete/sparse cached entry
716 const ssize_t copied = e.mem_obj->data_hdr.copy(sharedSpace);
717 if (copied <= 0) {
718 debugs(20, 2, "Failed to mem-cache " << (bufSize - sliceOffset) <<
719 " bytes of " << e << " from " << e.mem_obj->memCache.offset <<
720 " in " << page);
721 throw TexcHere("data_hdr.copy failure");
722 }
723
724 debugs(20, 7, "mem-cached " << copied << " bytes of " << e <<
725 " from " << e.mem_obj->memCache.offset << " in " << page);
726
727 slice.size += copied;
728 e.mem_obj->memCache.offset += copied;
730}
731
736{
737 // allocate the very first slot for the entry if needed
738 if (sliceOffset < 0) {
739 Ipc::StoreMapAnchor &anchor = map->writeableEntry(fileNo);
740 Must(anchor.start < 0);
741 Ipc::Mem::PageId page;
742 sliceOffset = reserveSapForWriting(page); // throws
743 extras->items[sliceOffset].page = page;
744 anchor.start = sliceOffset;
745 }
746
747 const size_t sliceCapacity = Ipc::Mem::PageSize();
748 do {
749 Ipc::StoreMap::Slice &slice = map->writeableSlice(fileNo, sliceOffset);
750
751 if (slice.size >= sliceCapacity) {
752 if (slice.next >= 0) {
753 sliceOffset = slice.next;
754 continue;
755 }
756
757 Ipc::Mem::PageId page;
758 slice.next = sliceOffset = reserveSapForWriting(page);
759 extras->items[sliceOffset].page = page;
760 debugs(20, 7, "entry " << fileNo << " new slice: " << sliceOffset);
761 continue; // to get and return the slice at the new sliceOffset
762 }
763
764 return slice;
765 } while (true);
766 /* not reached */
767}
768
772{
773 Must(extras);
774 Must(sliceId >= 0);
775 Ipc::Mem::PageId page = extras->items[sliceId].page;
776 Must(page);
777 return page;
778}
779
783{
784 Ipc::Mem::PageId slot;
785 if (freeSlots->pop(slot)) {
786 const auto slotId = slot.number - 1;
787 debugs(20, 5, "got a previously free slot: " << slotId);
788
790 debugs(20, 5, "and got a previously free page: " << page);
791 map->prepFreeSlice(slotId);
792 return slotId;
793 } else {
794 debugs(20, 3, "but there is no free page, returning " << slotId);
795 freeSlots->push(slot);
796 }
797 }
798
799 // catch free slots delivered to noteFreeMapSlice()
801 waitingFor.slot = &slot;
802 waitingFor.page = &page;
803 if (map->purgeOne()) {
804 assert(!waitingFor); // noteFreeMapSlice() should have cleared it
805 assert(slot.set());
806 assert(page.set());
807 const auto slotId = slot.number - 1;
808 map->prepFreeSlice(slotId);
809 debugs(20, 5, "got previously busy " << slotId << " and " << page);
810 return slotId;
811 }
812 assert(waitingFor.slot == &slot && waitingFor.page == &page);
813 waitingFor.slot = nullptr;
814 waitingFor.page = nullptr;
815
816 debugs(47, 3, "cannot get a slice; entries: " << map->entryCount());
817 throw TexcHere("ran out of mem-cache slots");
818}
819
820void
822{
823 Ipc::Mem::PageId &pageId = extras->items[sliceId].page;
824 debugs(20, 9, "slice " << sliceId << " freed " << pageId);
825 assert(pageId);
826 Ipc::Mem::PageId slotId;
828 slotId.number = sliceId + 1;
829 if (!waitingFor) {
830 // must zero pageId before we give slice (and pageId extras!) to others
831 Ipc::Mem::PutPage(pageId);
832 freeSlots->push(slotId);
833 } else {
834 *waitingFor.slot = slotId;
835 *waitingFor.page = pageId;
836 waitingFor.slot = nullptr;
837 waitingFor.page = nullptr;
838 pageId = Ipc::Mem::PageId();
839 }
840}
841
842void
844{
845 assert(e.mem_obj);
846
847 debugs(20, 7, "entry " << e);
848
849 switch (e.mem_obj->memCache.io) {
851 if (!shouldCache(e) || !startCaching(e)) {
853 e.memOutDecision(false);
854 return;
855 }
856 break;
857
860 return; // we should not write in all of the above cases
861
863 break; // already decided to write and still writing
864 }
865
866 try {
867 copyToShm(e);
868 if (e.store_status == STORE_OK) // done receiving new content
870 else
872 return;
873 } catch (const std::exception &x) { // TODO: should we catch ... as well?
874 debugs(20, 2, "mem-caching error writing entry " << e << ": " << x.what());
875 // fall through to the error handling code
876 }
877
878 disconnect(e);
879}
880
881void
883{
884 assert(e.mem_obj);
885 const int32_t index = e.mem_obj->memCache.index;
886 assert(index >= 0);
887 assert(map);
888
889 debugs(20, 5, "mem-cached all " << e.mem_obj->memCache.offset << " bytes of " << e);
890
891 e.mem_obj->memCache.index = -1;
893 map->closeForWriting(index);
894
896 e.storeWriterDone();
897}
898
899void
901{
902 debugs(47, 5, e);
903 if (e.hasMemStore()) {
906 if (!e.locked()) {
907 disconnect(e);
909 }
910 } else if (const auto key = e.publicKey()) {
911 // the entry may have been loaded and then disconnected from the cache
912 evictIfFound(key);
913 if (!e.locked())
915 }
916}
917
918void
920{
921 if (map)
922 map->freeEntryByKey(key);
923}
924
925void
927{
928 assert(e.mem_obj);
929 MemObject &mem_obj = *e.mem_obj;
930 if (e.hasMemStore()) {
931 if (mem_obj.memCache.io == MemObject::ioWriting) {
932 map->abortWriting(mem_obj.memCache.index);
933 mem_obj.memCache.index = -1;
934 mem_obj.memCache.io = MemObject::ioDone;
936 e.storeWriterDone();
937 } else {
940 mem_obj.memCache.index = -1;
941 mem_obj.memCache.io = MemObject::ioDone;
942 }
943 }
944}
945
946bool
948{
949 return Config.memShared && Config.memMaxSize > 0;
950}
951
953int64_t
955{
956 if (!Requested())
957 return 0;
958
959 const int64_t minEntrySize = Ipc::Mem::PageSize();
960 const int64_t entryLimit = Config.memMaxSize / minEntrySize;
961 return entryLimit;
962}
963
968{
969public:
970 /* RegisteredRunner API */
971 MemStoreRr(): spaceOwner(nullptr), mapOwner(nullptr), extrasOwner(nullptr) {}
972 virtual void finalizeConfig();
973 virtual void claimMemoryNeeds();
974 virtual void useConfig();
975 virtual ~MemStoreRr();
976
977protected:
978 /* Ipc::Mem::RegisteredRunner API */
979 virtual void create();
980
981private:
985};
986
988
989void
991{
993}
994
995void
997{
998 // decide whether to use a shared memory cache if the user did not specify
999 if (!Config.memShared.configured()) {
1001 Config.memMaxSize > 0);
1002 } else if (Config.memShared && !Ipc::Mem::Segment::Enabled()) {
1003 fatal("memory_cache_shared is on, but no support for shared memory detected");
1004 } else if (Config.memShared && !UsingSmp()) {
1005 debugs(20, DBG_IMPORTANT, "WARNING: memory_cache_shared is on, but only"
1006 " a single worker is running");
1007 }
1008
1010 debugs(20, DBG_IMPORTANT, "WARNING: mem-cache size is too small (" <<
1011 (Config.memMaxSize / 1024.0) << " KB), should be >= " <<
1012 (Ipc::Mem::PageSize() / 1024.0) << " KB");
1013 }
1014}
1015
1016void
1018{
1021}
1022
1023void
1025{
1026 if (!MemStore::Enabled())
1027 return;
1028
1029 const int64_t entryLimit = MemStore::EntryLimit();
1030 assert(entryLimit > 0);
1031
1032 Ipc::Mem::PageStack::Config spaceConfig;
1034 spaceConfig.pageSize = 0; // the pages are stored in Ipc::Mem::Pages
1035 spaceConfig.capacity = entryLimit;
1036 spaceConfig.createFull = true; // all pages are initially available
1037 Must(!spaceOwner);
1039 Must(!mapOwner);
1040 mapOwner = MemStoreMap::Init(MapLabel, entryLimit);
1041 Must(!extrasOwner);
1043}
1044
1046{
1047 delete extrasOwner;
1048 delete mapOwner;
1049 delete spaceOwner;
1050}
1051
static const SBuf MapLabel("cache_mem_map")
shared memory segment path to use for MemStore maps
RunnerRegistrationEntry(MemStoreRr)
static const char * ExtrasLabel
shared memory segment path to use for IDs of shared pages with slice data
Definition: MemStore.cc:30
static const char * SpaceLabel
shared memory segment path to use for the free slices index
Definition: MemStore.cc:28
Ipc::StoreMap MemStoreMap
Definition: MemStore.h:23
#define shm_new(Class)
Definition: Pointer.h:200
#define shm_old(Class)
Definition: Pointer.h:201
class SquidConfig Config
Definition: SquidConfig.cc:12
FREE destroyStoreEntry
#define TexcHere(msg)
legacy convenience macro; it is not difficult to type Here() now
Definition: TextException.h:59
#define Must(condition)
Definition: TextException.h:71
#define assert(EX)
Definition: assert.h:19
static void Broadcast(const StoreEntry &e, const bool includingThisWorker=false)
notify other workers about changes in entry state (e.g., new data)
void packHeadersUsingSlowPacker(Packable &p) const
same as packHeadersUsingFastPacker() but assumes that p cannot quickly process small additions
Definition: HttpReply.cc:93
int hdr_sz
Definition: Message.h:81
Shared memory page identifier, address, or handler.
Definition: Page.h:24
PoolId pool
Definition: Page.h:39
uint32_t number
page number within the segment
Definition: Page.h:42
bool set() const
true if and only if both critical components have been initialized
Definition: Page.h:29
PageStack construction and SharedMemorySize calculation parameters.
Definition: PageStack.h:123
PageCount capacity
the maximum number of pages
Definition: PageStack.h:127
uint32_t poolId
pool ID
Definition: PageStack.h:125
size_t pageSize
page size, used to calculate shared memory size
Definition: PageStack.h:126
bool createFull
whether a newly created PageStack should be prefilled with PageIds
Definition: PageStack.h:130
static PoolId IdForMemStoreSpace()
stack of free cache_mem slot positions
Definition: PageStack.h:167
bool pop(PageId &page)
sets value and returns true unless no free page numbers are found
Definition: PageStack.cc:442
void push(PageId &page)
makes value available as a free page number to future pop() callers
Definition: PageStack.cc:465
virtual void useConfig()
Definition: Segment.cc:377
static bool Enabled()
Whether shared memory support is available.
Definition: Segment.cc:322
approximate stats of a set of ReadWriteLocks
Definition: ReadWriteLock.h:66
std::atomic< StoreMapSliceId > start
where the chain of StoreEntry slices begins [app]
Definition: StoreMap.h:111
struct Ipc::StoreMapAnchor::Basics basics
bool complete() const
Definition: StoreMap.h:77
std::atomic< uint8_t > writerHalted
whether StoreMap::abortWriting() was called for a read-locked entry
Definition: StoreMap.h:83
void set(const StoreEntry &anEntry, const cache_key *aKey=nullptr)
store StoreEntry key and basics for an inode slot
Definition: StoreMap.cc:959
void exportInto(StoreEntry &) const
load StoreEntry basics that were previously stored with set()
Definition: StoreMap.cc:979
uint32_t Size
Definition: StoreMap.h:31
std::atomic< StoreMapSliceId > next
ID of the next entry slice.
Definition: StoreMap.h:49
std::atomic< Size > size
slice contents size
Definition: StoreMap.h:48
sfileno fileNo
StoreMap::fileNos[name], for convenience/speed.
Definition: StoreMap.h:194
StoreMapSliceId splicingPoint
the last slice in the chain still containing metadata/headers
Definition: StoreMap.h:198
StoreMapAnchor * anchor
StoreMap::anchors[fileNo], for convenience/speed.
Definition: StoreMap.h:193
Aggregates information required for updating entry metadata and headers.
Definition: StoreMap.h:182
Edition fresh
new anchor and the updated chain prefix
Definition: StoreMap.h:209
Edition stale
old anchor and chain
Definition: StoreMap.h:208
StoreEntry * entry
the store entry being updated
Definition: StoreMap.h:207
aggregates anchor and slice owners for Init() caller convenience
Definition: StoreMap.h:233
Anchor * openForWriting(const cache_key *const key, sfileno &fileno)
Definition: StoreMap.cc:140
const Slice & readableSlice(const AnchorId anchorId, const SliceId sliceId) const
readable slice within an entry chain opened by openForReading()
Definition: StoreMap.cc:229
bool openForUpdating(Update &update, sfileno fileNoHint)
finds and locks the Update entry for an exclusive metadata update
Definition: StoreMap.cc:523
Anchor & writeableEntry(const AnchorId anchorId)
writeable anchor for the entry created by openForWriting()
Definition: StoreMap.cc:237
const Anchor & readableEntry(const AnchorId anchorId) const
readable anchor for the entry created by openForReading()
Definition: StoreMap.cc:244
int entryCount() const
number of writeable and readable entries
Definition: StoreMap.cc:739
static Owner * Init(const SBuf &path, const int slotLimit)
initialize shared memory
Definition: StoreMap.cc:42
void closeForWriting(const sfileno fileno)
successfully finish creating or updating the entry at fileno pos
Definition: StoreMap.cc:200
StoreMapCleaner * cleaner
notified before a readable entry is freed
Definition: StoreMap.h:361
void abortUpdating(Update &update)
undoes partial update, unlocks, and cleans up
Definition: StoreMap.cc:269
SliceId sliceContaining(const sfileno fileno, const uint64_t nth) const
Definition: StoreMap.cc:421
const Anchor * openForReading(const cache_key *const key, sfileno &fileno)
opens entry (identified by key) for reading, increments read level
Definition: StoreMap.cc:440
bool freeEntry(const sfileno)
Definition: StoreMap.cc:313
void closeForReading(const sfileno fileno)
closes open entry after reading, decrements read level
Definition: StoreMap.cc:497
void abortWriting(const sfileno fileno)
stop writing the entry, freeing its slot for others to use if possible
Definition: StoreMap.cc:251
void startAppending(const sfileno fileno)
restrict opened for writing entry to appending operations; allow reads
Definition: StoreMap.cc:191
void prepFreeSlice(const SliceId sliceId)
prepare a chain-unaffiliated slice for being added to an entry chain
Definition: StoreMap.cc:413
void closeForUpdating(Update &update)
makes updated info available to others, unlocks, and cleans up
Definition: StoreMap.cc:605
bool purgeOne()
either finds and frees an entry with at least 1 slice or returns false
Definition: StoreMap.cc:702
void updateStats(ReadWriteLockStats &stats) const
adds approximate current stats to the supplied ones
Definition: StoreMap.cc:751
void freeEntryByKey(const cache_key *const key)
Definition: StoreMap.cc:331
Slice & writeableSlice(const AnchorId anchorId, const SliceId sliceId)
writeable slice within an entry chain created by openForWriting()
Definition: StoreMap.cc:221
int sliceLimit() const
maximum number of slices possible
Definition: StoreMap.cc:745
int entryLimit() const
maximum entryCount() possible
Definition: StoreMap.cc:733
Definition: MemBuf.h:24
virtual void append(const char *c, int sz)
Definition: MemBuf.cc:209
void init(mb_size_t szInit, mb_size_t szMax)
Definition: MemBuf.cc:93
char * buf
Definition: MemBuf.h:134
void terminate()
Definition: MemBuf.cc:241
State of an entry with regards to the [shared] memory caching.
Definition: MemObject.h:179
int32_t index
entry position inside the memory cache
Definition: MemObject.h:181
Io io
current I/O state
Definition: MemObject.h:184
int64_t offset
bytes written/read to/from the memory cache so far
Definition: MemObject.h:182
static constexpr Io ioDone
Definition: MemObject.h:166
static constexpr Io ioUndecided
Definition: MemObject.h:163
int64_t expectedReplySize() const
Definition: MemObject.cc:238
SBuf vary_headers
Definition: MemObject.h:204
static constexpr Io ioWriting
Definition: MemObject.h:165
mem_hdr data_hdr
Definition: MemObject.h:138
const HttpReply & freshestReply() const
Definition: MemObject.h:67
static constexpr Io ioReading
Definition: MemObject.h:164
MemCache memCache
current [shared] memory caching state for the entry
Definition: MemObject.h:186
int64_t endOffset() const
Definition: MemObject.cc:214
const HttpReply & baseReply() const
Definition: MemObject.h:59
HttpReply & adjustableBaseReply()
Definition: MemObject.cc:121
bool isContiguous() const
Definition: MemObject.cc:400
int64_t object_sz
Definition: MemObject.h:198
virtual void finalizeConfig()
Definition: MemStore.cc:996
virtual void useConfig()
Definition: MemStore.cc:1017
Ipc::Mem::Owner< Ipc::Mem::PageStack > * spaceOwner
free slices Owner
Definition: MemStore.cc:982
virtual void create()
called when the runner should create a new memory segment
Definition: MemStore.cc:1024
virtual void claimMemoryNeeds()
Definition: MemStore.cc:990
MemStoreMap::Owner * mapOwner
primary map Owner
Definition: MemStore.cc:983
virtual ~MemStoreRr()
Definition: MemStore.cc:1045
Ipc::Mem::Owner< MemStoreMapExtras > * extrasOwner
PageIds Owner.
Definition: MemStore.cc:984
Ipc::Mem::PageId * slot
local slot variable, waiting to be filled
Definition: MemStore.h:114
Ipc::Mem::PageId * page
local page variable, waiting to be filled
Definition: MemStore.h:115
virtual bool updateAnchored(StoreEntry &) override
Definition: MemStore.cc:410
void anchorEntry(StoreEntry &e, const sfileno index, const Ipc::StoreMapAnchor &anchor)
anchors StoreEntry to an already locked map entry
Definition: MemStore.cc:433
virtual void updateHeaders(StoreEntry *e) override
make stored metadata and HTTP headers the same as in the given entry
Definition: MemStore.cc:333
sfileno lastWritingSlice
the last allocate slice for writing a store entry (during copyToShm)
Definition: MemStore.h:106
virtual uint64_t currentCount() const override
the total number of objects stored right now
Definition: MemStore.cc:277
Ipc::Mem::Pointer< Extras > extras
IDs of pages with slice data.
Definition: MemStore.h:103
Ipc::Mem::PageId pageForSlice(Ipc::StoreMapSliceId sliceId)
safely returns a previously allocated memory page for the given entry slice
Definition: MemStore.cc:771
bool updateAnchoredWith(StoreEntry &, const sfileno, const Ipc::StoreMapAnchor &)
updates Transients entry after its anchor has been located
Definition: MemStore.cc:424
void copyToShmSlice(StoreEntry &e, Ipc::StoreMapAnchor &anchor, Ipc::StoreMap::Slice &slice)
copies at most one slice worth of local memory to shared memory
Definition: MemStore.cc:704
void disconnect(StoreEntry &e)
called when the entry is about to forget its association with mem cache
Definition: MemStore.cc:926
virtual uint64_t minSize() const override
the minimum size the store will shrink to via normal housekeeping
Definition: MemStore.cc:258
bool shouldCache(StoreEntry &e) const
whether we should cache the entry
Definition: MemStore.cc:578
MemStore()
Definition: MemStore.cc:161
virtual ~MemStore()
Definition: MemStore.cc:165
virtual void evictCached(StoreEntry &) override
Definition: MemStore.cc:900
Ipc::Mem::Pointer< Ipc::Mem::PageStack > freeSlots
unused map slot IDs
Definition: MemStore.h:99
SlotAndPage waitingFor
a cache for a single "hot" free slot and page
Definition: MemStore.h:117
void completeWriting(StoreEntry &e)
all data has been received; there will be no more write() calls
Definition: MemStore.cc:882
virtual void stat(StoreEntry &e) const override
Definition: MemStore.cc:215
virtual uint64_t maxSize() const override
Definition: MemStore.cc:264
virtual StoreEntry * get(const cache_key *) override
Definition: MemStore.cc:301
void copyToShm(StoreEntry &e)
copies all local data to shared memory
Definition: MemStore.cc:668
virtual int64_t maxObjectSize() const override
the maximum size of a storable object; -1 if unlimited
Definition: MemStore.cc:283
Ipc::StoreMap::Slice & nextAppendableSlice(const sfileno entryIndex, sfileno &sliceOffset)
Definition: MemStore.cc:735
static int64_t EntryLimit()
calculates maximum number of entries we need to store and map
Definition: MemStore.cc:954
sfileno reserveSapForWriting(Ipc::Mem::PageId &page)
finds a slot and a free page to fill or throws
Definition: MemStore.cc:782
virtual void init() override
Definition: MemStore.cc:171
virtual void evictIfFound(const cache_key *) override
Definition: MemStore.cc:919
virtual void reference(StoreEntry &e) override
somebody needs this entry (many cache replacement policies need to know)
Definition: MemStore.cc:289
static bool Enabled()
whether Squid is correctly configured to use a shared memory cache
Definition: MemStore.h:68
void updateHeadersOrThrow(Ipc::StoreMapUpdate &update)
Definition: MemStore.cc:353
static bool Requested()
Definition: MemStore.cc:947
virtual bool anchorToCache(StoreEntry &e, bool &inSync) override
Definition: MemStore.cc:393
bool copyFromShm(StoreEntry &e, const sfileno index, const Ipc::StoreMapAnchor &anchor)
copies the entire entry from shared to local memory
Definition: MemStore.cc:458
virtual bool dereference(StoreEntry &e) override
Definition: MemStore.cc:294
void write(StoreEntry &e)
copy non-shared entry data of the being-cached entry to our cache
Definition: MemStore.cc:843
bool copyFromShmSlice(StoreEntry &e, const StoreIOBuffer &buf, bool eof)
imports one shared memory slice into local memory
Definition: MemStore.cc:541
virtual uint64_t currentSize() const override
current size
Definition: MemStore.cc:270
virtual void maintain() override
perform regular periodic maintenance; TODO: move to UFSSwapDir::Maintain
Definition: MemStore.cc:253
bool startCaching(StoreEntry &e)
locks map anchor and preps to store the entry in shared memory
Definition: MemStore.cc:645
virtual void noteFreeMapSlice(const Ipc::StoreMapSliceId sliceId) override
adjust slice-linked state before a locked Readable slice is erased
Definition: MemStore.cc:821
MemStoreMap * map
index of mem-cached entries
Definition: MemStore.h:100
virtual void getStats(StoreInfoStats &stats) const override
collect statistics
Definition: MemStore.cc:202
Definition: SBuf.h:94
const char * rawContent() const
Definition: SBuf.cc:509
SBuf & vappendf(const char *fmt, va_list vargs)
Definition: SBuf.cc:239
size_type length() const
Returns the number of bytes stored in SBuf.
Definition: SBuf.h:415
bool isEmpty() const
Definition: SBuf.h:431
void copyToShm()
copies the entire buffer to shared memory
Definition: MemStore.cc:115
StoreEntry * entry
the entry being updated
Definition: MemStore.cc:45
const char * buf
content being appended now
Definition: MemStore.cc:65
Ipc::StoreMapSliceId firstSlice
Definition: MemStore.cc:49
int bufWritten
buf bytes appended so far
Definition: MemStore.cc:67
uint64_t totalWritten
cumulative number of bytes appended so far
Definition: MemStore.cc:54
MemStore & store
Definition: MemStore.cc:61
Ipc::StoreMapSliceId lastSlice
the slot keeping the last byte of the appended content (at least)
Definition: MemStore.cc:52
virtual void append(const char *aBuf, int aSize) override
Appends a c-string to existing packed data.
Definition: MemStore.cc:87
virtual void vappendf(const char *fmt, va_list ap) override
Definition: MemStore.cc:103
ShmWriter(MemStore &aStore, StoreEntry *anEntry, const sfileno aFileNo, Ipc::StoreMapSliceId aFirstSlice=-1)
Definition: MemStore.cc:72
const sfileno fileNo
Definition: MemStore.cc:62
void copyToShmSlice(Ipc::StoreMap::Slice &slice)
copies at most one slice worth of buffer to shared memory
Definition: MemStore.cc:133
int bufSize
buf size
Definition: MemStore.cc:66
size_t memMaxSize
Definition: SquidConfig.h:89
Store::DiskConfig cacheSwap
Definition: SquidConfig.h:421
size_t maxInMemObjSize
Definition: SquidConfig.h:266
struct SquidConfig::@109 Store
YesNoNone memShared
whether the memory cache is shared among workers
Definition: SquidConfig.h:87
mem_status_t mem_status
Definition: Store.h:240
uint16_t flags
Definition: Store.h:232
MemObject & mem()
Definition: Store.h:51
int locked() const
Definition: Store.h:146
bool hasMemStore() const
whether there is a corresponding locked shared memory table entry
Definition: Store.h:213
bool memoryCachable()
checkCachable() and can be cached in memory
Definition: store.cc:1249
bool hasDisk(const sdirno dirn=-1, const sfileno filen=-1) const
Definition: store.cc:1896
const cache_key * publicKey() const
Definition: Store.h:113
void memOutDecision(const bool willCacheInRam)
Definition: store.cc:1758
void storeWriterDone()
called when a store writer ends its work (successfully or not)
Definition: store.cc:1775
MemObject * mem_obj
Definition: Store.h:221
store_status_t store_status
Definition: Store.h:244
void createMemObject()
Definition: store.cc:1542
uint64_t swap_file_sz
Definition: Store.h:230
void setMemStatus(mem_status_t)
Definition: store.cc:1491
void destroyMemObject()
Definition: store.cc:359
int64_t offset
Definition: StoreIOBuffer.h:55
High-level store statistics used by mgr:info action. Used inside PODs!
Definition: StoreStats.h:14
virtual int64_t maxObjectSize() const override
the maximum size of a storable object; -1 if unlimited
Definition: Controller.cc:187
void configure(bool beSet)
enables or disables the option; updating to 'configured' state
Definition: YesNoNone.h:53
bool configured() const
Definition: YesNoNone.h:67
ssize_t copy(StoreIOBuffer const &) const
Definition: stmem.cc:225
bool write(StoreIOBuffer const &)
Definition: stmem.cc:341
A const & max(A const &lhs, A const &rhs)
A const & min(A const &lhs, A const &rhs)
#define DBG_IMPORTANT
Definition: Stream.h:41
#define debugs(SECTION, LEVEL, CONTENT)
Definition: Stream.h:196
#define EBIT_SET(flag, bit)
Definition: defines.h:67
#define EBIT_TEST(flag, bit)
Definition: defines.h:69
@ NOT_IN_MEMORY
Definition: enums.h:35
@ IN_MEMORY
Definition: enums.h:36
@ ENTRY_VALIDATED
Definition: enums.h:113
@ ENTRY_SPECIAL
Definition: enums.h:84
@ ENTRY_FWD_HDR_WAIT
Definition: enums.h:111
@ STORE_PENDING
Definition: enums.h:51
@ STORE_OK
Definition: enums.h:50
void fatal(const char *message)
Definition: fatal.cc:28
int shutting_down
size_t PageLevel()
approximate total number of shared memory pages used now
Definition: Pages.cc:80
bool GetPage(const PageId::Purpose purpose, PageId &page)
sets page ID and returns true unless no free pages are found
Definition: Pages.cc:34
size_t PagesAvailable()
approximate total number of shared memory pages we can allocate now
Definition: Pages.h:47
size_t PageSize()
returns page size in bytes; all pages are assumed to be the same size
Definition: Pages.cc:28
void NotePageNeed(const int purpose, const int count)
claim the need for a number of pages for a given purpose
Definition: Pages.cc:72
void PutPage(PageId &page)
makes identified page available as a free page to future GetPage() callers
Definition: Pages.cc:41
char * PagePointer(const PageId &page)
converts page handler into a temporary writeable shared memory pointer
Definition: Pages.cc:48
size_t PageLimit()
the total number of shared memory pages that can be in use at any time
Definition: Pages.cc:55
int32_t StoreMapSliceId
Definition: StoreMap.h:24
double doublePercent(const double, const double)
Definition: SquidMath.cc:25
class Ping::pingStats_ stats
Controller & Root()
safely access controller singleton
Definition: Controller.cc:926
unsigned char cache_key
Store key.
Definition: forward.h:29
signed_int32_t sfileno
Definition: forward.h:22
void storeAppendPrintf(StoreEntry *e, const char *fmt,...)
Definition: store.cc:828
std::atomic< uint64_t > swap_file_sz
Definition: StoreMap.h:105
bool UsingSmp()
Whether there should be more than one worker process running.
Definition: tools.cc:693
#define PRId64
Definition: types.h:110

 

Introduction

Documentation

Support

Miscellaneous

Web Site Translations

Mirrors