need to find a bottleneck when traffic is kinda high

Hello there all,

i have one page that uses periodically_call_remote to update about 65
divs on this page every 5 minutes or so. The page also uses a rather
large background map.

the server we are using has 4 cpu at 2ghz, 8meg RAM and 5 disc RAID 5.
our connection is 1.5 meg upload.

we seem to really get bogged down on high traffic times. I have
watched gkrellm, and it doesn't seem to be the processors or RAM that
is limiting anything.

Other php sites hosted on the main server here (virtual hosts in
apache) also slow down considerably.

i am using rails in production mode, fastcgi.

What kind of tool would you guys reccomend that i use to determine
what my bottleneck is ?

could it be disc? i have tried to optimize my tables and indexes, but
can't really tell what our limiting factor to speed things up here is.

Is ajax expensive on the server?

thanks for any tips.

Have you considered the HTTP pipeline? Updating 65 divs with one rjs request might be ok but if you are using periodically_call_remote to update each div individually, you could be generating 65 individual requests. If that’s the case, then once you run out of capability to serve the Rails requests, the next ones queue up until one of the fcgi’s frees up.

Ajax is inherently cheaper than page reloading, but potentially generates more request/response loops.

Could this be it?

this very well could be, would it be cheaper to use one ajax call to
remote to update several div tags at once ?
is this even possible?
this would also explain why other stuff takes longer to load with a hi
traffic time, stuff that is not fcgi.

thanks

this very well could be, would it be cheaper to use one ajax call to
remote to update several div tags at once ?

Considerably cheaper - maybe well in excess of 65 times as cheap
depending on the time it takes for the request to be served.

thanks looking up how to pull that off.
shawn

thanks looking up how to pull that off.
shawn

If the elements are all in a block, you could just render the whole
block in one go.
Otherwise you could use RJS with inline partials

well, the elements are scattered over a map, each one is an absolutely positioned pin on a map that shows the
amount of rain that that location received. We update the totals every 5 minutes so folk can actually watch it rain. could i put all of these inside something like a

and update them all.

also, each little div has one tiny image, is it also sending all of those, even if they are the same ? Or would the browser cache them ?

here is what i am talking about
www.texaspivot.com/pivrain

could i put all of these inside
something like a <div> and update them all.

Yep - thats the easiest way

also, each little div has one tiny image, is it also sending all of those,
even if they are the same ? Or would the browser cache them ?

Browser should cache them.

here is what i am talking aboutwww.texaspivot.com/pivrain

That has to be the most bizarre idea for a website I have ever seen -
amazing the applications for technology that you just dont think about
until someone else has done it.
I would assume that you dont get much rain in texas, hence the need to
ensure that the sprinklers are doing their job?

indeed, we are a couple of inches / year from being a desert out here.
thanks for all of your help, you can see, the high traffic time is when it rains. our site gets
flooded with traffic, when not, folk just log in to check their sprinklers.

with gas prices so high, to run a pivot on a 1/4 mile circle field of corn can be $500 / day.
so if it rains about an inch and a half, guys can shut off their sprinklers for a few days. If you are
farming 15 circles, you save a ton of money every time it gets wet outside.

Besides all that, Matt, thanks for all your help. I will try to have the changes in place before the next rain. All the farmers here are praying for one soon.

cheers !

shawn

Your welcome - if you need any help, let me know

Slightly OT, but why not use Google Maps for this? They provide some
great tools for map overlays: you can feed a whole set of data as a
GMarkerGroup and reload your map data in one swoop.

--Andrew Vit

That is an idea i had earlier, we built the first version of this tool over a year ago, in php.
when i began learning rails, i moved all of our web end to rails and translated it. When we first started, i did not even know google had an api for something like this, but i am very excited to do that when i get caught up with some of the other stuff we have to do.

by the way, i have the new code in place, and forcast is for light rain tonight. We will see how she does,
thanks again.
shawn