updated sample configuration

This commit is contained in:
Manfred Klimt 2018-06-29 11:17:02 +02:00
parent 71d7f96944
commit cdcc8bd9ea
4 changed files with 19 additions and 11 deletions

View file

@ -1,6 +1,6 @@
###############################################################################
#
# Sample configuration file for WANProxy XTech v3.0
# Sample configuration file for WANProxy XTech v3.0.5
#
# Codec definition must include following cache directives:
# - cache: Memory (default) or COSS (use persistent cache in disk)
@ -15,9 +15,8 @@
# a proxy taking unencoded input and writing encoded output
# is considered to be a client.
#
# Only one proxy may be defined per instance. To host several proxies
# on the same node different processes must be launched each one with
# its own configuration.
# Any number of proxies can be defined in the same config file, and they will
# share the specified cache if using the same codec.
#
# Upon reception of SIGHUP the daemon will reread this file and apply the
# new values to any subsequent connections.

View file

@ -91,11 +91,10 @@ XCodecCacheCOSS::~XCodecCacheCOSS()
delete[] directory_;
INFO(log_) << "Stats: ";
INFO(log_) << "\tLookups=" << stats_.lookups;
INFO(log_) << "\tHits=" << (stats_.found_1 + stats_.found_2) << " (" << stats_.found_1 << " + " << stats_.found_2 << ")";
if (stats_.lookups > 0)
INFO(log_) << "\tHit ratio=" << ((stats_.found_1 + stats_.found_2) * 100) / stats_.lookups << "%";
INFO(log_) << "Cache statistics: ";
INFO(log_) << "Lookups: " << stats_.lookups;
INFO(log_) << "Matches: " << (stats_.found_1 + stats_.found_2) << " (" << stats_.found_1 << " + " << stats_.found_2 << ")";
INFO(log_) << "File: " << file_path_;
DEBUG(log_) << "Closing coss file: " << file_path_;
DEBUG(log_) << "Serial: " << serial_number_;

View file

@ -89,8 +89,6 @@ using namespace std;
#define HEADER_ALIGNED_SIZE ROUND_UP(HEADER_ARRAY_SIZE + METADATA_SIZE, CACHE_ALIGNEMENT)
#define METADATA_PADDING (HEADER_ALIGNED_SIZE - HEADER_ARRAY_SIZE - METADATA_SIZE)
#define USING_XCODEC_CACHE_RECENT_WINDOW
struct COSSIndexEntry
{
uint64_t stripe_range : 48;

View file

@ -43,6 +43,8 @@
// //
////////////////////////////////////////////////////////////////////////////////
#define USING_XCODEC_CACHE_RECENT_WINDOW
#define XCODEC_WINDOW_COUNT 64 // must be binary
/*
@ -89,17 +91,21 @@ class XCodecCache
private:
UUID uuid_;
size_t size_;
#ifdef USING_XCODEC_CACHE_RECENT_WINDOW
struct WindowItem {uint64_t hash; const uint8_t* data;};
WindowItem window_[XCODEC_WINDOW_COUNT];
unsigned cursor_;
#endif
protected:
XCodecCache (const UUID& uuid, size_t size)
: uuid_(uuid),
size_(size)
{
#ifdef USING_XCODEC_CACHE_RECENT_WINDOW
memset (window_, 0, sizeof window_);
cursor_ = 0;
#endif
}
public:
@ -119,6 +125,7 @@ public:
virtual void enter (const uint64_t& hash, const Buffer& buf, unsigned off) = 0;
virtual bool lookup (const uint64_t& hash, Buffer& buf) = 0;
#ifdef USING_XCODEC_CACHE_RECENT_WINDOW
protected:
void remember (const uint64_t& hash, const uint8_t* data)
{
@ -148,6 +155,7 @@ protected:
if (w->hash == hash)
w->hash = 0;
}
#endif
};
@ -181,17 +189,21 @@ public:
bool lookup (const uint64_t& hash, Buffer& buf)
{
#ifdef USING_XCODEC_CACHE_RECENT_WINDOW
const uint8_t* data;
if ((data = find_recent (hash)))
{
buf.append (data, XCODEC_SEGMENT_LENGTH);
return true;
}
#endif
segment_hash_map_t::const_iterator it = segment_hash_map_.find (hash);
if (it != segment_hash_map_.end ())
{
buf.append (it->second, XCODEC_SEGMENT_LENGTH);
#ifdef USING_XCODEC_CACHE_RECENT_WINDOW
remember (hash, it->second);
#endif
return true;
}
return false;