On Wed, Feb 03, 2010 at 10:21:19AM +0000, Robert Osfield wrote:
> Hi David,
> 
> On Wed, Feb 3, 2010 at 9:46 AM, Robert Osfield <[email protected]> 
> wrote:
> > Aside from the extra efficiency of multset implementation, there is
> > still the far more serious of the shear numbers of DatabaseRequests
> > that you can get into queues, it looks to me like many are being
> > orphaned and not pruned from the queues when they go out of date
> > promptly enough. ?In theory the DatabaseRequests that haven't been
> > refreshed since the previous frame should be discarded from all the
> > queues. ?There is a mechanism in place for this, but it clearly isn't
> > working fully. ?It's this area that I'll be looking at this morning.
> 
> Bingo, the big problem with the accumulating request was the lack of
> pruning of expired DatabaseRequests from the read queues.  I've added
> a block of code into the read thread and suddenly the number of
> requests never goes much above 100, even with vysnc off and using you
> nice settings.  Comment this block out and the number of requests
> start accumulating once more.
> 
> Could you try out the attached DatabasePager header and .cpp on your
> models and see if you get get it to start producing overly high
> numbers of requests?
> 
> This temporary hack that I've just made is something I need to clean
> up, and is rather orthogonal to the rest of changes to locking that
> will still need to be done.  I'll wait for feedback from yourself
> before I go much further as I want to make sure that I'm on the right
> track.

With this change I never see the request queue go very high, as in
less than a hundred.  Here's a minor change, only run the prune once
per frame.  Presumibly once last frame's requests have been cleared
out, no more requests will be added with that frame number.  This
would be applicable to the cull thread as well.

-- 
David Fries <[email protected]>
http://fries.net/~david/ (PGP encryption key available)


    Only run request queue prune once a frame.

diff --git a/src/osgDB/DatabasePager.cpp b/src/osgDB/DatabasePager.cpp
index 0b2e70f..2d52444 100644
--- a/src/osgDB/DatabasePager.cpp
+++ b/src/osgDB/DatabasePager.cpp
@@ -498,6 +498,7 @@ void DatabasePager::DatabaseThread::run()
     }
 
 
+    int lastPruneFrame = 0;
     do
     {
         _active = false;
@@ -524,7 +525,9 @@ void DatabasePager::DatabaseThread::run()
         }
 
 #if 1
+        if (lastPruneFrame != _pager->_frameNumber)
         {
+            lastPruneFrame = _pager->_frameNumber;
             OpenThreads::ScopedLock<OpenThreads::Mutex> 
lock(read_queue->_requestMutex);
 
             // Prune all the old entries.
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to