Help reducing RAM usage when serving multiple tiddlywikis

157 views
Skip to first unread message

Enrico Guiraud

unread,
Dec 20, 2019, 10:59:31 AM12/20/19
to TiddlyWiki
Hi all,
big fan of tiddlywiki (I routinely use 3, hosted on a VPS) and recently I started advertising it to my friends.
To get more people into tiddlywiki, I just set them up for them on my VPS.

The problem: I'm now serving an average of 5-6 tiddlywikis, and my little VPS is almost out of RAM: each tiddlywiki server uses 110 MB or more. That's _a lot_, isn't it?

Can anyone suggest ways to reduce memory usage when serving multiple tiddlywikis?

Would it be possible to have one server serve different wikis on different paths (and if so, would it help)?


Does anyone know what causes the large memory usage and whether it can be optimized? I would be willing to put some hours into this -- am a developer, but don't know much about javascript.


Cheers,

Enrico

Jeremy Ruston

unread,
Dec 20, 2019, 3:19:18 PM12/20/19
to tiddl...@googlegroups.com
Hi Enrico

TiddlyWiki under Node.js loads the entire wiki into RAM. It does so in order to support server-side processing (such as serverside page rendering). But, of course, it is relatively resource intensive, and unnecessary if all the server is doing is acting as a front end to a database of tiddlers, and the browser is doing all the rendering.

Arlen Beiler recently did some exploration along these lines recently:


Best wishes

Jeremy



On 20 Dec 2019, at 15:59, Enrico Guiraud <enrico....@gmail.com> wrote:


--
You received this message because you are subscribed to the Google Groups "TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/e9d9e0d4-3d54-462a-af72-4bcb92d2c268%40googlegroups.com.

Enrico Guiraud

unread,
Dec 20, 2019, 3:28:10 PM12/20/19
to tiddl...@googlegroups.com
Hi Jeremy,
tiddlywiki uses 110MB of RAM to serve an empty tiddlywiki.

The total size of all wikis that I need to serve is currently less than 15MB. I'm perfectly ok with all tiddlers being loaded in memory.
What I find weird is that every server I spin up has an overhead of 110+ MB, and I'm looking into ways to reduce that.

Cheers,
Enrico

Jed Carty

unread,
Dec 20, 2019, 4:14:28 PM12/20/19
to TiddlyWiki
When you use the normal node server it creates a new node process for each one, that is why I made Bob just create a new wiki object. I have a little raspberry pi 2 serving 20 or 30 node wikis without trouble using Bob.

Mark S.

unread,
Dec 20, 2019, 4:20:18 PM12/20/19
to tiddl...@googlegroups.com
I've noticed that when opening up a TW file in a browser, it takes a lot more memory (10x) than the original TW file. I suspect that there is a lot of stuff that has to be "unpacked" into memory. By extension, the same thing probably happens inside of a node running tw.

Enrico Guiraud

unread,
Dec 20, 2019, 7:24:57 PM12/20/19
to TiddlyWiki
Hi Jed,
I have looked at Bob a bit today, thanks. I hoped there might have been another solution because Bob looks definitely overkill for my needs, it does _so much_ (credit to you!) and I would like a more minimal setup.
So far I could not figure out how to have Bob serve my.domain/tiddly1 and my.domain/tiddly2 as separate wikis from behind an apache reverse proxy, but I guess that's off topic in this thread :) (I have seen the example here.

Cheers,
Enrico

cs8425

unread,
Dec 24, 2019, 3:58:03 AM12/24/19
to TiddlyWiki
Hi,
maybe you could try my port version of widdly: https://github.com/cs8425/widdly
It was written in golang, and have 3 different type of  backend storage.
But not yet serve different wikis on different paths.
I'm not sure I had enough time to done this feature, but you can still using a reverse proxy to redirect each path to different widdly instance.

Or if you did not mind the bandwidth, than you can simply use any WebDAV server to host tiddlywiki. (will upload whole html file on each save)
here are a simplest http server that can serve tiddlywiki: https://github.com/cs8425/go-smalltools/blob/master/network/httpd.go
You may need to add some authentication methods by yourself.

I hope these would help you. :)

Enrico Guiraud於 2019年12月20日星期五 UTC+8下午11時59分31秒寫道:

Chuck R.

unread,
Dec 28, 2019, 8:34:07 AM12/28/19
to TiddlyWiki
On Friday, December 20, 2019 at 4:14:28 PM UTC-5, Jed Carty wrote:
When you use the normal node server it creates a new node process for each one, that is why I made Bob just create a new wiki object. I have a little raspberry pi 2 serving 20 or 30 node wikis without trouble using Bob.

Does the Pi 2 have 1GB or 2GB of RAM?
Reply all
Reply to author
Forward
0 new messages