Forum: Ruby on Rails need to find a bottleneck when traffic is kinda high

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
500e92cfb666d6757c317a5df7c7e28d?d=identicon&s=25 Shawn Bright (nephish)
on 2007-06-11 18:29
(Received via mailing list)
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.
Ef0db53920b243d6758c2f6b1306df0d?d=identicon&s=25 Steve Ross (cwd)
on 2007-06-11 18:40
(Received via mailing list)
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?

On Jun 11, 2007, at 9:29 AM, nephish wrote:

> we seem to really get bogged down on high traffic times. I have
>
> 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.
>
>
> >

Steve Ross
sross@calicowebdev.com
http://www.calicowebdev.com
500e92cfb666d6757c317a5df7c7e28d?d=identicon&s=25 Shawn Bright (nephish)
on 2007-06-11 19:11
(Received via mailing list)
On Jun 11, 11:40 am, "s.ross" <cwdi...@gmail.com> wrote:
> Could this be it?
> > divs on this page every 5 minutes or so. The page also uses a rather
> > apache) also slow down considerably.
>
> > thanks for any tips.
>
> Steve Ross
> s...@calicowebdev.comhttp://www.calicowebdev.com


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
E29eac7a986dbe96d7542d4bf0630be1?d=identicon&s=25 Matt (Guest)
on 2007-06-11 21:33
(Received via mailing list)
> 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.
500e92cfb666d6757c317a5df7c7e28d?d=identicon&s=25 Shawn Bright (nephish)
on 2007-06-11 21:43
(Received via mailing list)
On Jun 11, 2:32 pm, Matt <m...@energymind.com> wrote:
> > 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
E29eac7a986dbe96d7542d4bf0630be1?d=identicon&s=25 Matt (Guest)
on 2007-06-11 21:49
(Received via mailing list)
> 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
500e92cfb666d6757c317a5df7c7e28d?d=identicon&s=25 Shawn Bright (nephish)
on 2007-06-11 22:01
(Received via mailing list)
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 <div> 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
E29eac7a986dbe96d7542d4bf0630be1?d=identicon&s=25 Matt (Guest)
on 2007-06-11 23:53
(Received via mailing list)
> 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.
E29eac7a986dbe96d7542d4bf0630be1?d=identicon&s=25 Matt (Guest)
on 2007-06-12 00:01
(Received via mailing list)
> 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?
500e92cfb666d6757c317a5df7c7e28d?d=identicon&s=25 Shawn Bright (nephish)
on 2007-06-12 00:16
(Received via mailing list)
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
E29eac7a986dbe96d7542d4bf0630be1?d=identicon&s=25 Matt (Guest)
on 2007-06-12 00:18
(Received via mailing list)
On Jun 11, 11:15 pm, "shawn bright" <neph...@gmail.com> wrote:
>
> 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
F0987c97234fa9c6b26f796bdbdab037?d=identicon&s=25 werdnativ (Guest)
on 2007-06-12 16:09
(Received via mailing list)
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
500e92cfb666d6757c317a5df7c7e28d?d=identicon&s=25 Shawn Bright (nephish)
on 2007-06-12 16:28
(Received via mailing list)
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
This topic is locked and can not be replied to.