A new version of the Article Button plugin for Joomla 2.5 can be found here.

IT-Blog

Don't use timers in webforms - WHY NOT?

Timers are an programmatic construct to do something after a certain period of time. You construct them with "CREATE_TIMER" and do the Events in the WHEN-TIMER-EXPIRED trigger. 

If you are discussing about do's and don'ts in forms and webforms the statement is posted "Don't you timers in webforms because they cause lot of network-traffic. If you ask why you are told "because they are implemented on the middle-tier (application-server)".

So, i began to think about a simple java-bean to workaround this bad forms-behaviour, and took a look at some forums and in metalink. My result is, that there is no reason NOT TO USE TIMERS in webforms.

Timers in Webforms are implemented as Java-routine on the client-tier, and not on the Application-Server. That means if a timer expires in the WEB the Java-Web-Client has to go to the Application-Server and ask what to do. In the Client-Server-Environment he wouldn't have to go to the Application-Server because the complete application-logic is on the client. Seems to be that there is more traffic? We have to take a closer look to explain that.

Two examples:

Some unexperienced Newbie wrote a very very naughty program called "Clock" this clock is an text-item in forms and counts up the time every second. Let's take a look what network-traffic we have in the WEB and in Client/Server (C/S).

example with timer that fires every second


We can see that Webforms and also C/S-Forms have to go to the database (webforms via Application-Server) to get the Sysdate. That means, there is almost the same amount of traffic.

In the next example we check every hour if the user worked more than 10 hours at this day. If yes we display an annoying-message that tells him to go home.

example with timer that fires every minute 

In this example the condition is checked one time in an hour, and if it is true an timer is fired every minute that pops up an alert-message. You can see, that there every minute Webforms has to go to the Application-Server but C/S-Forms does not have to make any network-traffic. But simple packet one time in a minute, if you are surfing in the internet you cause more traffic in one minute than the timer in one hour! Also in some whitepapers from Oracle they say, that you can use timer if you don't fire them in less than one minute or 30 seconds. Of course in some other papers they also tell "don't use timers".

 

Veröffentlichen Sie ihre Kommentare ...


Warning: Creating default object from empty value in /www/htdocs/w0101274/www/fairtec.at/modules/mod_udjacomments/helper.php on line 387