Derby
  1. Derby
  2. DERBY-3882

Expensive cursor name lookup in network server

    Details

    • Type: Improvement Improvement
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 10.4.2.0
    • Fix Version/s: 10.6.1.0
    • Component/s: Network Server, SQL
    • Labels:
      None
    • Bug behavior facts:
      Performance

      Description

      I have sometimes seen in a profiler that an unreasonably high amount of the CPU time is spent in GenericLanguageConnectionContext.lookupCursorActivation() when the network server is running. That method is used to check that there is no active statement in the current transaction with the same cursor name as the statement currently being executed, and it is normally only used if the executing statement has a cursor name. None of the client-side statements had a cursor name when I saw this.

      The method is always called when the network server executes a statement because the network server assigns a cursor name to each statement even if no cursor name has been set on the client side. If the list of open statements is short, the method is relatively cheap. If one uses ClientConnectionPoolDataSource with the JDBC statement cache, the list of open statements can however be quite long, and lookupCursorActivation() needs to spend a fair amount of time iterating over the list and comparing strings.

      The time spent looking for duplicate names in lookupCursorActivation() is actually wasted time when it is called from the network server, since the network server assigns unique names to the statements it executes, even when there are duplicate names on the client. It would be good if we could reduce the cost of this operation, or perhaps eliminate it completely when the client doesn't use cursor names.

      1. Cursors.java
        1 kB
        Knut Anders Hatlen
      2. check_hash.diff
        2 kB
        Knut Anders Hatlen

        Activity

        No work has yet been logged on this issue.

          People

          • Assignee:
            Knut Anders Hatlen
            Reporter:
            Knut Anders Hatlen
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development