@@ -6,7 +6,7 @@ NFD's Content Store
66The Contest Store (CS) is implemented as a set of :ndnsim: `CS entries <nfd::cs::EntryImpl> `),
77ordered by the full data name including the implicit digest. To manage entries, CS adopts a cache policy interface (:ndnsim: `nfd::cs::Policy `), invoked any time a CS entry is added, removed, updated, or used.
88
9- By default, ndnSIM uses NFD's Content Store with an option to use an old-style ndnSIM-specific content store implementations (see :ref: ` old_cs `). The supported cache replacement policies are the following:
9+ The supported cache replacement policies are the following:
1010
1111+----------------------------------------------+----------------------------------------------------------+
1212| **NFD's Content Store Policies ** |
@@ -55,8 +55,7 @@ Examples:
5555
5656- To effectively disable NFD content store an all nodes
5757
58- Minimum allowed value for NFD content store maximum size is 1. If 0 is specified, it will be assumed
59- that the old content store implementation should be used.
58+ Minimum allowed value for NFD content store maximum size is 1.
6059
6160 .. code-block :: c++
6261
@@ -75,131 +74,9 @@ contains:
7574- flag indicating whether the Data packet is unsolicited
7675- the timestamp at which the cached Data becomes stale
7776
78- .. _old_cs :
79-
80- Old Content Store Implementations
81- +++++++++++++++++++++++++++++++++
82-
83- We have also ported the old ndnSIM 1.0 content store implementations to the new code base.
84- These implementations feature different cache replacement policies, but have very limited
85- support for Interest selectors. If your scenario relies on proper selector processing,
86- do not use these implementations as the simulation results most likely be incorrect.
87-
88- To select old content store implementations, use :ndnsim: `StackHelper::SetOldContentStore `:
89-
90- .. code-block :: c++
91-
92- ndnHelper.SetOldContentStore("<content store implementation>",
93- ["<optional parameter>", "<optional parameter's value>" [, ...]]);
94- ...
95- ndnHelper.Install (nodes);
96-
97- Available old content store implementations are listed in the following table:
98-
99-
100- +----------------------------------------------+----------------------------------------------------------+
101- | **Simple content stores ** |
102- +----------------------------------------------+----------------------------------------------------------+
103- | ``ns3::ndn::cs::Lru `` | **Least recently used (LRU) (default) ** |
104- +----------------------------------------------+----------------------------------------------------------+
105- | ``ns3::ndn::cs::Fifo `` | First-in-first-Out (FIFO) |
106- +----------------------------------------------+----------------------------------------------------------+
107- | ``ns3::ndn::cs::Lfu `` | Least frequently used (LFU) |
108- +----------------------------------------------+----------------------------------------------------------+
109- | ``ns3::ndn::cs::Random `` | Random |
110- +----------------------------------------------+----------------------------------------------------------+
111- | ``ns3::ndn::cs::Nocache `` | Policy that completely disables caching |
112- +----------------------------------------------+----------------------------------------------------------+
113- +----------------------------------------------+----------------------------------------------------------+
114- | **Content stores with entry lifetime tracking ** |
115- | |
116- | These policies allow evaluation of CS enties lifetime (i.e., how long entries stay in CS) |
117- +----------------------------------------------+----------------------------------------------------------+
118- | ``ns3::ndn::cs::Stats::Lru `` | Least recently used (LRU) |
119- +----------------------------------------------+----------------------------------------------------------+
120- | ``ns3::ndn::cs::Stats::Fifo `` | Least frequently used (LFU) |
121- +----------------------------------------------+----------------------------------------------------------+
122- | ``ns3::ndn::cs::Stats::Lfu `` | Random |
123- +----------------------------------------------+----------------------------------------------------------+
124- | ``ns3::ndn::cs::Stats::Random `` | Policy that completely disables caching |
125- +----------------------------------------------+----------------------------------------------------------+
126- +----------------------------------------------+----------------------------------------------------------+
127- | **Content stores respecting freshness field of Data packets ** |
128- | |
129- | These policies cache Data packets only for the time indicated by FreshnessPeriod. |
130- +----------------------------------------------+----------------------------------------------------------+
131- | ``ns3::ndn::cs::Freshness::Lru `` | Least recently used (LRU) |
132- +----------------------------------------------+----------------------------------------------------------+
133- | ``ns3::ndn::cs::Freshness::Fifo `` | Least frequently used (LFU) |
134- +----------------------------------------------+----------------------------------------------------------+
135- | ``ns3::ndn::cs::Freshness::Lfu `` | Random |
136- +----------------------------------------------+----------------------------------------------------------+
137- | ``ns3::ndn::cs::Freshness::Random `` | Policy that completely disables caching |
138- +----------------------------------------------+----------------------------------------------------------+
139- +----------------------------------------------+----------------------------------------------------------+
140- | **Content store realization that probabilistically accepts data packet into CS (placement policy) ** |
141- +----------------------------------------------+----------------------------------------------------------+
142- | ``ns3::ndn::cs::Probability::Lru `` | Least recently used (LRU) |
143- +----------------------------------------------+----------------------------------------------------------+
144- | ``ns3::ndn::cs::Probability::Fifo `` | Least frequently used (LFU) |
145- +----------------------------------------------+----------------------------------------------------------+
146- | ``ns3::ndn::cs::Probability::Lfu `` | Random |
147- +----------------------------------------------+----------------------------------------------------------+
148- | ``ns3::ndn::cs::Probability::Random `` | Policy that completely disables caching |
149- +----------------------------------------------+----------------------------------------------------------+
150-
151- Examples:
152-
153-
154- - Select simple LRU policy on node1, simple FIFO policy on node2, and simple random policy on
155- other nodes with maximum CS sizes of 10000 packets:
156-
157- .. code-block :: c++
158-
159- ndnHelper.SetOldContentStore("ns3::ndn::cs: :Lru", "MaxSize", "10000");
160- ndnHelper.Install(node1);
161-
162- ndnHelper.SetOldContentStore("ns3::ndn::cs: :Fifo", "MaxSize", "10000");
163- ndnHelper.Install(node2);
164-
165- ndnHelper.SetOldContentStore("ns3::ndn::cs: :Random", "MaxSize", "10000");
166- ...
167- ndnHelper.Install(otherNodes);
168-
169- .. note ::
170-
171- If ``MaxSize `` parameter is omitted, then will be used a default value (100).
172-
173- .. note ::
174-
175- If ``MaxSize `` is set to 0, then no limit on ContentStore will be enforced
176-
177- - Disable CS on node2
178-
179- .. code-block :: c++
180-
181- ndnHelper.SetOldContentStore("ns3::ndn::cs: :Nocache");
182- ndnHelper.Install(node3);
183-
184- - Track lifetime of CS entries (must use ``ns3::ndn::cs::*::LifetimeStats `` policy):
185-
186- .. code-block :: c++
187-
188- void
189- CacheEntryRemoved(std::string context, Ptr<const ndn::cs: :Entry> entry, Time lifetime)
190- {
191- std::cout << entry->GetName() << " " << lifetime.ToDouble(Time::S) << "s" << std::endl;
192- }
193-
194- ...
195-
196- ndnHelper.SetOldContentStore("ns3::ndn::cs::Stats: :Lru", "MaxSize", "10000");
197- ...
198- ndnHelper.Install(nodes);
199-
200- // connect to lifetime trace
201- Config::Connect("/NodeList/*/$ns3::ndn::cs::Stats::Lru/WillRemoveEntry", MakeCallback(CacheEntryRemoved));
202-
77+ Misc
78+ ~~~~
79+
20380- Get aggregate statistics of CS hit/miss ratio (works with any policy)
20481
20582 The simplest way tro track CS hit/miss statistics is to use :ndnsim: `CsTracer `, in more
0 commit comments