LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 01-23-2003, 06:04 PM   #1
bretthoward
Member
 
Registered: Mar 2001
Location: Klamath Falls
Posts: 62

Rep: Reputation: 15
Unhappy CGI Performance Increase??


I'm currently running a web mail application on my server thats written in perl and its a .cgi. My problem is that its slow cause everytime you hit the page it has to compile all of the stuff before it can show it to you. This is only a P233 and that takes a little time and its almost not even acceptable as a mail app because of this delay. Is there anyway to pre-compile the cgi script so that its faster?
 
Old 01-23-2003, 08:20 PM   #2
megaspaz
Senior Member
 
Registered: Nov 2002
Location: Silly Con Valley
Distribution: Red Hat 7.3, Red Hat 9.0
Posts: 2,054

Rep: Reputation: 46
http://webmaster.indiana.edu/perl56/...rlcompile.html

according to the link above, perl has the ability to compile down to c code which you can then use to compile a native executable. depending on your version of perl or distro, you may have to download some extra modules. i really don't know. i'm on red hat 7.3 and it looks like i have perlcc. i hope that's what you're looking for.

Last edited by megaspaz; 01-23-2003 at 08:21 PM.
 
Old 01-23-2003, 10:08 PM   #3
bretthoward
Member
 
Registered: Mar 2001
Location: Klamath Falls
Posts: 62

Original Poster
Rep: Reputation: 15
More Info on the Problem...

I found that I have a perlcc and I ran it as such:
perlcc -o test.out index.cgi

And its been running for about 15 minutes now. I'm not sure if its totally perl code or not. I'm guessing that its not because if I run test.pl (that comes with apache) with apache it shows me what it should. Then if I type perl test.pl it shows me what I saw on the browser window when using apache. When I type perl index.cgi it just does the same thing that cat index.cgi would have done. Hopefully this helps someone solve this. Meanwhile as I type this message I'm STILL running the perlcc command. Index.cgi is only like 174k and some change... Should it really take this long to compile? Yea its a slow box but damn!
 
Old 01-24-2003, 12:41 AM   #4
megaspaz
Senior Member
 
Registered: Nov 2002
Location: Silly Con Valley
Distribution: Red Hat 7.3, Red Hat 9.0
Posts: 2,054

Rep: Reputation: 46
well, perlcc, from what i've read only creates the c source code. you have to compile your index.cgi (rename it first to like index.c) using cc. so you might have something like "cc -o index.cgi index.c". now the cgi will be executable.
 
Old 01-24-2003, 09:01 AM   #5
bretthoward
Member
 
Registered: Mar 2001
Location: Klamath Falls
Posts: 62

Original Poster
Rep: Reputation: 15
What actually happened

pearlcc actuall was calling cc1 a few times here and there in its processing and I let it run till the system started thrashing and swapping everywhere. And the files it was generating were getting near 17gig before I stopped it. Is this supposed to happen? If so I'll bring them to a faster box to compile them and then bring them back.
 
Old 01-24-2003, 09:19 PM   #6
mire
LQ Newbie
 
Registered: Nov 2002
Location: Zemun, Serbia
Distribution: DEBIAN
Posts: 18

Rep: Reputation: -2
check out www.modperldev.com
forget perlcc
 
Old 01-25-2003, 08:42 AM   #7
te_conway
Member
 
Registered: Apr 2001
Location: MA
Distribution: redhat 7.2
Posts: 182

Rep: Reputation: 30
I agree with MIRE, use modperl. I've had no problems with perl (not modperl) on a ppro 200mhz but am moving to modperl.

If this is a mail app get it working w/o mail which can be slow to various other issues before you try and guage speed.

If your mailer allows the mail to be sent from a queue, that willl be the best method for the browser.
 
Old 01-25-2003, 08:47 AM   #8
lackluster
Member
 
Registered: Apr 2002
Location: D.C - USA
Distribution: slackware-current
Posts: 488

Rep: Reputation: 30
I once tried to compile "hello, world" (if you don't know "hello, world", go read another forum) with perlcc. BIG MISTAKE. Maybe I was just doing it wrong or something, but it took about ten minutes to generate the .c files ... then it came time to compile. I pulled up gcc (I was running win2k with cygwin at the time) and tried to compile it, but only got a page full of error messages. So I went into the source ..... heed the Camel's advice and DON'T EVER LOOK AT THE SOURCE!!! You really will go blind. Well, that was my experiance with perlcc ...
 
Old 01-25-2003, 05:42 PM   #9
bretthoward
Member
 
Registered: Mar 2001
Location: Klamath Falls
Posts: 62

Original Poster
Rep: Reputation: 15
Thanks for the info now here's more

It looks like whats happening is a relationship like this


APACHE<---CGI--->Mail Program / PERL<----POP3--->Qmail

So I'm guessing that CGI and perl are two separate things and thats why I can't just run it like "perl index.cgi".

Bear with me I'm kinda new to this. I dabble in applications programing but my main focus is in programming hardware in languages such as VHDL and Verilog and what not. I thought that CGI was something that could be implemented in C++ or Perl or whatever or is it like .NET where you can do it in many languages for the same assembly?

Mod_Perl sounds interesting and I'm willing to delve into it if I know that I can somehow just make it load the index.cgi that I currently have faster. If I have to recode it to work with this new technology I'll just find something else before I go into that.
 
Old 01-25-2003, 07:33 PM   #10
mire
LQ Newbie
 
Registered: Nov 2002
Location: Zemun, Serbia
Distribution: DEBIAN
Posts: 18

Rep: Reputation: -2
cgi is a protocol and perl is just an implementation (although a great one and one of the first very widely used).

you can write cgi in perl, c, c++, php, whatever has stdin, stdout

mod_perl has a compatibilty layer that runs cgi code much faster with no code rewrite. This is a process called mod_perl migration.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compile from source - increase in performance? csvke Linux - Software 15 01-18-2005 10:08 PM
Increase performance amnesty_puppy Debian 18 11-24-2004 02:44 PM
Increase Performance berkay Fedora 10 08-23-2004 04:24 PM
how to increase performance(geforce2) mandosi Linux - Hardware 0 03-17-2004 04:21 AM
Why does performance increase when I mount? Vlad_M Linux - Hardware 4 10-11-2002 07:35 AM


All times are GMT -5. The time now is 10:54 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration