Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a way to unload a wiki from memory. #31

Closed
inmysocks opened this issue May 13, 2018 · 5 comments
Closed

Add a way to unload a wiki from memory. #31

inmysocks opened this issue May 13, 2018 · 5 comments

Comments

@inmysocks
Copy link
Member

This could be important for long running servers with lots of child wikis. I think that either a button to explicitly unload the wiki on the root wiki or perhaps something that unloads it automatically after some amount of time with no connections to that wiki.

@MichaelZoerner
Copy link

Why should the server hold an unconnected wiki in memory at all?

Apart from that you could probably use an LRU algorithm to hold only n (unconnected) most recently used wikis in memory. n should be configurable in the settings. Perhaps something like this?

Just 2 cents from a thankful Bob user.

@inmysocks
Copy link
Member Author

Loading a wiki takes a non-trivial amount of time on low power hardware so it can save a lot of time if you don't want to keep a wiki open constantly but have to access it regularly. Loading tiddlers from one wiki into another wiki (which is a planned feature) require the tiddlers to be loaded so that means that a wiki must be at least partially loaded into memory even if there are no live connections to it.

Also before this there was no way to unload a wiki from memory so every wiki that had been opened since the server started was kept in memory.

I think that an LRU algorithm could be a better way to handle automatically pruning loaded wikis. I haven't given it too much thought and it will probably come down to implementation complexity. LRUs have the benefit of having an event to trigger it on (loading a new wiki triggers a check to look at unused wikis) so that is a benefit.

@MichaelZoerner
Copy link

I understand that loading big wikis from weak hardware can take a long time. While I am using Bob on a raspberry pi, my wikis are still relatively small. Thanks for the clarification and for considering LRU.

@inmysocks
Copy link
Member Author

This is more a note for me than anything else.

One reason there has to be a delay between a wiki becoming unconnected and removing it from memory is that when you reload a wiki it establishes a new websocket connection. So depending on network and server load there may be times when the wiki could be marked as unconnected and the process of unloading it could start before the new connection is established.

This isn't a problem using an LRU algorithm but it would give some minimum time using TTL values.

@inmysocks inmysocks mentioned this issue Jul 11, 2018
@inmysocks
Copy link
Member Author

The unloadWiki message is added now, but there is no automatic pruning yet. I will start a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants