Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

What's happening to you is a phenomenon known as thrashing. Virtual memory page faults and the corresponding page-I/O is eating you alive. This always happens abruptly: "hitting the wall." Performance goes straight from a linear slow-down to an exponential one. And the only thing that you can do about it is either to buy more RAM or to redesign your algorithm.

Hash tables are purposely designed to widely-distribute their memory addresses and this works just fine as long as "memory is free." But when thrashing begins to occur it makes it worse: almost every single hash "hit" might cause a page fault.

One good alternative strategy would be to select the URLs out of the file and write them to an external file, which you then sort using an on-disk sorting command. Then, read the sorted file: each occurrence of the same name will now be consecutive – simply note when the value changes. This strategy places an explicit disk-file in place of the virtual-memory disk backing-store, and it will produce predictable performance regardless of data volume. It's a strategy that's as old as punched cards, and it still works.


In reply to Re: Hash Search is VERY slow by Anonymous Monk
in thread Hash Search is VERY slow by rtjensen

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2024-04-25 23:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found