INSERT Performance Improvements

From: Andrus (andru..bjectstyle.org)
Date: Mon Apr 29 2002 - 22:53:28 EDT

  • Next message: Andrus: "CayenneModeler GUI kicks a.."

    Just wanted to share the information about some performance improvements I
    just checked in.

    Our little performance test suite shows that inserting big numbers of
    objects via Cayenne is a very slow operation. It was usually 7 to 10 times
    slower than straight JDBC calls performing the same operation.

    Not anymore...

    1. I added database specific mechanisms to do primary key generation
        - sequences in Oracle (makes everything 50% faster)
        - stored procedures in Sybase (makes everything 20% faster)

    2. Following Andriy's suggestion I was able to achieve even stronger effect
    by caching primary keys on the client (I wonder how WebObjects team have
    never guessed that, and for optimization used some weird things like client
    generated binary PK's ??). Anyway, this approach fetches primary keys for
    each entity in batches and stores a range of keys in memory (range is just
    two "int" values so no memory increase).

    Speedup of the overall insert operation achieved by client caching is
    50-70% (on top of the one achieved before) - much more than I expected.
    Also it is interesting that increasing the size of PK batch above 15-20
    keys has no effect on performance whatsoever. I guess after that primary
    key generation stops to be a real bottleneck.

    Andrus



    This archive was generated by hypermail 2.0.0 : Mon Apr 29 2002 - 22:53:03 EDT