473,661 Members | 2,465 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

'aceptable' loading time/CPU load

Hi,

I have a fairly complicated script that seems to load fairly fast. But
that's because it is on my local server in the office and not on the main
one, (and I am the only one on it).

So I would like to run some tests, for example how long the pages take to
load on average and what load it place on the server.
Currently the pages load very fast indeed, but I suspect it is because I am
the only one on the server and php/MySQL are not working that hard...

Are there any ways to check that the script is within 'acceptable' limits?

Simon
Jul 17 '05 #1
4 1773
"simon" <sp********@myo ddweb.com> wrote in
news:36******** *****@individua l.net:
Hi,

I have a fairly complicated script that seems to load fairly fast. But
that's because it is on my local server in the office and not on the
main one, (and I am the only one on it).

So I would like to run some tests, for example how long the pages take
to load on average and what load it place on the server.
Currently the pages load very fast indeed, but I suspect it is because
I am the only one on the server and php/MySQL are not working that
hard...

Are there any ways to check that the script is within 'acceptable'
limits?


I think you might be pleasantly surprised when you move the script from
your local server to a production server; then again, for many years my
local server was a Pentium 75.. :) You can time the execution of your
script like this:

<?php
function getmicrotime(){
list($usec, $sec) = explode(' ', microtime());
return ((float)$usec + (float)$sec);
}

$start = getmicrotime();

//
//Insert all of your code here.
//

$finish = getmicrotime();
$latency = sprintf("%.2f", $finish - $start);
echo "<hr>This script took $latency seconds to execute.";
?>

The result is not perfectly accurate, but it's close enough, down to the
tenth of a second or so. If you're not satisfied with the run time, you
could break it down further, calculating a separate $start, $finish, and
$latency for various code blocks to isolate the bottleneck.

As for CPU load, just run a `top` session in a shell (assuming you're on
a unix server), hit the S key, hit the 1 key, hit Enter. top will refresh
once per second and you can see if there's a load spike when your script
executes. Note that top itself will generally cause load to go up.

hth


--

Bulworth : PHP/MySQL/Unix | Email : str_rot13('f@fu ng.arg');
--------------------------|---------------------------------
<http://www.phplabs.com/> | PHP scripts, webmaster resources
Jul 17 '05 #2
>>
Are there any ways to check that the script is within 'acceptable'
limits?


I think you might be pleasantly surprised when you move the script from
your local server to a production server; then again, for many years my
local server was a Pentium 75.. :) You can time the execution of your
script like this:


Hi,

Thanks for the code, but I guess what I was asking is 'how long is too
long'?.
Currently my code takes 0.30s to 0.42s to produce a page, (again on the
local server with no one else working on it).

Is that too much?

Is there an app 'out there' that would put some load on my server? I don't
feel like writing a once off app to do that for me.

Simon
Jul 17 '05 #3
It is impossible to give a straight answer to, "how much processing
load is 'too much'?". It all depends on your situation.

You might find the following info helpful to determine your current
limits, but you will have to analyze for yourself whether or not that
limit is within an acceptable range for your application.

http://httpd.apache.org/docs-2.0/programs/ab.html

http://perl.apache.org/docs/1.0/guide/performance.html - This one is
geared toward perl/CGI development, but it still has some useful info
that will apply for PHP.

Jul 17 '05 #4
"simon" <sp********@myo ddweb.com> wrote in
news:36******** *****@individua l.net:

Are there any ways to check that the script is within 'acceptable'
limits?


I think you might be pleasantly surprised when you move the script
from your local server to a production server; then again, for many
years my local server was a Pentium 75.. :) You can time the
execution of your script like this:


Hi,

Thanks for the code, but I guess what I was asking is 'how long is too
long'?.
Currently my code takes 0.30s to 0.42s to produce a page, (again on
the local server with no one else working on it).

Is that too much?

Is there an app 'out there' that would put some load on my server? I
don't feel like writing a once off app to do that for me.

Simon


"Too long" is very subjective. If your script is adding 5 plus 4, 0.30
seconds is slow to average. If your script is computing the human genome,
0.42 seconds is NSA fast. As I presume you're doing something more
realistic, I'll say that half a second is nothing. Less than half a
second is less than nothing.

At that rate, it will take your server more time to send the document to
your visitor over the wire than to execute the code. Unless you're
expecting to be the next Google, Amazon, or Yahoo, you should be just
fine. Try it on the production server and see how long it takes there,
with other processes happening. Runtime will probably be the same, if not
better.

As for putting load on your server, if you're using Apache, try the "ab"
Apache Benchmark tool. If you compile Apache yourself, I believe it's
built by default, check out the "bin" directory under your Apache
install, and look for "ab." If it's there, run it with no arguments to
see its help. It's rather versatile and is good at loading one URL over
and over and over hundreds of times in a row.

hth

--

Bulworth : PHP/MySQL/Unix | Email : str_rot13('f@fu ng.arg');
--------------------------|---------------------------------
<http://www.phplabs.com/> | PHP scripts, webmaster resources
Jul 17 '05 #5

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

Similar topics

3
8490
by: Roy Wang | last post by:
hi, My problem is how to determining when the XML file has loaded using javascript. I loaded an xml file using javascript in a web page. The code below is loading the xml file for IE: this.xmlDoc= new ActiveXObject("Microsoft.DomDocument"); this.xmlDoc.load(url);
4
3736
by: Adrian MacNair | last post by:
Hi, I created an image gallery which displays 63 images in a slideshow. The problem is that the show was slow because each image loaded one at a time during the show. No problem right? I just did a preload script. But then the user has to sit for 5 minutes waiting for 63 images to download! My images are about 640x480 and average 100kb. Is this too much for one page to load? Should I load my slideshow into differerent windows? If so,...
5
12229
by: John Richardson | last post by:
I've been bothered for some time about my DataGrid not populating my rows very quickly. I have about 10K rows loading into the grid. I create a datatable dt with 2 columns, an ID and a display. The ID is a member of the keys array. I then create a DataView dv over the table, and sort it by Display and ID column (in case of duplicate Display). I then set my DataGrid.DataSource = dv; I then load the datatable with my rows, and this is...
4
6947
by: John | last post by:
Hi all, I'm having a little problem understanding the concepts of dynamically loading/unloading user conrols: 1. If I have a couple of usercontrols embedded within a few tables cells on my page, setting the usercontrol's visible to false still fires the Page_Load event. Isn't this unnecessary overhead when it doesn't even show in my page.
2
1971
by: Rob | last post by:
I was working on a project and everything was going fine, then all of a sudden the form set as my startup object stopped loading. I tried setting some others as the startup object, and some of my forms will load and others won't. Those that won't load at startup don't load with the Show or ShowDialog command either. Can anyone give me a hint as to what went wrong?
3
2607
by: Holmes | last post by:
Hello Ran into a bit of a problem here and have now exhausted my resources to getting this working What I am trying to do is load and show a simple vb form with a listbox in it Dim frm_nc_code As New frm_nc_sen frm_nc_code.Show( Well what I want to have happen is it loads the form then shows all of the controls on the form (especially the listview control which should be blank at this time)
27
2263
by: Chris Tomlinson | last post by:
Hi, is there any way to specify the sequence in which images load on a web page? More specifically, here is what we need to achieve: Image1 starts loading first and the browser does not continue through the HTML until Image1 has loaded COMPLETELY. When Image1 is done, Image2 BEGINS loading. When Image2 is 100% done, only then does Image 3 begin... and so on...
0
2195
by: speedcoder | last post by:
hi all, i'm stumped. my applet used to load images over the network. (it was actually designed by someone else.) yes, the applet used to load each image file independently over the network and incurred a network hit per image file. i wanted to avoid the overhead of a separate network connection for each image file, so i bundled all the images into the JAR file. yet, somehow, the loading time for the applet is slower now! i'm totally...
13
6588
by: rdudejr | last post by:
Hi all, I hardly ever make a post unless I am having a very purplexing issue, so this one should be good... I am trying to do a load against a database on an AIX server into a DB2 v9.1 database, using SAN for storage. The table has a few CLOBs (smallish clobs but we are storing XML data in non-native format). Here is the load command I am using:
0
8428
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
8341
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8754
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8542
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8630
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
7362
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
4177
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4343
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2760
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

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.