AJAX periodical updater

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

AJAX periodical updater

Facundo Ciccioli
Hi.

I'm using #updateEverySeconds: on a WebElement and I found a problem.
I update every 3 seconds, and noticed than, after my page being opened
for a while, the browser started to suffer a serious slow down
(Firefox in this case). If I open the task manager (I'm running
Windows XP), I can see that the firefox.exe process is eating up 99
percent of the CPU. So I close the tab with my page, and everything's
back to normal. Also, if I get stubborn and leave my page open even
after everything slows down, eventually it stops updating...

So I said: maybe I'm doing everything wrong (which is *very* possible
since I'm not an AJAX nor web expert). So I went to the AIDA demo
site, and to the Ajax examples, where there is a clock that uses
#updateEverySeconds: 1. To my surprise, the same thing happened: after
a while everything slowed down. Baffled, the following thing I did was
to try the demo in Internet Explorer, to see if it was a browser
issue. Same thing happened.

I tried googleing the problem and found nothing, also tried looking in
this mail list's archives with the same luck. Does someone knows what
could be happening?

Grateful,
FaQ
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: AJAX periodical updater

Janko Mivšek
Hi Facundo,

Facundo Ciccioli wrote:

> I'm using #updateEverySeconds: on a WebElement and I found a problem.
> I update every 3 seconds, and noticed than, after my page being opened
> for a while, the browser started to suffer a serious slow down
> (Firefox in this case). If I open the task manager (I'm running
> Windows XP), I can see that the firefox.exe process is eating up 99
> percent of the CPU. So I close the tab with my page, and everything's
> back to normal. Also, if I get stubborn and leave my page open even
> after everything slows down, eventually it stops updating...
>
> So I said: maybe I'm doing everything wrong (which is *very* possible
> since I'm not an AJAX nor web expert). So I went to the AIDA demo
> site, and to the Ajax examples, where there is a clock that uses
> #updateEverySeconds: 1. To my surprise, the same thing happened: after
> a while everything slowed down. Baffled, the following thing I did was
> to try the demo in Internet Explorer, to see if it was a browser
> issue. Same thing happened.
>
> I tried googleing the problem and found nothing, also tried looking in
> this mail list's archives with the same luck. Does someone knows what
> could be happening?

I also get the same slowdown on the
http://demo.aidaweb.si/demos.html?view=ajax after few minutes in FF on
Linux. Funny that noone noticed that before! It is also true that I
didn't use periodic updater so far, but I rather use Comet technique
(delayed response to Ajax update) instead.

I would say that problem can be in Prototype's PeriodicUpdater, beccasue
  we just simply use that one for updating. I don't see anything wrong
in Aida side, but if someone can look with Firebug what is happening, we
can solve the problem faster. I'm namely not a JavaScript expert, just
the user.

Janko

--
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: AJAX periodical updater

Rob Rothwell
Hmm...long ago when I was asking you how to Comet (and never was successful in Squeak!), I "noticed" the same thing but never investigated it enough.

Anyway, that was on Window XP as well...

Rob

On Thu, Jan 15, 2009 at 8:13 AM, Janko Mivšek <[hidden email]> wrote:
Hi Facundo,

Facundo Ciccioli wrote:

> I'm using #updateEverySeconds: on a WebElement and I found a problem.
> I update every 3 seconds, and noticed than, after my page being opened
> for a while, the browser started to suffer a serious slow down
> (Firefox in this case). If I open the task manager (I'm running
> Windows XP), I can see that the firefox.exe process is eating up 99
> percent of the CPU. So I close the tab with my page, and everything's
> back to normal. Also, if I get stubborn and leave my page open even
> after everything slows down, eventually it stops updating...
>
> So I said: maybe I'm doing everything wrong (which is *very* possible
> since I'm not an AJAX nor web expert). So I went to the AIDA demo
> site, and to the Ajax examples, where there is a clock that uses
> #updateEverySeconds: 1. To my surprise, the same thing happened: after
> a while everything slowed down. Baffled, the following thing I did was
> to try the demo in Internet Explorer, to see if it was a browser
> issue. Same thing happened.
>
> I tried googleing the problem and found nothing, also tried looking in
> this mail list's archives with the same luck. Does someone knows what
> could be happening?

I also get the same slowdown on the
http://demo.aidaweb.si/demos.html?view=ajax after few minutes in FF on
Linux. Funny that noone noticed that before! It is also true that I
didn't use periodic updater so far, but I rather use Comet technique
(delayed response to Ajax update) instead.

I would say that problem can be in Prototype's PeriodicUpdater, beccasue
 we just simply use that one for updating. I don't see anything wrong
in Aida side, but if someone can look with Firebug what is happening, we
can solve the problem faster. I'm namely not a JavaScript expert, just
the user.

Janko

--
Janko Mivšek
AIDA/Web
Smalltalk Web Application Server
http://www.aidaweb.si
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida


_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: AJAX periodical updater

Facundo Ciccioli
Hi. I just wanted to let you know that I solved the problem by
changing the script that the message #updateEverySeconds:with: puts to
the WebElement.

I replaced the old script with:

        self scriptAfter: '
                function createRequest() {
                        new Ajax.Request(''', url, ''', { method: ''post'', postBody: ''',
parms, ''',
                                onSuccess: function(transport) {
                                        document.getElementById(''', self id, ''').innerHTML=
transport.responseText;
                                }
                        });
                }
                var intervalID= window.setInterval(createRequest, ', (aNumber*1000)
printString, ');
        '.

Aparently the problem is in Prototype, more specifically in its
PeriodicalUpdater or in Updater classes. I insist in that I don't know
Javascript, and to do this I just skimmed some info about it, so
anyone should probably see if this is a good solution.

FaQ

2009/1/15 Rob Rothwell <[hidden email]>:

> Hmm...long ago when I was asking you how to Comet (and never was successful
> in Squeak!), I "noticed" the same thing but never investigated it enough.
>
> Anyway, that was on Window XP as well...
>
> Rob
>
> On Thu, Jan 15, 2009 at 8:13 AM, Janko Mivšek <[hidden email]>
> wrote:
>>
>> Hi Facundo,
>>
>> Facundo Ciccioli wrote:
>>
>> > I'm using #updateEverySeconds: on a WebElement and I found a problem.
>> > I update every 3 seconds, and noticed than, after my page being opened
>> > for a while, the browser started to suffer a serious slow down
>> > (Firefox in this case). If I open the task manager (I'm running
>> > Windows XP), I can see that the firefox.exe process is eating up 99
>> > percent of the CPU. So I close the tab with my page, and everything's
>> > back to normal. Also, if I get stubborn and leave my page open even
>> > after everything slows down, eventually it stops updating...
>> >
>> > So I said: maybe I'm doing everything wrong (which is *very* possible
>> > since I'm not an AJAX nor web expert). So I went to the AIDA demo
>> > site, and to the Ajax examples, where there is a clock that uses
>> > #updateEverySeconds: 1. To my surprise, the same thing happened: after
>> > a while everything slowed down. Baffled, the following thing I did was
>> > to try the demo in Internet Explorer, to see if it was a browser
>> > issue. Same thing happened.
>> >
>> > I tried googleing the problem and found nothing, also tried looking in
>> > this mail list's archives with the same luck. Does someone knows what
>> > could be happening?
>>
>> I also get the same slowdown on the
>> http://demo.aidaweb.si/demos.html?view=ajax after few minutes in FF on
>> Linux. Funny that noone noticed that before! It is also true that I
>> didn't use periodic updater so far, but I rather use Comet technique
>> (delayed response to Ajax update) instead.
>>
>> I would say that problem can be in Prototype's PeriodicUpdater, beccasue
>>  we just simply use that one for updating. I don't see anything wrong
>> in Aida side, but if someone can look with Firebug what is happening, we
>> can solve the problem faster. I'm namely not a JavaScript expert, just
>> the user.
>>
>> Janko
>>
>> --
>> Janko Mivšek
>> AIDA/Web
>> Smalltalk Web Application Server
>> http://www.aidaweb.si
>> _______________________________________________
>> Aida mailing list
>> [hidden email]
>> http://lists.aidaweb.si/mailman/listinfo/aida
>
>
> _______________________________________________
> Aida mailing list
> [hidden email]
> http://lists.aidaweb.si/mailman/listinfo/aida
>
>
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: AJAX periodical updater

Janko Mivšek
Hi Facundo,

I just put your patch at work and so far so good, it seems you really
solved the problem, thanks a lot for that!

What if you look at other Ajax methods as well? I suspect them to cause
the same browser slow down, specially if an element updates itself many
times. Looks like we have there the same problem there as in periodic
updater.

Best regards
Janko

Facundo Ciccioli pravi:

> Hi. I just wanted to let you know that I solved the problem by
> changing the script that the message #updateEverySeconds:with: puts to
> the WebElement.
>
> I replaced the old script with:
>
> self scriptAfter: '
> function createRequest() {
> new Ajax.Request(''', url, ''', { method: ''post'', postBody: ''',
> parms, ''',
> onSuccess: function(transport) {
> document.getElementById(''', self id, ''').innerHTML=
> transport.responseText;
> }
> });
> }
> var intervalID= window.setInterval(createRequest, ', (aNumber*1000)
> printString, ');
> '.
>
> Aparently the problem is in Prototype, more specifically in its
> PeriodicalUpdater or in Updater classes. I insist in that I don't know
> Javascript, and to do this I just skimmed some info about it, so
> anyone should probably see if this is a good solution.
>
> FaQ
>
> 2009/1/15 Rob Rothwell <[hidden email]>:
>> Hmm...long ago when I was asking you how to Comet (and never was successful
>> in Squeak!), I "noticed" the same thing but never investigated it enough.
>>
>> Anyway, that was on Window XP as well...
>>
>> Rob
>>
>> On Thu, Jan 15, 2009 at 8:13 AM, Janko Mivšek <[hidden email]>
>> wrote:
>>> Hi Facundo,
>>>
>>> Facundo Ciccioli wrote:
>>>
>>>> I'm using #updateEverySeconds: on a WebElement and I found a problem.
>>>> I update every 3 seconds, and noticed than, after my page being opened
>>>> for a while, the browser started to suffer a serious slow down
>>>> (Firefox in this case). If I open the task manager (I'm running
>>>> Windows XP), I can see that the firefox.exe process is eating up 99
>>>> percent of the CPU. So I close the tab with my page, and everything's
>>>> back to normal. Also, if I get stubborn and leave my page open even
>>>> after everything slows down, eventually it stops updating...
>>>>
>>>> So I said: maybe I'm doing everything wrong (which is *very* possible
>>>> since I'm not an AJAX nor web expert). So I went to the AIDA demo
>>>> site, and to the Ajax examples, where there is a clock that uses
>>>> #updateEverySeconds: 1. To my surprise, the same thing happened: after
>>>> a while everything slowed down. Baffled, the following thing I did was
>>>> to try the demo in Internet Explorer, to see if it was a browser
>>>> issue. Same thing happened.
>>>>
>>>> I tried googleing the problem and found nothing, also tried looking in
>>>> this mail list's archives with the same luck. Does someone knows what
>>>> could be happening?
>>> I also get the same slowdown on the
>>> http://demo.aidaweb.si/demos.html?view=ajax after few minutes in FF on
>>> Linux. Funny that noone noticed that before! It is also true that I
>>> didn't use periodic updater so far, but I rather use Comet technique
>>> (delayed response to Ajax update) instead.
>>>
>>> I would say that problem can be in Prototype's PeriodicUpdater, beccasue
>>>  we just simply use that one for updating. I don't see anything wrong
>>> in Aida side, but if someone can look with Firebug what is happening, we
>>> can solve the problem faster. I'm namely not a JavaScript expert, just
>>> the user.
>>>
>>> Janko
>>>
>>> --
>>> Janko Mivšek
>>> AIDA/Web
>>> Smalltalk Web Application Server
>>> http://www.aidaweb.si
>>> _______________________________________________
>>> Aida mailing list
>>> [hidden email]
>>> http://lists.aidaweb.si/mailman/listinfo/aida
>>
>> _______________________________________________
>> Aida mailing list
>> [hidden email]
>> http://lists.aidaweb.si/mailman/listinfo/aida
>>
>>
> _______________________________________________
> Aida mailing list
> [hidden email]
> http://lists.aidaweb.si/mailman/listinfo/aida
>

--
Janko Mivšek
Svetovalec za informatiko
Eranova d.o.o.
Ljubljana, Slovenija
www.eranova.si
tel:  01 514 22 55
faks: 01 514 22 56
gsm: 031 674 565
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida