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

View file

@ -91,11 +91,10 @@ XCodecCacheCOSS::~XCodecCacheCOSS()
delete[] directory_; delete[] directory_;
INFO(log_) << "Stats: "; INFO(log_) << "Cache statistics: ";
INFO(log_) << "\tLookups=" << stats_.lookups; INFO(log_) << "Lookups: " << stats_.lookups;
INFO(log_) << "\tHits=" << (stats_.found_1 + stats_.found_2) << " (" << stats_.found_1 << " + " << stats_.found_2 << ")"; INFO(log_) << "Matches: " << (stats_.found_1 + stats_.found_2) << " (" << stats_.found_1 << " + " << stats_.found_2 << ")";
if (stats_.lookups > 0) INFO(log_) << "File: " << file_path_;
INFO(log_) << "\tHit ratio=" << ((stats_.found_1 + stats_.found_2) * 100) / stats_.lookups << "%";
DEBUG(log_) << "Closing coss file: " << file_path_; DEBUG(log_) << "Closing coss file: " << file_path_;
DEBUG(log_) << "Serial: " << serial_number_; 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 HEADER_ALIGNED_SIZE ROUND_UP(HEADER_ARRAY_SIZE + METADATA_SIZE, CACHE_ALIGNEMENT)
#define METADATA_PADDING (HEADER_ALIGNED_SIZE - HEADER_ARRAY_SIZE - METADATA_SIZE) #define METADATA_PADDING (HEADER_ALIGNED_SIZE - HEADER_ARRAY_SIZE - METADATA_SIZE)
#define USING_XCODEC_CACHE_RECENT_WINDOW
struct COSSIndexEntry struct COSSIndexEntry
{ {
uint64_t stripe_range : 48; 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 #define XCODEC_WINDOW_COUNT 64 // must be binary
/* /*
@ -89,17 +91,21 @@ class XCodecCache
private: private:
UUID uuid_; UUID uuid_;
size_t size_; size_t size_;
#ifdef USING_XCODEC_CACHE_RECENT_WINDOW
struct WindowItem {uint64_t hash; const uint8_t* data;}; struct WindowItem {uint64_t hash; const uint8_t* data;};
WindowItem window_[XCODEC_WINDOW_COUNT]; WindowItem window_[XCODEC_WINDOW_COUNT];
unsigned cursor_; unsigned cursor_;
#endif
protected: protected:
XCodecCache (const UUID& uuid, size_t size) XCodecCache (const UUID& uuid, size_t size)
: uuid_(uuid), : uuid_(uuid),
size_(size) size_(size)
{ {
#ifdef USING_XCODEC_CACHE_RECENT_WINDOW
memset (window_, 0, sizeof window_); memset (window_, 0, sizeof window_);
cursor_ = 0; cursor_ = 0;
#endif
} }
public: public:
@ -119,6 +125,7 @@ public:
virtual void enter (const uint64_t& hash, const Buffer& buf, unsigned off) = 0; virtual void enter (const uint64_t& hash, const Buffer& buf, unsigned off) = 0;
virtual bool lookup (const uint64_t& hash, Buffer& buf) = 0; virtual bool lookup (const uint64_t& hash, Buffer& buf) = 0;
#ifdef USING_XCODEC_CACHE_RECENT_WINDOW
protected: protected:
void remember (const uint64_t& hash, const uint8_t* data) void remember (const uint64_t& hash, const uint8_t* data)
{ {
@ -148,6 +155,7 @@ protected:
if (w->hash == hash) if (w->hash == hash)
w->hash = 0; w->hash = 0;
} }
#endif
}; };
@ -181,17 +189,21 @@ public:
bool lookup (const uint64_t& hash, Buffer& buf) bool lookup (const uint64_t& hash, Buffer& buf)
{ {
#ifdef USING_XCODEC_CACHE_RECENT_WINDOW
const uint8_t* data; const uint8_t* data;
if ((data = find_recent (hash))) if ((data = find_recent (hash)))
{ {
buf.append (data, XCODEC_SEGMENT_LENGTH); buf.append (data, XCODEC_SEGMENT_LENGTH);
return true; return true;
} }
#endif
segment_hash_map_t::const_iterator it = segment_hash_map_.find (hash); segment_hash_map_t::const_iterator it = segment_hash_map_.find (hash);
if (it != segment_hash_map_.end ()) if (it != segment_hash_map_.end ())
{ {
buf.append (it->second, XCODEC_SEGMENT_LENGTH); buf.append (it->second, XCODEC_SEGMENT_LENGTH);
#ifdef USING_XCODEC_CACHE_RECENT_WINDOW
remember (hash, it->second); remember (hash, it->second);
#endif
return true; return true;
} }
return false; return false;