|
I have written a cache service that periodically flushes collected
stats to their respective files. I have an RPC thread that receives
stats from other services. This thread maps the stats (and template)
to the respective RRD file. Periodically, 6 worker threads are
launched to flush the mapped stats to their RRD files. Simple
enough. I am using rrdlib version 1.4.8 and below is how I am calling rrd_update_r() struct RRDCache
{
std::string tmplt_;
std::list<std::string> values_;
};bool vRRDSrv::_Flush(const std::string& path, RRDCache& cache) { if(cache.values_.empty()) return true; unsigned long start = vTime::UTCTime(); pGDbgLog(LogExInf,"WRITING %u POINTS TO %s",cache.values_.size(),path.c_str()); int err, argc = 0; const char** argv = (const char**)_alloca(cache.values_.size() * sizeof(const char*)); std::list<std::string>::const_iterator dv_i; for(dv_i=cache.values_.begin();dv_i!=cache.values_.end();dv_i++) argv[argc++] = (*dv_i).c_str(); if((err=rrd_update_r(path.c_str(),cache.tmplt_.c_str(),argc,argv)) != 0) pGDbgLog(LogExWarn,"RRD UPDATE ERROR (%d:%s) ON %s",err,rrd_get_error(),path.c_str()); unsigned long stop = vTime::UTCTime() - start; pGDbgLog(LogExInf,"TOOK %u SECONDS TO WRITE %u POINTS TO %s ",stop,cache.values_.size(),path.c_str()); return err == 0; } These are the values used to create the RRD. step: 300 Its taking anywhere from 210 to 320 seconds to write a single point to the RRD. This cannot be right, but I am at a loss on why. I also tried smaller RRAs. DS:dups:GAUGE:600:0:4294967295 This made very little difference. The timing was basically the same. Other things I have tried are copying the RRD to ramdirve, doing the update on the copy, and then moving the modified file back in place. This was only marginally better. I am not sure what else to do other tinkering with the rrdlib source code itself. I am tempted to modify the rrdlib to load the file in memory, modify it, then write it back - just to see the timing on that. Any thoughts, suggestions would be greatly appreciated. Kevin |
_______________________________________________ rrd-users mailing list [email protected] https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users
