GD module

B

Bart van den Burg

Hey

I'm wondering how much processor power scripts using the GD module use. I'm
currently using 2 of those:

http://dareaper.blowlands.nl/tvreclames/graphs.pl?action=poll&value=30
where value could be anything between 0 and 100
http://dareaper.blowlands.nl/tvreclames/graphs.pl?action=agesex&sex=m&rid=87
where sex can be "m" or "f", and rid refers to a database entry

at this moment i have an average of 50 visitors per day at
http://www.tvreclames.nl, and everything seems well now, but i'm wondering
if it may become just too much if i get more visitors. The first image is on
every page 5 times, each time with a different value. Will this become a
problem, or is GD fast enough for it?

Thanks
Bart
 
J

J. Gleixner

Bart said:
Hey

I'm wondering how much processor power scripts using the GD module use. I'm
currently using 2 of those:

http://dareaper.blowlands.nl/tvreclames/graphs.pl?action=poll&value=30
where value could be anything between 0 and 100
http://dareaper.blowlands.nl/tvreclames/graphs.pl?action=agesex&sex=m&rid=87
where sex can be "m" or "f", and rid refers to a database entry

at this moment i have an average of 50 visitors per day at
http://www.tvreclames.nl, and everything seems well now, but i'm wondering
if it may become just too much if i get more visitors. The first image is on
every page 5 times, each time with a different value. Will this become a
problem, or is GD fast enough for it?

Thanks
Bart

The only way you're going to know it by stress testing your system.
If you use apache, try "ab". There are probably many others out there
to run a DOS type "test" on your system.
 
B

Bart van den Burg

J. Gleixner said:
The only way you're going to know it by stress testing your system.
If you use apache, try "ab". There are probably many others out there
to run a DOS type "test" on your system.

hm thanks, i didnt even know of the app "ab"

the request for the first one takes 225 ms... imo it's a bit too much
because that will already take at least 1 second per page. I do you think it
might be smarter to just produce 101 (0..100) images instead of rendering
them realtime? I guess the other graph can stay just the way it is since it
isn't requested that much

Bart
 
M

Martien Verbruggen

Hey

I'm wondering how much processor power scripts using the GD module use.

That depends entirely on what you do.

Generally, however, of the modules that are available to create image
graphics, GD is the lightest on the CPU, and the fastest.

at this moment i have an average of 50 visitors per day at
http://www.tvreclames.nl, and everything seems well now, but i'm wondering
if it may become just too much if i get more visitors. The first image is on
every page 5 times, each time with a different value. Will this become a
problem, or is GD fast enough for it?

The only way you can find out whether _your machine_ is fast enough to
support more load is by testing. find out where the limits are, and
scale your machinery accordingly.

Depending on the amount of work you do to create an image (I haven't
followed the links), it may very well be possible that the CGI and
Perl overheads are higher than the GD CPU usage. In that case, writing
a C plugin that interfaces directly with your web server would
probably be a better way to optimise.

I'd wager, however, that it'd be cheaper just to upgrade the hardware.

Martien
 
M

Martien Verbruggen

On Thu, 23 Oct 2003 20:50:02 +0200,

[snip of worry about performance of GD, and answer by someone telling
OP to stress test]
the request for the first one takes 225 ms... imo it's a bit too much
because that will already take at least 1 second per page. I do you think it
might be smarter to just produce 101 (0..100) images instead of rendering
them realtime? I guess the other graph can stay just the way it is since it
isn't requested that much

If there are only 101 images possible, then the calculation becomes
easy:

If you expect more than 101 requests between the times that you need
to regenerate all your images, you should batch generate them, and
just serve them up. If you expect fewer, then you should keep them
dynamic. If all images are static, you also do not need the CGI and
Perl overhead for each image request.

You could even take an intermediate approach, and cache the images
after generation, so the next identical request won't have to
regenerate them. With this approach, however, even a cached image
still is served through a CGI interface by a Perl process, even though
GD won't need to do any work.

Because of the really low number of possible images, I'd say that it's
probably best to generate static images, and just refer to those.

Martien
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,141
Messages
2,570,817
Members
47,364
Latest member
Stevanida

Latest Threads

Top