OODB Storage Options and Performance

Daniel Salama dsalama at user.net
Wed Apr 13 23:47:27 UTC 2005


On Apr 13, 2005, at 7:16 PM, Chris Muller wrote:

>
> Daniel, if you trying to evaluate for potential application 
> performance you
> probably want to isolate the portions that are important to you and 
> time them
> individually.  What if one db takes 15 seconds to connect, 15 to 
> disconnect,
> but can do all the commits in 1 second for total of 31 seconds.  And 
> another db
> connects and disconnects in 5 seconds but takes 10 seconds to do the 
> commits.
> The results would show the second one as the "faster" choice, but since
> connecting is probably done infrequently compared to commits, it may 
> skew your
> interpretation of the results.

Agree.

> You also probably want to know how fast each option *can* go with the
> inefficiencies removed from the bench-script.  This script is 
> retrieving the
> root over and over again unnecessarily.  Remember, with Magma you have 
> a "live"
> view of the db so you don't need to keep getting the root to have the 
> latest
> data, all objects are refreshed on every transaction boundary.

Like I said. I'm open to suggestions and criticism regarding improving 
my code. The concern I had was, what happens if I don't re-read the 
root but someone else (another remote user) modifies the contents of 
it. Will I automagically get a refreshed copy of the content or do I 
have to re-read the root? I was assuming the worse case scenario in 
which remote users are modifying the same data so I was re-fetching the 
latest and freshest copy of it.

>
>> The Magma code looked like this:
>>
>> time:= Time millisecondsToRun:
>> [Transcript cr..
>> db := MagmaSession hostAddress: #(127 0 0 1) asByteArray port: 51969.
>> db connectAs: 'dsalama'.
>
> Ok, just for a baseline, when I run this exact script on my computer I 
> get
> 57.182 seconds; so my 1.3GHz Thinkpad with 768MB RAM must be just a 
> little
> faster than your Powerbook G4 1.5GHz with 1GB RAM.

It could be that either your machine is faster or the VM implementation 
of the X86 platform is better optimized than mine.

>
> The timing on my machine when not retrieving the root unnecessarily is 
> 51.097
> seconds, so not a lot faster.
>
> However, turning on WriteBarrier, the results are considerably better, 
> 30.505
> seconds.  Here's script modified which gives this result:
>
> time:= Time millisecondsToRun:
> [Transcript cr..
> db := MagmaSession hostAddress: #(127 0 0 1) asByteArray port: 51969.
> db connectAs: 'dsalama'.
> db preferences allowWriteBarrier: true.
> db commit:
> 	[db root at: 'Sequences' put: (Dictionary new)].
> base := db root at: 'Sequences'.
> db commit:
> 	[base at: 'CustomerNo' put: 0].
> commitTime _ Time millisecondsToRun:
> [ [0 to: 999 do:
> 	[:i|
> 	(i \\ 100) = 0 ifTrue: [Transcript show: '.'].
> 	nextCustomerNo := (base at: 'CustomerNo') + 1.
> 	db commit: [base at: 'CustomerNo' put: nextCustomerNo].
> 	]] ensure: [db disconnect]] ].
>
> Transcript cr; show: (time/1000) asFloat; show: ' seconds'.
> Transcript cr; show: 'commit time: '; show: (commitTime/1000) asFloat; 
> show: '
> seconds'.
> db := MagmaSession hostAddress: #(127 0 0 1) asByteArray port: 51969.
> db connectAs: 'dsalama'.
> base := db root at: 'Sequences'.
> Transcript cr; show: 'Last Customer No: '; show: (base at:
> 'CustomerNo').
> db disconnect.

I didn't know that's how you're supposed to use WriteBarrier. I 
installed the package and thought that was all I needed. I ran your 
same code again and the results were:

Total execution: 48.874 seconds
Commit time: 35.987 seconds

I guess the performance increased by a factor of ~2. Still, slightly 
slower that your results, but much better overall. This is still an 
order of magnitude slower than OmniBase. Then I made a couple of 
changes to your script (namely used BTree instead of Dictionary, 
alternate method of committing the transaction, and stopped reading the 
root every time) and was able to shave a few more seconds.

time:= Time millisecondsToRun:
[Transcript cr..
db := MagmaSession hostAddress: #(127 0 0 1) asByteArray port: 51969.
db connectAs: 'dsalama'.
db preferences allowWriteBarrier: true.
db commit:
	[db root at: 'Sequences' put: (BTree new)].
db commit:
	[(db root at: 'Sequences') at: 0 put: 0].
base := db root at: 'Sequences'.
commitTime _ Time millisecondsToRun:
[ db begin. [0 to: 999 do:
	[:i|
	(i \\ 100) = 0 ifTrue: [Transcript show: '.'].
	base at: 0 put: ((base at: 0) + 1).
	db commitAndBegin.
	]] ensure: [db disconnect]] ].

Transcript cr; show: (time/1000) asFloat; show: ' seconds'.
Transcript cr; show: 'commit time: '; show: (commitTime/1000) asFloat; 
show: '
seconds'.
db := MagmaSession hostAddress: #(127 0 0 1) asByteArray port: 51969.
db connectAs: 'dsalama'.
base := db root at: 'Sequences'.
Transcript cr; show: 'Last Customer No: '; show: (base at: 0).
db disconnect.

Total execution: 34.628 seconds
Commit time: 28.968 seconds

Anyway, I'd be interested in knowing more about my question above 
regarding having to re-read the root every time.

Thanks,
Daniel




More information about the Squeak-dev mailing list