So based on that (typical?) line of log data, let's say it's 90 bytes/line, so a 5 MB file will be close to 56,000 lines of text.

Now, what does the person looking at the browser intend to do with this display? Is the user looking for something in particular? Maybe just the oldest log entries, or just the newest ones, or just the ones that have some particular properties?

If you figure out what the client needs to do with this information, you should focus on providing the particular subset of the log file that will directly support that task, so that you deliver an appropriate quantity of data, instead of delivering all the data.

The appropriate quantity for manual inspection in a browser display will probably be a lot less than 5 MB (hopefully closer to 50 KB); then your task is to write the correct kind of filter that will deliver just that subset of data, and if the filter runs reasonably fast on the server, the slowness problem at the browser end will go probably away.

If the client needs a complete download of the log file, then set it up as an ftp transfer to the client's local disk, instead of sending it to the browser display.


In reply to Re^3: Opening a Large Text File by graff
in thread Opening a Large Text File by Anonymous Monk

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



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.