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 |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
01-23-2003, 06:04 PM
|
#1
|
|
Member
Registered: Mar 2001
Location: Klamath Falls
Posts: 62
Rep:
|
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?
|
|
|
|
01-23-2003, 08:20 PM
|
#2
|
|
Senior Member
Registered: Nov 2002
Location: Silly Con Valley
Distribution: Red Hat 7.3, Red Hat 9.0
Posts: 2,054
Rep:
|
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.
|
|
|
|
01-23-2003, 10:08 PM
|
#3
|
|
Member
Registered: Mar 2001
Location: Klamath Falls
Posts: 62
Original Poster
Rep:
|
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!
|
|
|
|
01-24-2003, 12:41 AM
|
#4
|
|
Senior Member
Registered: Nov 2002
Location: Silly Con Valley
Distribution: Red Hat 7.3, Red Hat 9.0
Posts: 2,054
Rep:
|
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. 
|
|
|
|
01-24-2003, 09:01 AM
|
#5
|
|
Member
Registered: Mar 2001
Location: Klamath Falls
Posts: 62
Original Poster
Rep:
|
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.
|
|
|
|
01-24-2003, 09:19 PM
|
#6
|
|
LQ Newbie
Registered: Nov 2002
Location: Zemun, Serbia
Distribution: DEBIAN
Posts: 18
Rep:
|
check out www.modperldev.com 
forget perlcc 
|
|
|
|
01-25-2003, 08:42 AM
|
#7
|
|
Member
Registered: Apr 2001
Location: MA
Distribution: redhat 7.2
Posts: 182
Rep:
|
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.
|
|
|
|
01-25-2003, 08:47 AM
|
#8
|
|
Member
Registered: Apr 2002
Location: D.C - USA
Distribution: slackware-current
Posts: 488
Rep:
|
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 ...
|
|
|
|
01-25-2003, 05:42 PM
|
#9
|
|
Member
Registered: Mar 2001
Location: Klamath Falls
Posts: 62
Original Poster
Rep:
|
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.
|
|
|
|
01-25-2003, 07:33 PM
|
#10
|
|
LQ Newbie
Registered: Nov 2002
Location: Zemun, Serbia
Distribution: DEBIAN
Posts: 18
Rep:
|
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.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 03:00 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|