have reviewed/committed this patch as svn
 357275.
Knut Anders Hatlen (JIRA) wrote:
     [ http://issues.apache.org/jira/browse/DERBY-733?page=all ]

Knut Anders Hatlen updated DERBY-733:
-------------------------------------

    Attachment: DERBY-733-more-exception-handling.diff

Attached patch (DERBY-733-more-exception-handling.diff) that addresses
Mike's concerns for exception handling. If something goes wrong when
locking, Derby will now fall back to the old behaviour.

Derbyall ran without failures.

% svn stat -q
M      java/engine/org/apache/derby/impl/store/raw/data/RAFContainer.java


Starvation in RAFContainer.readPage()
-------------------------------------

        Key: DERBY-733
        URL: http://issues.apache.org/jira/browse/DERBY-733
    Project: Derby
       Type: Improvement
 Components: Performance, Store
   Versions: 10.1.2.1, 10.2.0.0, 10.1.3.0, 10.1.2.2
Environment: Solaris x86 and Linux with Sun JVM 1.5.0. Derby embedded and 
client/server.
   Reporter: Knut Anders Hatlen
   Assignee: Knut Anders Hatlen
Attachments: DERBY-733-more-exception-handling.diff, DERBY-733.diff, 
Insert.java, Select.java

When Derby is completely disk bound, threads might be starved in
RAFContainer.readPage(). This is a real problem when multiple clients
are repeatedly accessing one or a small number of large tables. In
cases like this, I have observed very high maximum response times
(several minutes in the worst cases) on simple transactions. The
average response time is not affected by this.
The starvation is caused by a synchronized block in
RAFContainer.readPage():
 synchronized (this) {
     fileData.seek(pageOffset);
     fileData.readFully(pageData, 0, pageSize);
 }
If many threads want to read pages from the same file, there will be a
long queue of threads waiting for this monitor. Since the Java
specification does not guarantee that threads waiting for monitors are
treated fairly, some threads might have to wait for a long time before
they get the monitor. (Usually, a couple of threads get full throughput
while the others have to wait.)



Reply via email to