Skip to content

Commit

Permalink
Alter ram limits and blocks size parameter if caching is on the clien…
Browse files Browse the repository at this point in the history
…t side.
  • Loading branch information
alja committed Jun 7, 2017
1 parent ae2599c commit 005f76a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
5 changes: 3 additions & 2 deletions src/XrdFileCache/XrdFileCache.cc
Expand Up @@ -147,7 +147,8 @@ Cache::Cache() : XrdOucCache(),
m_trace(0),
m_traceID("Manager"),
m_prefetch_condVar(0),
m_RAMblocks_used(0)
m_RAMblocks_used(0),
m_isClient(false)
{
m_trace = new XrdOucTrace(&m_log);
// default log level is Warning
Expand Down Expand Up @@ -340,7 +341,7 @@ void Cache::schedule_file_sync(File* f, bool ref_cnt_already_set)
{
DiskSyncer* ds = new DiskSyncer(f);
if ( ! ref_cnt_already_set) inc_ref_cnt(f, true);
if (isClient) ds->DoIt();
if (m_isClient) ds->DoIt();
else if (schedP) schedP->Schedule(ds);
else {pthread_t tid;
XrdSysThread::Run(&tid, callDoIt, ds, 0, "DiskSyncer");
Expand Down
2 changes: 1 addition & 1 deletion src/XrdFileCache/XrdFileCache.hh
Expand Up @@ -241,7 +241,7 @@ private:

XrdSysMutex m_RAMblock_mutex; //!< central lock for this class
int m_RAMblocks_used;
bool isClient; //!< True if running as client
bool m_isClient; //!< True if running as client

struct WriteQ
{
Expand Down
20 changes: 13 additions & 7 deletions src/XrdFileCache/XrdFileCacheConfiguration.cc
Expand Up @@ -110,7 +110,7 @@ bool Cache::Config(XrdSysLogger *logger, const char *config_filename, const char

// Indicate whether or not we are a client instance
//
isClient = (strncmp("*client ", theINS, 8) != 0);
m_isClient = (strncmp("*client ", theINS, 8) != 0);

XrdOucEnv myEnv;
XrdOucStream Config(&m_log, theINS, &myEnv, "=====> ");
Expand Down Expand Up @@ -148,6 +148,11 @@ bool Cache::Config(XrdSysLogger *logger, const char *config_filename, const char
return false;
}

// minimize buffersize in case of client caching
if ( m_isClient) {
m_configuration.m_bufferSize = 256 * 1024 * 124;
}


// Actual parsing of the config file.
bool retval = true;
Expand Down Expand Up @@ -241,12 +246,13 @@ bool Cache::Config(XrdSysLogger *logger, const char *config_filename, const char
// get number of available RAM blocks after process configuration
if (m_configuration.m_RamAbsAvailable == 0)
{
TRACE(Error, "RAM usage not specified. pfc.ram is a required configuration directive since release 4.6.\n"
" As a temporary measure default of 8 GB is being used. This will be discontinued in release 5.");
m_configuration.m_RamAbsAvailable = 8ll * 1024 * 1024 * 1024;
// return false;
m_configuration.m_RamAbsAvailable = m_isClient ? 256ll * 1024 * 1024 : 1024 * 1024 * 1024;
char buff2[1024];
snprintf(buff2, sizeof(buff2), "RAM usage is not specified. Default value %s is used.", m_isClient ? "256m" : "8g");
TRACE(Warning, buff2);
}
m_configuration.m_NRamBuffers = static_cast<int>(m_configuration.m_RamAbsAvailable/ m_configuration.m_bufferSize);


// Set tracing to debug if this is set in environment
char* cenv = getenv("XRDDEBUG");
Expand All @@ -263,7 +269,7 @@ bool Cache::Config(XrdSysLogger *logger, const char *config_filename, const char
" pfc.ram %.fg\n"
" pfc.diskusage %lld %lld sleep %d\n"
" pfc.spaces %s %s\n"
" pfc.trace %d\n"
" pfc.trace ooo %d\n"
" pfc.flush %lld",
config_filename,
m_configuration.m_bufferSize,
Expand Down Expand Up @@ -382,7 +388,7 @@ bool Cache::ConfigParameters(std::string part, XrdOucStream& config, TmpConfigur
}
else if ( part == "ram" )
{
long long minRAM = 1024 * 1024 * 1024;
long long minRAM = m_isClient ? 256 * 1024 * 1024 : 1024 * 1024 * 1024;
long long maxRAM = 256 * minRAM;
if ( XrdOuca2x::a2sz(m_log, "get RAM available", config.GetWord(), &m_configuration.m_RamAbsAvailable, minRAM, maxRAM))
{
Expand Down

0 comments on commit 005f76a

Please sign in to comment.