Friday, February 13, 2009

RESTing on the Couch - adjusting my CouchDB experiment

As I was playing with my son - a great way to let the right brain chew over a problem - I came up with a different architecture for my memcache/CouchDB experiment, one that I think makes more sense.

Rather than have a traditional PHP front-end, I realized that I need to follow the model I've been espousing for a while now. The server interface, rather than being HTML/browser-centric, is instead a REST web service. The client could be HTML, but I think my first representation of a REST resource will be JSON, and the client user interface will initially be written in JavaScript. Subsequent clients could be written in JavaFX or Flex or Silverlight or an Apache/PHP server, mine or somebody else's... Exercises left to the reader, or to myself time permitting.

Tempting as it may be ("hey, CouchDB is REST with JSON!"), I'm not going to expose CouchDB REST directly to the clients. In general I think it's dangerous (architecturally) to expose your database directly to clients.

Instead, I'm going to put a middleware layer on top so I can do clustering and caching, and also so I can swap in a different caching and storage mechanisms.

Another solution I'd like to try is Gigaspaces, but I'm getting ahead of myself...

1 comment:

Tim Dysinger said...