jsr356-experts@websocket-spec.java.net

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

From: Bill Wigger <wigger_at_us.ibm.com>
Date: Mon, 26 Nov 2012 15:38:22 -0500

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