February 11, 2008
Why choose Elephant?
Over the past few years quite a few solutions for object persistency in CL have emerged.
For my current project, I have chosen Elephant, after having looked at other popular alternatives. In this post, I’d like to talk about my reasons for choosing Elephant, taking a comparative approach. I didn’t take a look at the LW and ACL solutions since they are either not free or not portable.
Flexibility
In Elephant, I have flexibility, and in more than one way:
First, you choose your backend, and you don’t do it once and for virtual eternity. Elephant works best with Berkeley DB, but also has a performant (so I’m told) Postmodern backend, usable CL-SQL and SQLite3 backends and an experimental SEXP backend. Switching among those both in the development stage and in the production stage is (at least theoretically) easy. CL-PEREC and Submarine only work with PostgreSQL.
Second, you choose the storage model. I’m going to talk about this in a coming post, for now just accept the idea that you are in command and are able to choose the model which works best for you. Hey, doesn’t that resemble Common Lisp philosophy? :)
Third, Elephant is not an object-relational mapper. While a lot of people might that see as a disadvantage (it only stores key-value pairs at the database level). But this leads to a very flexible backend model and enables easier schema evolution.
Maturity
Elephant is used in production environments (you can read about that in the manual). The only other library being used in this way is, to my knowledge, CL-PEREC.
And in some areas of Submarine still has its still be dragons.
Liveliness
An active development and user community is vital to help you with using and hacking the library. Rucksack and CL-Prevalence don’t have that. CL-PEREC does.
Ease of use
Wow, CL-PEREC is the best negative example here. To try it, install about a dozen (no, that’s not hyperbole) packages from Darcs repositories. Then figure out from some test case output how it works. Yuk. Elephant doesn’t work out of the box either, but you only have to adapt a simple configuration file to your environment and comes with a good manual.
But ease of use is actually one of the big reasons for choosing object persistency instead of the all-popular SQL. I can just put away my objects instead of defining views, classes, relations in some DSL I don’t really wish to know details about.
Conclusion
Not mentioned here is PLOB!, which seems to me to be an unmaintained project using concepts that Elephant embodies in a clean way and expands upon.
The combination of the above factors was what drove me to use Elephant. Rucksack also seems to be sensible stuff, but it’s not mature yet (in terms of community, documentation, stability and features).
Naturally, there are some deficiencies in Elephant, but they don’t hit where it hurts. The code is a bit crufty in some spots, for example, it uses feature macros to work with the MOP instead of using a library like Closer to MOP (though that’s work in progress). It also doesn’t support advanced (semantical) schema evolution (but no other does), though it copes with slot addition and removal. When you change your storage semantices, you can convert the data manually by mapping over it.
The manual and Trac page of Elephant also state that there’s no query language, but in my experience Elephant already offers enough querying features for more purposes.
Problems being solved by none of the libraries, apart from semantical schema evolution, are function, closure and continuation serialization. But since this is Lisp you can for simple purposes just store forms and COMPILE them as needed, and there’s more than one silver lining on the horizon, see Paul’s Common Cold and David’s SB-HEAPDUMP (both SBCL-specific right now).
What are your experiences with object persistency and data storage in Lisp? I’m curious.
Comments(8)
From what you said you aren’t considering LispWorks or AllegroCommonLisp because they are not free or portable. I’m trying to understand what you mean by this.
Are you planning on changing your persistence layer at some point?
Are you concerned about the price of the tools or the fact that they are not open source?
I didn’t mean to say that I won’t talk about LW and ACL, but their solutions for object persistency.
Franz’s solution for OP is called AllegroCache and, to my knowledge, requires ACL. I have the impression that it’s an excellent solution, but I can’t afford to buy ACL right now. Plus, I have grown accustomed to SBCL.
I can’t find LispWorks’ solution for OP right now, but I dimly remember having read about it in the near past. Well, if they have one, it isn’t portable either, or chances are I would have noticed it. LW is even less affordable than ACL.
As for the “open source” argument: it’s very important to me to have access to the source code. AllegroCache might actually be open source, I don’t know.
No, I’m not planning to change my persistency layer. But changing backends is something I anticipate, since BDB is not a distributed solution.
Feel free to ask more questions.
Leslie
Hey Leslie,
very interesting post, thank you. Can you please explain your statement that “BDB is not a distributed solution”?
Victor.
Berkeley DB is not a client-server database like MySQL or PostgreSQL, it’s more like SQLite. The only thing you could do (although I imagine a host of problems) would be mounting the database files remotely. But this doesn’t really distribute any load.
I think you have the affordability of LW vs. ACL reversed.
Comparing
http://www.lispworks.com/buy/prices-1c.html
http://www.franz.com/products/packages/
shows ACL starting at 599 USD and LW at 1300 USD (for one platform!).
Did you mean something else?
The pricing of the Franz offerings is not that easily discoverable on their site. The academic license for $599 precludes the deployment of an application.
I thought that the cost of ACL and the ability to deploy applications produced using it were on the order of a few thousand dollars with a negotiable amount to be paid based on the deployment.
LW is $1300 and you can deliver applications with it.
Ah, thanks for the clarification. All the worse then for Franz ;)