jsr356-experts@websocket-spec.java.net

[jsr356-experts] Re: [jsr356-users] getInactiveTime() method removal from API

From: Danny Coward <danny.coward_at_oracle.com>
Date: Tue, 04 Dec 2012 17:17:47 -0800

Hi Bill,

Thanks for the reminder on this one. We're really just modeling what's
on HttpSession in this regard, do people find the analogous call on
HttpSession a big performance hit there ? If the load per second is so
high, wouldn't the implementation mark it less frequently ?

- Danny

On 11/26/12 12:38 PM, Bill Wigger wrote:
>
> On the Session object is this method:
>
> long getInactiveTime()
> Return the number of seconds since the underlying connection had
> any activity.
>
> I think this is an unnecessary performance burden to place on the
> server. For example, say there are 10,000 active WebSocket
> connections, then for each session, whenever a read or write takes
> place, the timestamp has to be obtained and stored away. Depending on
> the implementation, that could be 1000's of timestamp calls per
> second. On some OSes reading the timestamp is a performance drag to
> be avoided. Also, if on a given connection 10,000 reads and/or writes
> occur, and the "getInactiveTime()" is never called, then that is
> 10,000 wasted readings of the timestamp.
>
> Also, the return value is not very accurate, and can not be trusted,
> since the moment after getActiveTime is read, it could be outdated by
> an new read or write taking place.
>
> If users want this functionality it is easy enough for them to add it
> to their own code, since their code is responsible for reading and
> writing data, but I don't see making all connections take this
> performance hit, for something that may rarely get used, and whose
> return value cannot be trusted to be up to date once obtained.
>
> can we get rid of this method all together?
>
> regards,
> Bill
>


-- 
<http://www.oracle.com> 	*Danny Coward *
Java EE
Oracle Corporation