dbTalk Databases Forums  

multiple db vs 2 processes

comp.databases.berkeley-db comp.databases.berkeley-db


Discuss multiple db vs 2 processes in the comp.databases.berkeley-db forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
sandy
 
Posts: n/a

Default multiple db vs 2 processes - 01-12-2006 , 04:52 AM






Hi

I have 4 databases(4 db files) and 2 processes accessing them.
All db are in the same directory.

process 1 access db1, db2, db3(just for easy naming) in read/write
mode.
It has nothing to do with db4 at all.

process 2 access db1, db2, db3 in read mode and db4 in read/write mode.

As far as I understood, there will be 2 separate environemnts each for
one
process. Also, checkpoint is done per environemnt and not just
individual db.

I want process 1 to checkpoint only those dbs it writes to and same for
process 2.

Can this be achieved in any way. I am stuck in this design issue for my
first BDB project.
Thanks in anticipation.

~Sandy


Reply With Quote
  #2  
Old   
sandy
 
Posts: n/a

Default Re: multiple db vs 2 processes - 01-16-2006 , 12:58 AM






Can anybody throw some light on it. Its somewhat urgent.

thanks
Sandy


Reply With Quote
  #3  
Old   
Dave
 
Posts: n/a

Default Re: multiple db vs 2 processes - 01-16-2006 , 03:01 AM



Sandy,

There are a couple of ways that you can do this:
a- A single shared environment, which both processes use that provides
shared access to all 4 databases.
b- Two environments:
* EnvironmentA, shared by both processes, which provides access to
db1, db2 and db3 (since there are mulitple processes involved, you need
them to share an environment),
* EnvironmentB, used only by process 2, which provides access to
db4.

If you choose the 2 environment design, you need to be aware that
transactions can't span environments. So, process2 can't include
operations on db1, db2, db3 and db4 in the same transaction (assuming
that you are using transactions). Also, if you are using transactions,
then you much make sure that each environment places the transaction
log in a different directory. If not, then both environments will
attempt to write to the same transaction log and log corruption will
occur.

I'm not sure why managing checkpoints separately is a design goal,
unless process1 and process2 are both write intensive processes and you
are trying to separate the checkpoint disk I/O so that one process will
not affect the other. Without understanding more about your
application, I can't comment on whether this is a useful exercise or
just a complication. You might try implementing the application using a
single environment which provides access to all for databases. If you
run into
disk I/O and checkpointing issues, it's easy enough to introduce a
second environment for db4 into process2 at a later time.

Hope that helps.

Regards,

Dave


Reply With Quote
  #4  
Old   
sandy
 
Posts: n/a

Default Re: multiple db vs 2 processes - 01-16-2006 , 11:29 PM



Hi Dave

Thank you very much. This is my first project in BDB.
Actually I am trying to use a embedded database option
instead of the flat file datastore that we have today.

So, here's a little insight into my exercise.

Today we have 2 separate java processes. Process 1(let's
call it P1) writes into file F1, F2 and F3. Process 2, P2 writes
into file F4. P1 informs P2 of any changes in those 3 files to
P2 through RMI and that's how P2 has all the information about
those 3 files. P1 does not need to know anything about D4.

Now, I am trying to move those 4 files to BDB keeping the semantics
of the whole software same. So, naturally I have 4 DBs, D1, D2, D3, D4.

Now, with P1 I have created an environment E1 with D1, D2, D3 opened
in r/w mode. With P2 I have created another environment E2 where I have
opened D1, D2, D3 in r mode and D4 in r/w mode.
I am still confused as why I should bother about checkpointing D1,D2,D3
from P2, becoz checkpointing is done per env and not per db.

I'll really appreciate if you can guide me with this design dilemma.

Thanks
Sandy


Reply With Quote
  #5  
Old   
sandy
 
Posts: n/a

Default Re: multiple db vs 2 processes - 01-20-2006 , 05:32 AM



Hi Dave or anybody else, any answer for this design:-)


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.