Ah... I just posted a node about Perl releasing memory back to the system when using threads... see OS memory reclamation with threads on linux From my previous experimentation, it was almost certain that Perl would hold onto the memory, but that may have been because I was testing at a "sweet spot" where Perl's calculations of free memory-vs-it's use allowed it to retain the memory. But when it is very high mem usage, Perl will release it.
It's a crap shoot, and may depend on Perl versions, thread versions, and even the kernel.But the gist is, Perl will release large memory chunks if it's in a thread. And the c guru said that top and ps cannot always be trusted as an accurate measure of mem use. So I would ask, as your memory climbed, did the system slowdown, or did things keep running normally.
| [reply] |
So I would ask, as your memory climbed, did the system slowdown, or did things keep running normally.
I watched the RES column from ps's output, first via top, then also using a code snippet taken out from Process::MaxSize like
[...]
my $size;
open PIPE, "/bin/ps wwaxo 'pid,rss' |";
while(<PIPE>) {
next unless /^\s*$$\s/;
s/^\s+//g;
chomp;
$size = (split(' ', $_))[1];
}
close PIPE;
return $size;
}
I didn't wait to let the system really slowdown, but stopped when it became obvious that swapping would have to start.
| [reply] [d/l] |
Care to expand on that ?
Well, I'm not sure how to do that efficiently, it's a rather convoluted story - my baseline so far is that I will avoid for now and the near future to try using threads for parallelizing conditional-insert-or-updates into Oracle.
The base problem is something like 'given a (rather big) amount of new data, add it to the existent tables that are holding it, inserting or updating if similar records are already there. Speed up the process so that it gets done as fast as possible.'
What I seem to have so far is that Oracle's libclntsh.so in conjunction with Perl threads will loose 4 or 8 bytes on every thread-switch. Which thread to use depends on the input record.
| [reply] |
| [reply] |