Professional Web Applications Themes

mod_perl2 & POST data - PERL Modules

Hello all, I'm currently researching switching alot of my company's code to using mod_perl (mod_perl2 specifically as the title implies, but some "odd" version that redhat enterprise ships with). Right now I am stuck on the best way to p out POST data. I am using $r->args for GETS, and right now using Apache::compat and $r->content for POSTS as I can't find any info on other ways to do it currently. My question is are there other suggestions on how to do this and which ways of getting the data are the fastest/most effecient (we are highly concerned with the ...

  1. #1

    Default mod_perl2 & POST data

    Hello all,

    I'm currently researching switching alot of my company's code to using
    mod_perl (mod_perl2 specifically as the title implies, but some "odd"
    version that redhat enterprise ships with). Right now I am stuck on
    the best way to p out POST data. I am using $r->args for GETS, and
    right now using Apache::compat and $r->content for POSTS as I can't
    find any info on other ways to do it currently.

    My question is are there other suggestions on how to do this and which
    ways of getting the data are the fastest/most effecient (we are highly
    concerned with the code speed and mem/proc usage on the servers). We
    are shying away from CGI.pm at the moment as it seems to be a bit of a
    hog, but if there is some use of it I am missing for these types of
    things I would love to hear about them.

    Thanks,
    Brian

    neophenix@gmail.com Guest

  2. #2

    Default Re: mod_perl2 & POST data

    com schrieb: 

    I'd give CGI.pm a try. Internally it detects if mod_perl is used and
    uses mod_perl to fetch the data, so it shouldn't be that much CPU
    overhead. Although it may be a memory overhead. But I think it's worth a
    try.

    -Thomas
    Thomas Guest

  3. #3

    Default Re: mod_perl2 & POST data

    "com" <com> wrote: 

    Do you need to be able handle multipart posts, or just the old fashioned
    single-part ones? I seem to remember something that could handle single-
    part posts, but I'll have to go digging to find it again.
     

    Are you relying on heresay and/or irrelevant tests, or have you tested it
    under your conditions (mod_perl2) and found it to be a hog? If so, can
    you describe your tests?

    I used ab2 -n 1000 -c 4 to do some benchmarking either with no query or
    with a simple "?foo=bar" query, and under regular cgi-bin using CGI.pm
    slowed things down a lot (compared to simply printing hello world and
    ignoring the query altogether), 8.9 ms per request versus 41.3 ms.

    But under mod_perl (not mod_perl2), the different between using CGI.pm to
    p the query and not using it at all was undetectable, 5 to 7 ms per
    request either way.

    (single CPU server, ab2 client was on same LAN as server)

    Xho

    --
    -------------------- http://NewsReader.Com/ --------------------
    Usenet Newsgroup Service $9.95/Month 30GB
    xhoster@gmail.com Guest

  4. #4

    Default Re: mod_perl2 & POST data


    com wrote: 

    This would just be for single-part posts.
     

    To be honest I am just going by what I was told by others here and what
    they have seen under normal cgi-bin use. The main issue is, if we are
    only loading up 1 use of these scripts on each server and as such only
    loading up CGI.pm once, then that is fine. However we need to load up,
    say 400 copies of our index file on each machine, and each one would
    then need CGI. We were told, and have read that each uri loads up the
    packages it needs into memory, so I was led to believe that loading up
    some 400 instances of a module like CGI would be a bit much.

    I could be wrong of course and what we were told could be inaccurate.
    I am really just starting looking in to all this and only have the
    Practical mod_perl and mod_perl developer's cookbook to look through
    which are both mod_perl1 sadly.

    neophenix@gmail.com Guest

  5. #5

    Default Re: mod_perl2 & POST data

    > I used ab2 -n 1000 -c 4 to do some benchmarking either with no query or 

    Apologize for the double post, but forgot to respond to this. I have
    been using ab2 to get some benchmark numbers and yes I do get the same
    results as you in that the use of CGI and not is negligable. We know
    how to make the scripts fast on their own, now we are worried about
    memory usage when we load them all up.

    neophenix@gmail.com Guest

  6. #6

    Default Re: mod_perl2 & POST data

    "com" <com> wrote: 
    >
    > This would just be for single-part posts.[/ref]

    It turns out that what I was thinking of us was just a way to run
    cgi-like scripts without a web server. The perl script itself acts like
    a web server, but it still uses CGI.pm to do the request parsing (but
    doing it that way only doesn't work with multi-part post, so that part
    of my memory was correct.)
     
    >
    > To be honest I am just going by what I was told by others here and what
    > they have seen under normal cgi-bin use. The main issue is, if we are
    > only loading up 1 use of these scripts on each server and as such only
    > loading up CGI.pm once, then that is fine. However we need to load up,
    > say 400 copies of our index file on each machine, and each one would
    > then need CGI.[/ref]

    You kind of lost me about loading up index files. But anyway, if one uses
    the normal mod_perl (Apache::Registry) method and use it with 500 scripts,
    they all share the same image of CGI.pm---they are not loading it 500
    times. I would be very surprised if the "normal" method of using mod_perl2
    (ModPerl::Registry, I think) was any different in that regard.
     

    With FastCGI and such that may be the case, but with Registry it should not
    be. More of an issue would be having the non-CGI.pm portion of all those
    scripts in memory. You should extract as much code that is in common
    between them into your own custom *.pm, that way *that* code can be shared
    amongst all of them, too.

    Xho

    --
    -------------------- http://NewsReader.Com/ --------------------
    Usenet Newsgroup Service $9.95/Month 30GB
    xhoster@gmail.com Guest

  7. #7

    Default Re: mod_perl2 & POST data

    > You kind of lost me about loading up index files. But anyway, if one uses 
    >
    > With FastCGI and such that may be the case, but with Registry it should not
    > be. More of an issue would be having the non-CGI.pm portion of all those
    > scripts in memory. You should extract as much code that is in common
    > between them into your own custom *.pm, that way *that* code can be shared
    > amongst all of them, too.[/ref]

    That is excellent if that is indeed the case then. Actually 99% of our
    code is in custom modules, the index files really just use them after
    some minor "preprocessing" of the data.

    It is very possible that we were either told wrong or someone
    misunderstood. I will need to look into this more now. If they do all
    share modules, then CGI is the way we will more than likely go.

    Thanks for the reponses!

    neophenix@gmail.com Guest

Similar Threads

  1. redirect but with post data - mimick form post behaviour
    By LuckyNinja in forum Coldfusion - Advanced Techniques
    Replies: 4
    Last Post: April 14th, 05:58 PM
  2. How to post some data in form of POST action of forms in asp?
    By Mehdi Mousavi in forum ASP Components
    Replies: 1
    Last Post: September 19th, 05:16 PM
  3. post data, then post again..
    By JT in forum ASP
    Replies: 1
    Last Post: September 5th, 11:14 PM
  4. How to post this data
    By George Mizzell in forum Macromedia Dreamweaver
    Replies: 1
    Last Post: July 12th, 08:29 PM
  5. raw POST data
    By Roy Starkey in forum PHP Development
    Replies: 1
    Last Post: June 27th, 10:19 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139