Skip to content

Commit

Permalink
Set max RAM usage in absolute units.
Browse files Browse the repository at this point in the history
  • Loading branch information
alja authored and abh3 committed Jun 30, 2016
1 parent 64ad760 commit 13dc7f4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/XrdFileCache/XrdFileCache.hh
Expand Up @@ -52,7 +52,8 @@ namespace XrdFileCache
m_diskUsageLWM(-1),
m_diskUsageHWM(-1),
m_bufferSize(1024*1024),
m_NRamBuffers(8000),
m_RamAbsAvailable(8*1024*1024),
m_NRamBuffers(-1),
m_prefetch_max_blocks(10),
m_hdfsbsize(128*1024*1024) {}

Expand All @@ -64,7 +65,8 @@ namespace XrdFileCache
long long m_diskUsageHWM; //!< cache purge high water mark

long long m_bufferSize; //!< prefetch buffer size, default 1MB
int m_NRamBuffers; //!< number of total in-memory cache blocks
int m_RamAbsAvailable; //!< available from configuration
int m_NRamBuffers; //!< number of total in-memory cache blocks, cached
bool m_prefetch; //!< prefetch enable state
size_t m_prefetch_max_blocks;//!< maximum number of blocks to prefetch per file

Expand Down
11 changes: 9 additions & 2 deletions src/XrdFileCache/XrdFileCacheConfiguration.cc
Expand Up @@ -151,14 +151,16 @@ bool Cache::Config(XrdSysLogger *logger, const char *config_filename, const char
}
}

// get number of available RAM blocks after process configuration
m_configuration.m_NRamBuffers = static_cast<int>(m_configuration.m_RamAbsAvailable/ m_configuration.m_bufferSize);
if (retval)
{
int loff = 0;
char buff[2048];
loff = snprintf(buff, sizeof(buff), "result\n"
"\tpfc.blocksize %lld\n"
"\tpfc.prefetch %d\n"
"\tpfc.nram %d\n\n",
"\tpfc.nramblocks %d\n\n",
m_configuration.m_bufferSize,
m_configuration.m_prefetch, // AMT not sure what parsing should be
m_configuration.m_NRamBuffers );
Expand Down Expand Up @@ -269,7 +271,12 @@ bool Cache::ConfigParameters(std::string part, XrdOucStream& config )
}
else if (part == "nram" )
{
m_configuration.m_NRamBuffers = ::atoi(config.GetWord());
long long minRAM = 1024* 1024 * 1024;;
long long maxRAM = 100 * minRAM;
if ( XrdOuca2x::a2sz(m_log, "get RAM available", config.GetWord(), &m_RamAbsAvailable, minRAM, maxRAM))
{
return false;
}
}
else if ( part == "hdfsmode" )
{
Expand Down

0 comments on commit 13dc7f4

Please sign in to comment.