RE: scope and presenting realtime data (fwd)

2004-05-27 Thread ramudu
Dear Alexander and others..

thanks for your input.. definitely i will incorporate these things..

above all, i very much enjoyed this tech. discussion..

thanks  regards
  -Ramudu

On Thu, 27 May 2004, Jesse Alexander (KXT) wrote:

 1) sounds good
 2) why not do this checking every other time you access the object anyway?
You could span a short lived thread (does just one check-up) for this.
   reason
   - daemon threads in app-sercvers (and servlet-engines) are not loved
   - you need something to watch over that daemon thread
 3) poll only if the last value for a server is older than n seconds (saves some io)
 
 else sounds good
 
 hth
 Alexander
 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Mittwoch, 26. Mai 2004 19:39
 To: Struts Users Mailing List
 Subject: Re: scope and presenting realtime data (fwd)
 
 
 Dear All,
 
 Thanks for all your feedback.
 
 Based on the discussion i derive following conclusions. please comment on 
 their accuracy.
 
   1. A Data Storage object (Say a HaspMap with the server name as a key 
  and the N value data object as value are stored along with the last 
  updated time) -- we are not going for database to save time on I/O
  and do not want to deal with stale data in database. --
 
   2. A cleaner thread will wake-up periodically, and remove the server 
  entry which is not being used for the last 'X' minutes 
  -- This we need to do as we are having large number of servers to be 
  monitored --
 
   3. For each request the bean class need to
   a. poll and get the current value
   b. get the stored data object for the server
   c. if the object exists, add the value and drop the oldest
  sample if size becomes N+1
   d. if object does not exist, create with the current value
   e. update the value in data storage object 
 
   
  thanks   regards
-Ramudu
 
  
 On Wed, 26 May 2004, Irfandhy Franciscus wrote:
 
  My advice may sound out of the context,
  
  but how bout actually storing each last N value to a database. this way 
  you can even have an archive of the Last N value.
  
  Or if you dont want to setup a database, just write the last N value to 
  a property file or text file.
  
  Regards,
  Irfandhy Franciscus
  
  [EMAIL PROTECTED] wrote:
   Hi,
   
   Can anyone suggest some approach for this issue.
   
   thanks  regards
-Ramudu
   
   
   -- Forwarded message --
   Date: Wed, 26 May 2004 14:52:23 +0530 (IST)
   From: [EMAIL PROTECTED]
   Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]
   Subject: scope and presenting realtime data
   
   Hi,
   
   We are developing a web based interface (struts + jsp etc) for realtime 
   monitoring of server cpu usage.
   
   We have written a bean that will contact the server and get the current
   cpu usage and return that value. I want to plot a line graph (using
   jfreechart) with the cpu usage in Y-axis and time in X-axis.  The Graph
   need to plot the last 'N' values + the current value during each refresh.
   
   The issue is how to remember these last N values. I do not want to assign 
   session scope for this object as the end-user might monitor for more than 
   one servers and several users might be using the system at same time.
   
   How this situation is typically handled in the Struts+jsp environment.
   
   thanks  regards
 -Ramudu
   
   
   -
   To unsubscribe, e-mail: [EMAIL PROTECTED]
   For additional commands, e-mail: [EMAIL PROTECTED]
  
  
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
  
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



scope and presenting realtime data

2004-05-26 Thread ramudu
Hi,

We are developing a web based interface (struts + jsp etc) for realtime 
monitoring of server cpu usage.

We have written a bean that will contact the server and get the current
cpu usage and return that value. I want to plot a line graph (using
jfreechart) with the cpu usage in Y-axis and time in X-axis.  The Graph
need to plot the last 'N' values + the current value during each refresh.

The issue is how to remember these last N values. I do not want to assign 
session scope for this object as the end-user might monitor for more than 
one servers and several users might be using the system at same time.

How this situation is typically handled in the Struts+jsp environment.

thanks  regards
  -Ramudu


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



scope and presenting realtime data (fwd)

2004-05-26 Thread ramudu
Hi,

Can anyone suggest some approach for this issue.

thanks  regards
 -Ramudu


-- Forwarded message --
Date: Wed, 26 May 2004 14:52:23 +0530 (IST)
From: [EMAIL PROTECTED]
Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Subject: scope and presenting realtime data

Hi,

We are developing a web based interface (struts + jsp etc) for realtime 
monitoring of server cpu usage.

We have written a bean that will contact the server and get the current
cpu usage and return that value. I want to plot a line graph (using
jfreechart) with the cpu usage in Y-axis and time in X-axis.  The Graph
need to plot the last 'N' values + the current value during each refresh.

The issue is how to remember these last N values. I do not want to assign 
session scope for this object as the end-user might monitor for more than 
one servers and several users might be using the system at same time.

How this situation is typically handled in the Struts+jsp environment.

thanks  regards
  -Ramudu


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: scope and presenting realtime data (fwd)

2004-05-26 Thread ramudu
Hi,

Thanks for your response...

as you rightly pointed out the data is 'near realtime' not exactly 
REAL-TIME.

Yes.. we need to store in the servlet context.. but what needs to be the 
scope..

if scope is request, than we can show only the current value.

if the scope is session, than this bean (storing + polling bean) will be 
maintained even when there is no user is currently watching the data.
Is there anyway to *invalidate* this storage bean if nobody has accessed
it in some past N minutes?

I am new to struts so this question might be be too simple..

thanks  regards
 -Ramudu

On Wed, 26 May 2004, Andrew Hill wrote:

 Why not store the info in the servlet context, using different keys for each
 server?
 
 That way if several users are all monitoring the same server they will be
 looking at the same set of data.
 
 Since the data is being multithreaded you will need to make sure you
 synchronize in the appropriate places for which purpose you would probably
 implement some kind of bean to store this data in an internal collection.
 You would probably want to merge the functionality of your polling bean with
 this storeage one, so you would be using one bean instance per server, with
 all users sharing these beans simultaneously.
 
 Id suggest that when the bean is asked to pull data for a particular server
 it checks to see that a certain period of time has gone by since the last
 poll. If not you wouldnt bother pulling another value to add to the set.(Id
 suggest at least a second, and more if you have lots of users). If two users
 ask for the information within a few milliseconds if each other there is
 little point doing an extra poll. By the time the graph is redrawn and hits
 the browser even the most current value will be many milliseconds out of
 date anyhow and it doesnt make much difference to a human!
 
 In terms of 'realtime' presentation you probably dont really want to have
 the browsers polling the server too much (though it would be easy to do with
 a javascript timer that refreshes the page), as all the requests will add
 considerably to your server load (especially since the charts need
 redrawing). If your setting a minimum polling period as suggested above you
 would probably also want to try and somehow cache the resulting chart images
 until such time as new data is available, such that several requests coming
 in rapidly (probably from different users) could all be serviced with the
 same image and cut the need to spend server time re-rendering the chart.
 
 Thats just my 2 cents worth though so theres probably many better ways of
 doing it.
 
 hth
 Andrew
 
 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 Sent: Wednesday, 26 May 2004 19:42
 To: [EMAIL PROTECTED]
 Subject: scope and presenting realtime data (fwd)
 
 
 Hi,
 
 Can anyone suggest some approach for this issue.
 
 thanks  regards
  -Ramudu
 
 
 -- Forwarded message --
 Date: Wed, 26 May 2004 14:52:23 +0530 (IST)
 From: [EMAIL PROTECTED]
 Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: scope and presenting realtime data
 
 Hi,
 
 We are developing a web based interface (struts + jsp etc) for realtime
 monitoring of server cpu usage.
 
 We have written a bean that will contact the server and get the current
 cpu usage and return that value. I want to plot a line graph (using
 jfreechart) with the cpu usage in Y-axis and time in X-axis.  The Graph
 need to plot the last 'N' values + the current value during each refresh.
 
 The issue is how to remember these last N values. I do not want to assign
 session scope for this object as the end-user might monitor for more than
 one servers and several users might be using the system at same time.
 
 How this situation is typically handled in the Struts+jsp environment.
 
 thanks  regards
   -Ramudu
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: scope and presenting realtime data (fwd)

2004-05-26 Thread ramudu
Dear All,

Thanks for all your feedback.

Based on the discussion i derive following conclusions. please comment on 
their accuracy.

  1. A Data Storage object (Say a HaspMap with the server name as a key 
 and the N value data object as value are stored along with the last 
 updated time) -- we are not going for database to save time on I/O
 and do not want to deal with stale data in database. --

  2. A cleaner thread will wake-up periodically, and remove the server 
 entry which is not being used for the last 'X' minutes 
 -- This we need to do as we are having large number of servers to be 
 monitored --

  3. For each request the bean class need to
a. poll and get the current value
b. get the stored data object for the server
c. if the object exists, add the value and drop the oldest
   sample if size becomes N+1
d. if object does not exist, create with the current value
e. update the value in data storage object 

  
 thanks   regards
   -Ramudu

 
On Wed, 26 May 2004, Irfandhy Franciscus wrote:

 My advice may sound out of the context,
 
 but how bout actually storing each last N value to a database. this way 
 you can even have an archive of the Last N value.
 
 Or if you dont want to setup a database, just write the last N value to 
 a property file or text file.
 
 Regards,
 Irfandhy Franciscus
 
 [EMAIL PROTECTED] wrote:
  Hi,
  
  Can anyone suggest some approach for this issue.
  
  thanks  regards
   -Ramudu
  
  
  -- Forwarded message --
  Date: Wed, 26 May 2004 14:52:23 +0530 (IST)
  From: [EMAIL PROTECTED]
  Reply-To: Struts Users Mailing List [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Subject: scope and presenting realtime data
  
  Hi,
  
  We are developing a web based interface (struts + jsp etc) for realtime 
  monitoring of server cpu usage.
  
  We have written a bean that will contact the server and get the current
  cpu usage and return that value. I want to plot a line graph (using
  jfreechart) with the cpu usage in Y-axis and time in X-axis.  The Graph
  need to plot the last 'N' values + the current value during each refresh.
  
  The issue is how to remember these last N values. I do not want to assign 
  session scope for this object as the end-user might monitor for more than 
  one servers and several users might be using the system at same time.
  
  How this situation is typically handled in the Struts+jsp environment.
  
  thanks  regards
-Ramudu
  
  
  -
  To unsubscribe, e-mail: [EMAIL PROTECTED]
  For additional commands, e-mail: [EMAIL PROTECTED]
 
 
 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]