Hi Bjorn!
On Nov 11, 2008, at 19:02, Burobjorn wrote:
My name is Bjorn Wijers and I recently started to play with couchdb.
It's a very interesting project and I would like to use it to
rewrite an
older project called Simuze[1], but I wonder if couchdb would be the
right tool for the job. Perhaps some of you can help me out in
understanding the pro's and con's of using couchdb for this?
Simuze is musicplatform (website) for musicians and music fans by
non-profit Stichting (=Foundation) Open Media. Artists can upload
their
music under a Creative Commons license of their choosing and music
lovers can download these songs from the site. It was built quite some
time ago in PHP and MySQL.
Personally, I think this is a cool app :)
The basics in this application are:
- users
- profiles (might be multiple per user, since a user may have more
than
one artist persona)
- media files (images and audio for now)
- media collections (such as a playlist or album)
- ratings (every media file or collection)
- tags (everything)
Our objective is to rewrite Simuze in such a way that we can
distribute
it as an 'easy' to install webapplication under a free/open-source
license (Affero GPL). We would like to connect all the different
Simuze
installs (replication would be very helpful for this, I guess) and
create a distributed free (as in CC licensed and PD) music web.
Think of
it as a non-suck MySpace built by musicians ;)
So far, this sounds like a good use-case for CouchDB.
Some questions that I have are:
1) Would this type of application be suitable for couchdb or is this
better suited by using a RDBMS?
I don't think an RDBMS has an advantage over CouchDB considering the
data. Things might look a lot different from what you are used to, but
it
will all come together and be easier in the end.
2) Could we use the attachment feature for adding media files (FLAC or
WAV or AIFF files roughly 50 MB per file) to couchdb? Or is this not
advisable given the size of the files? The reasoning behind this is
that
by using replication we can easily backup the whole system or setup an
another node of it. Therefor having everything in one place seems
like a
good idea?
There is no limitation (ok, currently it is 4GB, but that is
adjustable) on
how big a a document attachment can be. Using replication for backup
is a good idea.
3) In a RDBMS such as MySQL I can use foreign keys to preserve data
integrity. In other words I can delete the user and due to the foreign
keys 'automatically' remove its profile(s), uploaded media etc. How
would one solve this with couchdb?
With CouchDB you can only make "loose references" and CouchDB does
not do cascading deletes. But a two-request process helps you there:
1) Get all docs for a certain property
2) Send a bulk delete request with the previous result
Yes, this is not as convenient and there's a potential race condition,
but
this is easily solvable.
Thanks for reading this rather lengthy email. Looking forward to the
thoughts and comments on this.
I'd say: Go for it.
Feel free to send any follow-up question.
Regarding PHP libraries to use, I'd recommend
http://kore-nordmann.de/projects/phpillow/index.html
Cheers
Jan
--