Details
-
Feature Request
-
Resolution: Done
-
Major
-
None
-
None
-
0
-
0%
Description
New service which provides wall clock time at a coarse (configurable) granularity.
Motivation: System.currentTimeMillis() or System.nanoTime() is sometimes called frequently, e.g. by TCPConnectionMap$TCPConnection.updateLastAccessed() or in FD/FD_ALL. This has a cost, especially when a lock is held (system calls while a lock is held cause preemption and the thread losing its time slice).
However, the 2 examples above don't need the exact time, but an approximation of it is OK.
GOALS:
- Provide a time service which returns the last cached value of System.timeCurrentMillis()
- This is a quick and efficient call
- TimeService registers a timer task which updates its internal cached value every N milliseconds (configurable), e.g. every 500 ms
BENEFIT:
For example, in TCPConnection, the timestamp is updated whenever we send or receive a message from the peer. The timestamp is used to expire and close a connection (if configured), and can be updated 100'000 times a second. If the time service provided the current time in ms every 500ms, then System.currentTimeMillis() would only be called 2 times during a second instead of 100'000 times !
Attachments
Issue Links
- relates to
-
JGRP-1764 TCPConnectionMap$TCPConnection: update time stamp only if connection reaping is enabled
- Resolved