Issue Details (XML | Word | Printable)

Key: DERBY-2369
Type: Improvement Improvement
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Daniel John Debrunner
Reporter: Daniel John Debrunner
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Derby

NetworkServerControl.shutdown() takes at least 1.5 seconds, could be faster.

Created: 22/Feb/07 08:51 PM   Updated: 29/Jun/09 02:12 PM
Return to search
Component/s: Network Server
Affects Version/s: None
Fix Version/s: 10.3.1.4

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Licensed for inclusion in ASF works derby2369_reuse_socket.txt 2007-02-22 09:03 PM Daniel John Debrunner 2 kB

Issue & fix info: Patch Available
Bug behavior facts: Performance
Resolution Date: 24/Feb/07 09:32 PM


 Description  « Hide
The shutdown command takes at least 1.5 seconds, broken into two parts:

  - 0.5 seconds is the first sleep after the shutdown request and before the first ping to see if the server is shutdown.

  - ~1 second is the time trying to obtain a socket in order to perform the ping to see if the server is shutdown. This socket creation fails (correctly) but takes time to do so.

The socket creation time can be avoided by re-using the socket that was used to send the shutdown request.

The sleep time could be reduced by sleeping on a finer granularity, 0.5secs is a long time for a modern processor.

 All   Comments   Work Log   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Daniel John Debrunner added a comment - 22/Feb/07 09:03 PM
derby2369_reuse_socket.txt

Patch that re-uses the socket used to send the shutdown request to perform the ping to see if the server is shutdown.
Also fixes a bug where the message if the server did not shutdown in time could never be seen.
Drops around a second off the shutdown time.

Knut Anders Hatlen added a comment - 23/Feb/07 08:37 AM
The patch looks good. +1 to commit if the tests pass. One minor comment: I think "// as soon as we can't ping return" shouldn't have been moved out of the catch block since it refers to the break statement.

I assume the numbers you reported were seen on Windows? I didn't see any change in the time it took to shut down the server on Solaris (~1 second both with and without the patch), but it's a good change anyway.

Daniel John Debrunner added a comment - 23/Feb/07 03:03 PM
Thanks for the comment Knut Anders. yes i was running on windows. The patch doesn't include the second change to reduce the sleep time, that should decrease the time on Solaris.

Daniel John Debrunner added a comment - 24/Feb/07 09:32 PM
Committed revision 511353