Concurrent database query benchmark
Alex Averbuch
alex.averbuch at neotechnology.com
Tue Jun 7 16:32:14 UTC 2016
Thanks Jens,
That was the clue I needed.
The example I shared was a slightly simplified version of the actual
benchmark, which populates the database as below.
I was missing the *tx.close()* line.
* void populateDb( Database db )*
* {*
* Transaction tx = db.beginTx();*
* try*
* {*
* for ( int i = 0; i < RECORD_COUNT; i++ )*
* {*
* db.createRecord();*
* if ( i % TX_SIZE == 0 )*
* {*
* tx.success();*
* tx.close(); //<---- THIS WAS MISSING*
* tx = db.beginTx();*
* }*
* }*
* tx.success();*
* }*
* finally*
* {*
* tx.close();*
* }*
* }*
On Tue, Jun 7, 2016 at 6:17 PM, Jens Wilke <jens.wilke at headissue.com> wrote:
> On Tuesday 07 June 2016 17:24:09 Alex Averbuch wrote:
> > When inspecting the database in *TxState.setUp()* I find that
> > *System.identityHashCode(db)* is always the same, as is the path to the
> > database, so I assume it is the same store -- a good thing.
> > However, *db.getRecordById( id )* then fails due to empty database -- a
> bad
> > thing.
> >
>
> I don't know what database you are using here. Is tx.success() really
> committing your initial population?
>
> Probably you see the content in one thread because the transaction joins
> your still open transaction for population,
> but the transactions in the other threads see nothing, of course.
>
> The general approach for the benchmark looks good!
>
> Cheers,
>
> Jens
>
> --
> "Everything superfluous is wrong!"
>
> // Jens Wilke - headissue GmbH - Germany
> \// https://headissue.com
>
More information about the jmh-dev
mailing list