Thanks for all of your suggestions and pointers.
In the interest of wrapping things up, and sharing what I learned in the process, here's what I did:
- 1. Read up on GTop.
- The README on CPAN says,
this package is a Perl interface to libgtop:
http://home-of-linux.org/gnome/libgtop/
(The link doesn't point anywhere, BTW). But my platform
choices are Windows 2000 or Mac OS X - neither of which has gtop or libgtop on it.
So, to use this module, I'd have to find a gtop port, or find a Linux box. Either
of those are certainly possible, but far more effort than I'd hoped to expend. The
link
joealba provided has great usage samples for GTop for anyone interested. I was all
ready to install it! :-(
Next option...
- 2. PERL_DEBUG_MSTATS
- My Perl was not compiled with support for this.
Next option...
- 3. Store the hash in a file
- This would also require re-designing the script. Until I have some
idea that the limitations of doing it all in RAM are too restrictive,
I'd rather not go through that work. Definitely my next choice if this
doesn't scale well.
Next option...
- 4. If I can't use GTop, what could I use instead...
- Add sleep 10; at the beginning of the script, and again at the end.
This gives me time to look at the memory used by perl.exe in the Win 2000
task list to see how much space the program takes before it builds any data
structures at the beginning, and after it's built them all - and while they're still in scope - at the end. Then, I
can take Fletch's advice and 'subtract.'
This did the trick.
The difference in memory taken up
by perl.exe at the beginning of the script and after building the hash based
on 160 users and 1600 books is 228K. Seems pretty teeny. At the moment, I have
61Meg free physical RAM. If this scales linearly (and I believe it does) that
allows me to do about 42,500 users before even going to swap (theoretically).
So this will scale just fine for the volumes I'm likely to encounter.
So, I ended up going with a combination of Fletch and joealba's
look at how much memory you're already using and do the
arithmetic approach and perrin's Don't worry about precision, just
play with it and be happy with a rough idea approach.
Many thanks for all of your suggestions. This was very helpful.
-- mrbbking
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
|
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.