Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Persistent storage and stability of Marshal?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-12-27 (08:34)
From: David MENTRE <dmentre@l...>
Subject: Persistent storage and stability of Marshal?

I need to implement some kind of persistent storage in my application
(demexp web proxy part and demexp server part), so I'm looking at the
different possible alternatives.

Roughly, I've found:

 - Dbm standard module of OCaml: file storage, no external dependency,

 - Berkeley DB 4.x interface[1]: file storage, seems safe;

 - SQL database[2]: real database, complicated to setup, safe.

Right now, I don't have big needs: few tables of moderate size (below
100,000 records) so I'm in favor of simple solutions: Dbm or Berkeley DB
(no need to setup an external SQL server). I need to lookup values
through known keys. The key and stored data are simple records of
strings and integers. In the future, I might need to lookup rows
according to certain field value.

Looking at code using Berkeley DB, I noticed that stored key and data is
made using the Marshal module. However, Marshal doc says that
marshalling is "compatible across all machines for a given version of
Objective Caml", so there might be issues when changing OCaml version. 

So my questions:

 1. Is the Marshal module that much unstable? I have the feeling that
    marhsaled values are compatible between OCaml releases. True or

 2. Any advice on implementing persistent storage? I know about Persil
    library[3] but I don't see much advantage of using it (does it
    implement its own marshaling, more stable than Marshal?).

Best wishes,


[2]  OCamlDBI:


pub  1024D/A3AD7A2A 2004-10-03 David MENTRE <>
 5996 CC46 4612 9CA4 3562  D7AC 6C67 9E96 A3AD 7A2A