Update, 2009-10-24: Fixed a bug, and committed a couple other improvements — TillStore 0.2.0 is released!
I went to nosqlberlin last week and I got inspired. I listened to a lot of interesting talks — most notably about Redis, CouchDB, Riak and MongoDB (I'm omitting two talks, which of course were not less awesome than the rest!) Due to an unfortunate circumstance I had six hours to hack on stuff from Thursday to Friday.
And here it is — I'm proud to present my very own approach to key-value stores: TillStore!
What is a key-value store?
In a nutshell, a key-value store is a database for values (Doh!). There are no duplicates, it's always a key mapped to a value. No bells and whistles — most just want to be fast. Eventually consistent is another attribute which most of them like to claim for themselves. The value term (in key-value store) is very flexible. Some key-value stores only support certain types, TillStore supports them all through JSON. ;-)
So vain, right? Well, in the beginning TillStore was an inside joke with a colleague. And to be honest, TillStore was nothing more but the following:
<?php $tillStore = array(); ?>
However, when I had time to hack away on Thursday night, I took it a slightly higher level. ;-)
What is TillStore?
TillStore is a key-value store written in PHP.
TillStore is RAM-based, and fast. By default TillStore uses
/dev/shm on Linux. If you don't happen to be on Linux, just create a RAM disk and feed it into TillStore.
TillStore is two components —
TillStore_Server component provides a simple HTTP-API to
TillStore component is unit-tested! :-)
And last but not least: TillStore is a proof of concept.
What TillStore is not.
TillStore is not production-ready, though my initial benchmark suggests that it might work for a lot of websites out there. The test was run on a Lenovo X61s notebook, duo core something, 4 GB RAM and Ubuntu 9.10 Karmic Koala (BETA).
TillStore is not persistent — at least not out of the box. TillStore can be configured to use persistent storage (e.g. a harddrive), but I guess that's when it'll start loosing speed. If you happen to care about the data you store in TillStore, please run a cronjob.
TillStore is not bug free. Especially my HTTP-API needs work. ;-) It tends to choke on complex JSON structures. So JSON is not yet support using the HTTP-API. I also need to clean-up my socket binding and the configuration part.
TillStore's configuration is not very flexible. I realize that part needs some work.
How do you get TillStore?
The code is currently on
0.1.0 (alpha) and hosted on Github.
It's do-what-you-want-licensed (The new BSD License!).
Installation — that's the easy part: it's all in INSTALL.md. There are a few more additions in git already (99.999999999% cosmetics) and I plan to iron out some bugs before I do
Running TillStore is easy as well. If you followed one of the PEAR-ways to install, just execute /usr/bin/TillStore and it will start up and bind itself to
localhost and port
Then curl some URLs, e.g.
... attempts to fetch the key
curl -X POST -d bar http://localhost:31337/foo
... saves the value
bar into the key
foo. (Get it? key-value
save store!) :-)
I'd like feedback on the idea. :-) Of course I encourage everyone to fork it and break it.
The author does not allow comments to this entry