Add negative caching for HashedObject class. This massively reduces

contention for the database lock under high network ledger fetch load.
This commit is contained in:
JoelKatz
2013-01-08 14:50:03 -08:00
parent fbac342e2e
commit 607e2039e2
3 changed files with 125 additions and 3 deletions

View File

@@ -10,6 +10,7 @@
#include "uint256.h"
#include "ScopedLock.h"
#include "TaggedCache.h"
#include "KeyCache.h"
#include "InstanceCounter.h"
DEFINE_INSTANCE(HashedObject);
@@ -45,7 +46,8 @@ public:
class HashedObjectStore
{
protected:
TaggedCache<uint256, HashedObject> mCache;
TaggedCache<uint256, HashedObject> mCache;
KeyCache<uint256> mNegativeCache;
boost::mutex mWriteMutex;
boost::condition_variable mWriteCondition;
@@ -65,7 +67,7 @@ public:
void bulkWrite();
void waitWrite();
void sweep() { mCache.sweep(); }
void sweep() { mCache.sweep(); mNegativeCache.sweep(); }
};
#endif