Solved

Efficiency with CGIs

Posted on 1998-07-15
4
320 Views
Last Modified: 2013-12-25
As I understand an inherent disadvantage with CGIs is that each each request (let us assume it is form processing) causes a new process to be forked.

1. Do we have an alternate way to process forms
2. Can we somehow circumvent from this drawback
3.Or do we have to live as it is, as that is the only way that things are with form processing

Just to provide you additional info I intend using PERL for form processing..Do you think using something else might be more efficient...a) in case of WINDOWS
                                 b) with UNIX      
0
Comment
Question by:sanjaychopra
  • 2
4 Comments
 

Accepted Solution

by:
ShadowSpawn earned 10 total points
Comment Utility
In general you're stuck with it.  If you really have a high volumn of form processing, etc. you may want to look into Fast-CGI.  This will allow the script to be "always running" and prevent the load / setup time associated with each execution. This will work fine on a *nix server.  To make a Windows server more efficient simply reformat the drive and install *nix. Worked wonders for me.  

To get more efficiency you may want to move from Perl to C/C++.  A compiled script will execute faster --- assuming your a descent programmer.

0
 
LVL 6

Expert Comment

by:alamo
Comment Utility
A 'descent' programmer, ShadowSpawn? Perhaps you lost your spellchecker while reformatting your drive 'volumn'.

sanjaychopra:

There are two big factors in speed:

-The inherent speed of the language. Perl scripts are compiled on every single invocation, whereas C/C++ is compiled into a ready-to-run executable. The tradeoff  - the reason people don't just always use C++ for CGI - is that perl is for many tasks so much easier and quicker to program and debug, and most sites don't need the better performance. According to what the Experts Exchange developers have posted here, E-E was itself originally written in perl then once the design was worked out and performance started becoming an issue (as the site got more popular -100,000 hits a day they say) it was converted over to C++.

- How the server invokes the CGI. Normally a server invokes a CGI by cerating a new process, which has significant overhead. This is true for both executables and perl. There are ways to greatly reduce this overhead by including the cgi as part of the server process, so that no external process need be forked. On nix servers such as Apache, Fast-CGI or (for perl) perl-mod does this. On WinNT servers ISAPI does this (by making the CGI into a DLL). There is an ISAPI DLL for perl available for NT.

Hope this was helpful...
0
 

Author Comment

by:sanjaychopra
Comment Utility
Thanks for the replies..Alamo that reply was really exhaustive enough to satisfy my queries..Thanks...
0
 

Expert Comment

by:ShadowSpawn
Comment Utility
Like I said ..... C is better.  

Alamo  -- My spell checking dll was somehow flawed by another app!  Next time I spew an 'exhaustive' answer out I'll be sure to try to fix it.  Until then you'll just have to rely on the content of my messages.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Batch, VBS, and scripts in general are incredibly useful for repetitive tasks.  Some tasks can take a while to complete and it can be annoying to check back only to discover that your script finished 5 minutes ago.  Some scripts may complete nearly …
Styling your websites can become very complex. Here I'll show how SASS can help you better organize, maintain and reuse your CSS code.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now