Ask PG: Database, flat files or other for YC News?
I know that you wrote that you used flat files for Viaweb. I was wondering if you were still doing that for YC News, if you had broken down and started using a database or rolled your own data store with Arc.
(
13 comments
| 24 points
| on HN
)
It doesn't matter it is in Erlang - you can do it in any language. A Lisp that implements software transactional memory is Clojure (runs on the JVM): http://clojure.sourceforge.net/
The answer to your specific question, though, is that I wouldn't try. News isn't written like banking software.
[1] http://www.zope.org/Products/StandaloneZODB
[2] http://www.mems-exchange.org/software/durus/
As for persisting transactions, you could marshall to file the deltas for each transaction, and on regular intervals apply them to the full image to create an up-to-date image.
You may try using a single thread and cooperative multitasking. It helps if your language makes this convenient, e.g., Stackless Python or Scheme:
http://news.ycombinator.com/item?id=45561
Just remember to yield every now and then if you do anything lengthy. Depending on your application, it may not be that bad, and if you don't need anything fancier in the way of scheduling fairness, it makes your life really simple.
For those that wonder what we're wittering on about, visit http://www.cs.kent.ac.uk/teaching/07/modules/CO/6/31/slides/ and read these PDF slides in this order.
Ignore the crufty Occam (Transputer anyone?) syntax, just concentrate on the concepts. Although some of the PDFs seem to have many pages, often a page is the same as the previous with a minor change; they're slides!Link?