473,799 Members | 2,741 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How long is too long for a cgi script?

I have a 4000 line php cgi script that is not memory or cpu intensive.
It runs in 1 second. Now I am getting a lot of customer requests to add
in new features. My question is if there is a point where my code will
be too long and take too long to run (i.e > 5 seconds). I would really
like to have my script rival the functionality of a desktop application
but can php do it?

My server is a dual processor with 2GB ram.

Jul 17 '05 #1
5 2079
NC
el_roachmeis... @yahoo.com wrote:

I have a 4000 line php cgi script that is not memory or cpu
intensive. It runs in 1 second.
Memory and CPU are not the only resources you should watch
out for. I/O (Input/Output) can be a bottleneck, too.
Now I am getting a lot of customer requests to add in new
features. My question is if there is a point where my code
will be too long and take too long to run (i.e > 5 seconds).
This is not a one-dimensional problem. Yes, increasing the
amount of code in the script will result in increasing time
to run, other things being equal. The problem is that other
things are NOT equal. Running time is NOT a linear function
of the script size. A lot depends on what kind of code you
add; calls to file systems (especially remote file systems)
and databases are particularly expensive.

Also, you mentioned your script was CGI... Are you using the
term "CGI" loosely or is your installation of PHP in fact a
CGI installation as opposed to, say, Apache module installation?
If so, what is the reason?
I would really like to have my script rival the functionality
of a desktop application but can php do it?

My server is a dual processor with 2GB ram.


It's not a question of whether PHP can do it, but rather the
question of whether you can afford the hardware and bandwidth
to make it happen. A few hundred megabytes of RAM will be used
just to keep the server running (OS and daemons). Apache will
consume a few hundred kilobytes per connection (the exact number
depends on what modules are enabled), MySQL, another fifty or so.
Then there's a question of how much RAM your script requires.
If we assume that a single copy of the script requires a megabyte
of RAM (including memory allocated by Apache and MySQL) to run
and the system memory is 500 megabytes, you should be able to
serve up to (2000 - 500) / 1 = 1500 users. The problem is, if
you use a database server, it will probably be unable to serve
1500 simultaneous connections, unless you have some serious
enterprise-class hardware, meaning that I/O trumps memory and
CPU yet again...

Cheers,
NC

Jul 17 '05 #2
I realize my question is a bit vague. How about comparing to other
commercial php scripts? How big are some of the better forum scripts?

Jul 17 '05 #3
el************* @yahoo.com wrote:
: I realize my question is a bit vague. How about comparing to other
: commercial php scripts? How big are some of the better forum scripts?

It's an irrelevent comparison.

However, you might want to learn about things like "include_on ce" and
"require_on ce". They are very useful for larger projects.

--

This space not for rent.
Jul 17 '05 #4
el************* @yahoo.com wrote:
I realize my question is a bit vague. How about comparing to other
commercial php scripts? How big are some of the better forum scripts?


If you're not getting 100% code coverage of the 4000 lines it might be
better to split some of the code which is not always run off into
conditionally included files.

HTH

C.
Jul 17 '05 #5
Why only one script? You application isn't just one page, right?

Jul 17 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
5431
by: Doug | last post by:
I have a script that does a huge database update, which takes a long time. However, the host I am running on (and I suspect most hosts) are running in "safe mode." This means I cannot change the maximum execution time of scripts. So, the script stops right in the middle of doing the update. On top of that, I am trying to make code that I can distribute to others. As of now, the only way that this script can be run is with sys admin...
3
2740
by: Bob Bedford | last post by:
Some of my code has a long process, and my ISP limits the scripts to 30 seconds. Now, I must absolutely create a file with some string (simply a number and an email), then process any line with some long operations. If the script timeouts, then calling the script again should start when it finished. How to achieve that ?
2
1588
by: Brent | last post by:
Like many sites, mine has a standard "look" -- a template, if you will -- that visitors see on each page. I've tried to keep the code and HTML separate to the extent possible, and for most standard page presentations, it works well. However, I have a couple of screen scrape / import routines that can take minutes, even hours, to complete. I'd like to have some way of outputting my template first to the browser, and then within the...
2
15076
by: Benjamin Rutt | last post by:
I often execute a long-running python script which is a "driver" for my application; it may run for several hours on a large input. Under CPython, is it safe for me to modify the Python script and run it under some smaller inputs for test purposes, while the long-running script is still running? It seems safe to do so, but I want to be sure. I know, for example, that #!/bin/sh on my system is not safe in this regard. I suppose this...
1
6027
by: Anonieko | last post by:
Query: How to display progress bar for long running page Answer: Yet another solution. REFERENCE: http://www.eggheadcafe.com/articles/20050108.asp My only regret is that when click the browser back button, it loads the progress bar again. Any solution to this?
1
3484
by: Aaron West | last post by:
Try this script to see what queries are taking over a second. To get some real output, you need a long-running query. Here's one (estimated to take over an hour): PRINT GETDATE() select count_big(*) from sys.objects s1, sys.objects s2, sys.objects s3, sys.objects s4, sys.objects s5 PRINT GETDATE()
13
6014
by: wattersmt | last post by:
Hello, I am trying to write a python cgi that calls a script over ssh, the problem is the script takes a very long time to execute so Apache makes the CGI time out and I never see any output. The script is set to print a progress report to stdout every 3 seconds but I never see any output until the child process is killed. Here's what I have in my python script:
14
23173
by: lmttag | last post by:
Hello. We're developing an ASP.NET 2.0 (C#) application and we're trying to AJAX-enable it. We're having problem with a page not showing the page while a long-running process is executing. So, we're looking for a way to display the page with a "please wait..." message while the process is running, and then, when the process is done, update the page with the actual results/page content. We have a page that opens another browser/page...
5
5546
by: David Mathog | last post by:
I'm looking at a program which stores perl scripts in an array. Each script is stored as a single entry in that array, and the whole set of them live in a single header file (escaped out the wazoo to get the perl code intact through the C preprocessor.) The issue is that many of these strings are quite long, which causes gcc to throw these sorts of warnings: scripts.h:1: warning: string length '4918' is greater than the length '4095'...
0
9688
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10490
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10030
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9077
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6809
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5589
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4145
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3761
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2941
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.