473,473 Members | 2,102 Online
Bytes | Software Development & Data Engineering Community
Create 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 2062
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_once" and
"require_once". 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
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...
3
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...
2
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...
2
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...
1
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...
1
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...
13
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. ...
14
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,...
5
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.