Live data from Hacker News

Ask HN: Is it possible to have forum type community running without a database?

news.ycombinator.com

1–10 of 66 posts

Ask HN: Is it possible to have forum type community running without a database?

#1
This question came about as I've been asked to set up a very small forum type community running on a Raspberry Pi, and the thought occurred to me that statically generated websites can handle reasonable amounts of traffic whilst using relatively small amounts of resources.

So I wondered if it is possible to run a forum type community - something along the lines of [elgg][1] or [Friendica][2] - but without the MySQL or other type of database backend?

Now I may be about to get laughed at silly for asking such a daft question, but I would genuinely like to know the answer. So, does HN think something like this is possible? And if not, could you please explain why not? And if it is possible, have you got any recommendations!

Thanks in advance. E

[1]: http://elgg.org/ [2]: http://friendica.com/

Re: Ask HN: Is it possible to have forum type community running without a database?

#2
One of the main points of static sites is that they don't update terribly often. Forums, on the other hand, update constantly. You are wanting something with good caching (server side and client side), and thats about it. Otherwise, you are going to be regenerating the pages constantly on every post/update.

Re: Ask HN: Is it possible to have forum type community running without a database?

#3
You can run a community of sorts, but the feature list will be sparse. The only viable system sans-database that comes to mind is plain-text.

I'm a member of a forum that had an old system in the beginning that used plain text "database" for a very long time. Performance was fairly reasonable at 5000 visitors per day, if the daily hit counter was to be trusted. They since moved it to SQLite, which is very reliable in its own right, and now it's Postgres. It was only now that we got searching as a "feature".

The system was written originally in PHP 4.x, but they did move it to 5.x. I'm not sure what version they use now. I do know they were running ancient hardware and was up solely due to the charity of the admin.

I think there was an index file that stores new topic summaries, as there was no field for titles, when they were created.

They used microtime() as the ID, but the topics were stored by splitting it to 3 digit directories.

Seconds as 1234567890 and decimal 0.12345618 were combined to create /123/456/789/012/345618.html

There's no registration system or other way to identify the user so I believe the posts were separated by some kind of entry separator in a single file.

I think the pagination system created an array of sequential IDs and checked to see if files existed in those directories. There were no numbered links for pagination, only next/previous and if you reached the end, the next page would be blank.

There's no reason you should ever get laughed at for being curious.

Re: Ask HN: Is it possible to have forum type community running without a database?

#4
File systems are databases of some sort: there's a way of storing and retrieving data. Using the FS won't necessarily be simpler or less resource-intensive than using sqlite or something similar, because you _will_ store and retrieve data, and the helper layers you build on top of the FS will probably be less optimized than existing lightweight databases.

Re: Ask HN: Is it possible to have forum type community running without a database?

#6
you can write it to disk

you can also hold all the data in memory but when the memory is full you have to get rid of the old threads, but if your server app restarts you lose all threads

you could also use a message queue, something like firebase

Re: Ask HN: Is it possible to have forum type community running without a database?

#9
post #8

Sure. HN itself has no database, only the filesystem (or rather the filesystem is the DB).

Really, Wow. Would you mind expanding a little on how that works? I mean, is HN just stored as a series of files on a server somewhere?

Re: Ask HN: Is it possible to have forum type community running without a database?

#10
If the only requirement is to run it on a raspberry pi, and you find that a RDBMS will be too resource intensive, you can always use one of the cloud data storage services out there. Amazon has an RDS offering as part of AWS, MySQL, Postgres, etc. Then your app only needs to talk to the database over the wire with zero local resource consumption by the database.
Post reply on HN