Log of /trunk/io/io/src/TFileCacheRead.cxx
Parent Directory
Revision
48306 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Wed Jan 16 16:01:47 2013 UTC (2 years ago) by
pcanal
File length: 25795 byte(s)
Diff to
previous 45494
From Elvin:
There was a race condition between the destructor of the TTree object and the functionality to kill the asynchronous thread doing the prefetching.
In more detail: In the the TTree::~TTree line 789 the TFileCacheRead object of the current file is set to 0. All the logic to kill the async thread is done in the destructor of TFilePrefetch which in turn is called from the destructor of TFileCacheRead. In the same file two lines below the destructor of TFileCacheRead is called. And initially TFilePrefetch held a pointer to the file object in TFileCacheRead which now is 0. Therefore, during the destruction of the TFilePrefetch object we don't have any longer a valid TFile pointer. So, we can not wait for the ongoing requests to be satisfied. This was the reason of the crash. To fix this, I removed the killing of the async thread form the destructor of the TFilePrefetch method and I've put it in a separate method called WaitFinishPrefetch. In this way, we avoid the potential scenario of trying to wait for some request for a file while not having a valid pointer to that file.
Revision
45494 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Wed Aug 8 19:03:13 2012 UTC (2 years, 5 months ago) by
pcanal
File length: 25562 byte(s)
Diff to
previous 45487
From Elvin:
I received a test program from an user in which the async prefetching was blocking. After doing some debugging I managed to fix the problem. The issue was that when prefetching and reaching the end of the entries, the program should stop trying to prefetch further if the current entry is equal to fEntryMax.
This was not happening in the test program because there I am reading only some entries stopping well before the end of the total number of entries. The fix for this was the addition of a condition to FillBuffer around line 640.
Revision
44841 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Tue Jul 3 10:29:51 2012 UTC (2 years, 6 months ago) by
pcanal
File length: 25735 byte(s)
Diff to
previous 44785
Add an explicit 'Close' for the read cache so that we can insure that all the (concurrent) outstanding connection/use of the TFile are closed before closing the file
Revision
44785 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Wed Jun 27 20:38:24 2012 UTC (2 years, 6 months ago) by
pcanal
File length: 25312 byte(s)
Diff to
previous 44756
Add a non virtual SetEnablePrefetchingImpl to be called form the constructor and from the
virtual SetEnablePrefetching.
Make sure that even in the usual case (fEnablePrefetching == false), fAsyncReading is set.
Add documentation in the new functions.
Revision
44756 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Tue Jun 26 21:14:16 2012 UTC (2 years, 6 months ago) by
pcanal
File length: 24554 byte(s)
Diff to
previous 43149
From Brian:
When hooking prefetching up into the CMSSW configuration system, I found the attached patch necessary.
Without it, if you change the prefetch settings after the cache is created, I/O operations cause a segfault.
Revision
43149 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Mon Feb 27 21:09:07 2012 UTC (2 years, 10 months ago) by
pcanal
File length: 24125 byte(s)
Diff to
previous 42754
From Peter:
Index: io/io/inc/TFileCacheRead.h
Index: io/io/src/TFileCacheRead.cxx
* Enhance Print() function to report number of bytes read and read calls for current cache rather than totals on associated file.
* Distingurish counter for bytes read and read calls for learning phase.
Index: tree/tree/src/TBasket.cxx
* When calling cache ReadBuffer(), update number of read calls and bytes read.
Revision
42754 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Fri Jan 20 20:13:07 2012 UTC (3 years ago) by
pcanal
File length: 23376 byte(s)
Diff to
previous 41698
From Peter van Gemmeren:
Allow multiple read caches per file by adding a fCacheReadMap member and owner arguments to GetCacheRead() and SetCacheRead()
to TFile.
Index: io/io/inc/TFileCacheRead.h
Index: io/io/src/TFileCacheRead.cxx
* Adding new argument for constructor to specify TTree owner
* whitespace indents
Index: tree/tree/inc/TBasket.h
Index: tree/tree/src/TBasket.cxx
* Add optional tree owner argument to LoadBasketBuffers() to retrieve cache.
* In LoadBasketBuffers() and ReadBuffers() check the cache first than call TFile::ReadBuffer only if needed.
Index: tree/tree/inc/TChain.h
Index: tree/tree/src/TChain.cxx
* Override SetCacheSize() function to update TTree owner on the current cache.
* whitespace indents
Index: tree/tree/src/TTree.cxx
* Get TTreeCache for current TTree, by specifying owner in GetCacheRead() calls
* Always delete owned cache
Index: tree/tree/src/TTreeCache.cxx
* Adding new argument for constructor for TFileCacheRead to specify TTree owner
Index: tree/treeplayer/src/TTreePlayer.cxx
* Get TTreeCache for current TTree, by specifying owner in GetCacheRead() calls
Index: tree/tree/src/TTreeCloner.cxx
* Call TBasket::LoadBasketBuffers() with current TTree as owner of cache
Index: proof/proofplayer/src/TEventIter.cxx
* Get TTreeCache for current TTree, by specifying owner in GetCacheRead() and SetCacheRead() calls
Revision
41698 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Tue Nov 1 21:22:54 2011 UTC (3 years, 2 months ago) by
pcanal
File length: 23400 byte(s)
Diff to
previous 40408
From Elvin:
Last week Martin Vala from ALICE came to me with a problem that he had
while using the asynchronous prefetching. There were basically two
main problems:
1. Trying to read a root file from an archive. Here the problem was
that when reading from an archive there is an offset of the file which
was not taken into consideration when the file was saved in the cache.
And this lead to a miss when reading the file from cache. I fixed it,
but I had to expose the value of fArchiveOffset from TFile.
2. The second problem was when reading using a TChain. There were some
synchronization issues concerned to the asynchronous thread that
actually does the reading. All this was happening because in the case
of TChain there is only one file cache which is re-utilized as we move
from one file to another. This was a pretty tricky issue.
I attached a patch made against the current trunk which fixes both
this problems. I gave the patch first to Martin to test it, and he was
satisfied with it. There is a small delay when the TChain moves from
one file to another because I have to wait for the async thread to
finish it's worked but over all Martin said that the performance is
way better than before. When I initially did the asyn pre-fetching I
had no idea about these two use cases, so that's why they popped up
now.
Revision
40408 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Mon Aug 1 20:07:54 2011 UTC (3 years, 5 months ago) by
pcanal
File length: 23311 byte(s)
Diff to
previous 39724
Upgrade the sorting algorithm to be able to handle the case where the same file block is requested multiple time (can happen in case of older unclustered files on which the TTreeCache is used
Revision
39724 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Tue Jun 14 19:12:39 2011 UTC (3 years, 7 months ago) by
pcanal
File length: 22556 byte(s)
Diff to
previous 39466
From Elvin:
additional checks before starting the prefetching thread and also I modify the way memory is deallocated when the destructor of the TFilePrefetch class is called. According to the documentation of TThread::Delete, when the object is allocated on the heap one should call directly delete which is what I added in the new patch.
Revision
39275 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Thu May 19 18:17:37 2011 UTC (3 years, 8 months ago) by
pcanal
File length: 22275 byte(s)
Diff to
previous 34934
From Elvin Alin Sindrilaru:
The prefetching mechanism uses two new classes (TFilePrefetch.h and
TFPBlock.h) to prefetch in advance a block of entries. There is a second
thread which takes care of actually transferring the blocks and making
them available to the main requesting thread. Therefore, the time spent
by the main thread waiting for the data before processing considerably
decreases. Besides the prefetching mechanisms there is also a local
caching option which can be enabled by the user. Both capabilities are
disabled by default and must be explicitly enabled by the user.
In order to enable the prefetching the user must define the environment
variable "TFile.AsyncPrefetching" as follows:
gEnv->SetValue("TFile.AsyncPrefetching", 1).
Only when the prefetching is enabled can the user set the local cache
directory in which the file transferred can be saved. For subsequent
reads of the same file the system will use the local copy of the file
from cache. To set up a local cache directory, a client can use the
following commands:
TString cachedir="file:/tmp/xcache/";
// or using xrootd on port 2000
// TString cachedir="root://localhost:2000//tmp/xrdcache1/";
gEnv->SetValue("Cache.Directory", cachedir.Data());
The "TFilePrefetch" class is responsible with actually reading and storing
the requests received from the main thread. It also creates the working
thread which will transfer all the information. Apart from managing the
block requests, it also deals with caching the blocks on the local machine
and retrieving them when necessary.
The "TFPBlock" class represents the encapsulation of a block request. It
contains the chunks to be prefetched and also serves as a container for
the information read.
In order to accommodate the new prefetching mechanism the following files
have suffered considerable modifications: TFileCacheRead.cxx/.h,
TTreeCache.cxx/.h and to a less extent: TXNetFile.cxx, TFile.h.
Basically in TFileCacheRead we've added the logic for dealing with the
second buffer that is prefetched. In TTreeCache during prefeching the
method FillBuffer is called after each read so that once the main thread
starts reading from the last available buffer, the second thread starts
prefetching the next block.
Revision
34444 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Fri Jul 16 02:17:39 2010 UTC (4 years, 6 months ago) by
pcanal
File length: 13010 byte(s)
Diff to
previous 34374
Avoid doing seeks on the physical file reprensation when it is not absolutely necessary
(i.e. it is not need if we are going to pick the data from our cache).
Introduce a SetOffset to change fOffset (i.e. the logical position in the file) without doing a lseek.
Introduce ReadBuffer(char * buf, Long64_t pos, Int_t len) to avoid the lseek when the data is in the cache.
See <http://savannah.cern.ch/bugs/?69845>
Revision
32546 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Thu Mar 11 10:45:26 2010 UTC (4 years, 10 months ago) by
brun
File length: 13018 byte(s)
Diff to
previous 32211
In TFileCacheRead::Sort, increase the maximum read from 2 to 16 MBytes.
I have added the following comment:
//in the test below 16 MBytes is pure empirirical and may depend on the file system.
//increasing this number must be done with care, as it may increase
//the job real time (mismatch with OS buffers)
Revision
32211 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Thu Feb 4 15:29:04 2010 UTC (4 years, 11 months ago) by
rdm
File length: 12799 byte(s)
Diff to
previous 31457
From Tigran Mkrtchyan:
implement TFile::ReadBufferAsync() using posix_fadvise() which tells the
kernel which blocks we are going to read, so it can start loading these
blocks in the buffer cache. Works only on Linux for the time being.
Minimum speedup about 15%-20%.
Revision
31457 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Mon Nov 30 13:36:37 2009 UTC (5 years, 1 month ago) by
brun
File length: 12716 byte(s)
Diff to
previous 30909
From Fabrizio:
In TFileCacheRead add a new virtual function GetUnzipBuffer in order
to avoid InheritsFrom in TBasket::ReadBasketBuffers.
In TTreeCacheUnzip optimizations related to CPU cycles and memory.
Related fixes to TFileCacheRead. Also comment "if gDebug" statements.
In TXNetFile fixes related to the reporting of TTreePerfStats.
Revision
30909 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Thu Oct 29 07:23:02 2009 UTC (5 years, 2 months ago) by
brun
File length: 12479 byte(s)
Diff to
previous 30226
Implement an API to control the readahead cache size.
A new static member is added in TFile:
static Int_t fgReadaheadSize; //Readahead buffer size
and the following corresponding getter and setter:
static Int_t GetReadaheadSize();
static void SetReadaheadSize(Int_t bufsize = 256000);
Following IO tests with Alice, Atlas and CMS files, the readahead size has been
set by default to 256 Kbytes.
Because the readahead algorithm reads more data than it is required when
reading the Tree, a new TFile data member has been added with the corresponding
getter:
Long64_t fBytesReadExtra; //Number of extra bytes (overhead) read by the readahead buffer
Long64_t GetBytesReadExtra() const { return fBytesReadExtra; }
When calling TTree::PrintCacheStats, in turn calling TFileCacheRead::Print
information about the readahead cache is printed as well as the corresponding
read overhead.
Revision
26028 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Thu Oct 30 20:09:44 2008 UTC (6 years, 2 months ago) by
brun
File length: 11978 byte(s)
Diff to
previous 23685
From Lorenzo:
this patch fixes some not-consistent usage of TMath::Sort. If it is not
applied, the compilation will fail when I will change
Tmath::Sort<Element,Index> (Long64 n, Element x, Index w)
in
Tmath::Sort<Element,Index> (Index n, Element x, Index w)
to avoid some possible conversion errors from Long64 to Index
Revision
23685 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Wed May 7 15:18:39 2008 UTC (6 years, 8 months ago) by
brun
File length: 11987 byte(s)
Diff to
previous 23122
Introducing a parallel unzipping algorithm for pre-fetched buffers. Since we already know what buffers are going to be read, we can decompress a few of them in advance in an additional thread and give the impression that the data decompression comes for free (we gain up to 30% in reading intensive jobs).
The size of this unzipping cache is 20% the size of the TTreeCache and can be modified with TTreeCache::SetUnzipBufferSize(Long64_t bufferSize). Theoretically, we only need one buffer in advance but in practice we might fall short if the unzipping cache is too small (synchronization costs).
This experimental feature is disabled by default, to activate it use the static function TTreeCache::SetParallelUnzip(TTreeCacheUnzip::EParUnzipMode option = TTreeCacheUnzip::kEnable). The possible values to pass are: TTreeCacheUnzip::kEnable to enable it,TTreeCacheUnzip::kDisable to disable it and TTreeCacheUnzip::kForce to force it. Since it will only work if you have more than one core, the TTreeCacheUnzip::kForce option is useful to run it even if you have only one cpu (to measure the overhead, for example).
Revision
20488 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Thu Oct 25 13:22:56 2007 UTC (7 years, 3 months ago) by
brun
Original Path:
trunk/io/src/TFileCacheRead.cxx
File length: 11782 byte(s)
Diff to
previous 20273
From Fabrizio & Gerri:
Patch enabling asynchronous reading via XROOTD; a new method TFile::ReadBufferAsync
is introduced which gets appropriately overritten in TXNetFile .
The new feature can be enabled / disabled via the env 'TFile.AsyncReading' in .rootrc,
the default being ON.
The patch also cleans up the netx section in the system.rootrc, by removing
very old unused variables and commenting and setting appropriate default
values for the others (no additions, except for the comments).
Revision
17306 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Fri Jan 12 16:03:17 2007 UTC (8 years ago) by
brun
Original Path:
trunk/io/src/TFileCacheRead.cxx
File length: 8841 byte(s)
Diff to
previous 16620
TMath::Abs, TMath::Min, TMath::Max, TMath::Sign, TMath::Range
These functions are unfortunately not defined in a standard way in std::
This include is referenced by a new version of TMath.h.
As a result, TMath.h is back compatible with the previous version.
TMathBase.h is used in place of TMath.h in all the classes
that will go into the future miniCore library.
TMath.h and the TMath implementation will go into a new math sub-directory.
TString.h uses TMathBase.h instead of TMath.h.
As a result, it was necessary to include "TMath.h" in some classes
assuming that TMath was included via TString and using other functions
than the ones defined in TMathBase.h
----------------------------------------------------------------------
Revision
15626 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Modified
Thu Jun 29 22:15:37 2006 UTC (8 years, 6 months ago) by
rdm
Original Path:
trunk/io/src/TFileCacheRead.cxx
File length: 9147 byte(s)
Diff to
previous 15572
Several fixes in the new cache handling:
- TFile
- GetBytesWritten() includes also the number of bytes still in the
write cache
- New method FlushWriteCache()
- Call FlushWriteCache() also when closing files in raw mode
- Call FlushWriteCache() also in Flush()
- TFileCacheWrite:
- new method GetBytesInCache() returning bytes still in cache
used by TFile::GetBytesWritten()
- WriteBuffer() returns int iso bool, -1 write failure, 0 in case
recusively called and 1 in case copied in cache
- TFileCacheRead:
- ReadBuffer() returns int iso bool, -1 read failure, 0 in case not
in cache and 1 in case read from cache.
- TTreeCache:
- use int return type for ReadBuffer()
- TNetFile and TXNetFile:
- call FlushWriteCache() in their Flush().
Revision
15572 -
(
view)
(
download)
(
as text)
(
annotate)
-
[select for diffs]
Added
Tue Jun 27 14:36:28 2006 UTC (8 years, 6 months ago) by
brun
Original Path:
trunk/io/src/TFileCacheRead.cxx
File length: 9045 byte(s)
-Rename class TFilePrefetch -> TFileCacheRead
-Rename class TTreeFilePrefetch -> TTreeCache
-Add new class TFileCacheWrite that implements automatic caching
when writing network files. This class replaces the previous class TCache.
-old TCache class deleted.
-TFileCacheRead can read buffers from the wite cache in TFileCacheWrite.
-As a result TFile::UseCache is obsolete. The function is kept for
backward compatibility.
-Remove references to TCache from TXMLFile, TSQLFile, TwebFile, TNetFile
-remove pointer TFile::fCache
-Add pointers TFile::fCacheRead and TFile::fCacheWrite
-Remove members fMaxCacheSize and fPageSize from TChain
NOTE that it is recommended to
rm -f base/src/*.d base/src/*.o
rm -f net/src/*.d net/src/*.o
rm -f tree/src/*.d tree/src/*.o
This form allows you to request diffs between any two revisions of this file.
For each of the two "sides" of the diff,
enter a numeric revision.