Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

My first big project at my first big job was an apache module that took in some search terms and some categories as input, opened some files on disk that cached some meta-data for the category, and then did a search on a search index using the user input and the meta-data.

The module worked fine, it ran fast, i had no problems in development or in qa, and we ever ran it through PMA to make sure you could respond quickly.

when we deployed it live, it worked fine for a little while and then the whole machine would seeze up and not do anything. It turns out i wasn't closing the meta-data files, And the apache "threads" (sub-processes) where long lived, and haning on to the open file handles untill they exited.

The problem didn't show up in QA because they didn't hit it with a lot of concurrent load. It didn't show up in dev (even though i specificly tried hammering it with lots of requests) because the dev server had a much shorter time to live for the thread/process pool. It didn't show up in PMA (even though we were hitting it hard, and it was configured just like production) because the client we were using to trigger load was testing lots of permutations of input was doing a lot of randomness on the search terms, but not the category ... so the processes were usually getting lucky and typically allready had the filehandle that they needed opened.

it actually turned out that we were occasionally hitting the problem in PMA, it was just blocking untill another process died and released some filehandles ... once i put in the appropriate "close" call, the average response time was cut in half because of the eliminated blocking.

In reply to Test your code under the same conditions as it will run in production by hossman
in thread Greatest programming mistakes and what to learn from by Mr. Lee

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    NodeReaper tries to shade his eye-sockets with his hands

    How do I use this? | Other CB clients
    Other Users?
    Others lurking in the Monastery: (5)
    As of 2018-06-25 03:30 GMT
    Find Nodes?
      Voting Booth?
      Should cpanminus be part of the standard Perl release?

      Results (126 votes). Check out past polls.