> -----Original Message-----
> From: Muli Ben-Yehuda [mailto:[EMAIL PROTECTED] 
> Sent: Saturday, April 30, 2005 11:41 PM
> To: Tzahi Fadida
> Cc: [email protected]
> Subject: Re: cleaning memory.
> 
> 
> On Sat, Apr 30, 2005 at 11:57:45PM +0200, Tzahi Fadida wrote:
> 
> > Of course, it's a directory with regular files but how can 
> it help, it 
> > would get cached because they are regular files no matter 
> what device 
> > I use.
> 
> So unmount and mount every time you want to clear the cache. 
> Or use any of the other suggestions people already posted.

I can't believe its as simple as unmounting and remounting, won't
all the openfiles will need to be closed properly and reopened
and lseeked, etc...?
Remember, I have no control over this unless I change the code
of the database which could take a long long time.
I tried simply O_DIRECT (plus 512 alignments) but its not so simple, 
many bugs from all over surfaced in the database.
Another solution that was suggested was to change the kernel code
to invalidate cache pages of some particular vfs like ext2 or xfs,
etc...
again, could take a long long time and don't know where to begin.
I suggested somehow finding the code where there are cache hits 
and hack it to think it's a miss but don't know where to begin looking.
My only working solution is to lock as much memory as possible down
to render the cache useless. It's a partial success from some
experiments,
but maybe I can live with it.

Well, there is a last resort I just now got to know. I've been into the
postgresql
backend code all week and I think I may have found a way to virtually
count
the blocks read. However, its not good since its not realistic and does
not
count a real i/o. only the kernel knows when a block read is in progress
instead of a cache hit. If I knew there was a cache hit I could simulate
a block read by reading a block from some big garbage file, 1 block
each time and thus cause an i/o to be performed in spite.
Is there a way to know the time it took to perform a read and thus to
know
it was not an i/o? i.e. if its under a 1ms its definetly did not come
from
the harddisk.

> 
> > If I was able to write to device without system visible files and 
> > directories, only then it won't get cached no?
> 
> Are you sure pgsql can't use the block device for its backing store?

Yes, its strength is its balance between the os cache and its own cache.
its designed that way. They are not planning on native partitions, i.e.
block devices.

> 
> Cheers,
> Muli
> -- 
> Muli Ben-Yehuda
> http://www.mulix.org | http://mulix.livejournal.com/
> 
> 
> 



=================================================================
To unsubscribe, send mail to [EMAIL PROTECTED] with
the word "unsubscribe" in the message body, e.g., run the command
echo unsubscribe | mail [EMAIL PROTECTED]

Reply via email to