dbTalk Databases Forums  

Using recno as a queue; alternative for consume()?

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


Discuss Using recno as a queue; alternative for consume()? in the comp.databases.berkeley-db forum.



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

Default Using recno as a queue; alternative for consume()? - 02-01-2005 , 07:38 PM






Hi gang,

I'm putting together an application which queues messages in the
case of a communications failure/delay. I want that queue to be
reliable in the case of failure (machine reboot, process crash,
etc) so I've been playing with Berkeley DB.

Ideally I'd use a Queue, but the messages are of variable length.
So, I've been using a Recno. Is there a better alternative?

Specifically, I want consume(). Is there a best practice to
simultaneously read (in insertion order) and delete a record from
a Recno db?

This will be a multi-treaded app (in Python, whee).

Thanks!

--
__________________________________________________ _____________________
Marco E. Nicosia | http://www.escape.org/~marco/ | marco (AT) escape (DOT) org

Reply With Quote
  #2  
Old   
ubell@sleepycat.com
 
Posts: n/a

Default Re: Using recno as a queue; alternative for consume()? - 02-03-2005 , 04:45 PM






Marco,

One thing you can consider is to use a queue sized big enough for
your "typical" record and then use a btree to handle records which
are too big to fit in the queue indexed by their queue record number.
If most of your record are "typical" or less in size then you get
the advantage of the queue and little contention in the btree.

You would need to have some format information in your queue
data so you can tell what the real size of the record is and if you
have to read the btree.

RECNO has relatively poor concurancy since the whole tree
must be locked on updates so that record numbers can be
maintianed in the tree.

Michael Ubell
Sleepycat Software.


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 - 2013, Jelsoft Enterprises Ltd.