[odb-users] Questions about accessing database in parrallel(PPL library) using odb

Boris Kolpackov boris at codesynthesis.com
Fri Nov 2 08:01:03 EDT 2018

Music samal <zxbzswxr at gmail.com> writes:

> the ouput is somewhat puzzle to me,
> let me list the output here
> serial time : 406ms
> parrallel time : 2610ms
> two Task time: 359ms
> parrallel_for_each presents terriblely unacceptable result .Something must
> limit its performance. I tended to my friends for help , he told me may be
> it's the database connection ,not transaction that impacts the parrallel
> access performance.. so I just tried the third scene, I use two database
> variable for connection independently in task, the performace really
> improved. Really is the database connection the main factor impose the
> parrallel accessing perfomance?

The database instance in ODB by default uses a connection pool so it
should not matter whether you have one or two.

I think the reason for poor parrallel_for_each performance lies in
the way it is implemented, which is unclear. For example, if it
tries to execute all 100 transactions simultaneously (e.g., from
100 different threads), then that would probably explain the result
you are getting (due to high contention).

More information about the odb-users mailing list