-
Notifications
You must be signed in to change notification settings - Fork 19
server
Xing Yi edited this page Nov 6, 2023
·
5 revisions
SilverDict does not require much memory/CPU to run (91.3 MiB with 40 dictionaries and three morphology dictionaries, Python 3.11), but there are some techniques to improve performance and reduce memory usage in a resource-limited environment like a router or a VPS.
- Rename your existing SilverDict directories (
~/.silverdict
and~/.cache/SilverDict
) to something else, e.g..silverdict.old
. - Restart the server.
- Change the running mode to
preparation
in~/.silverdict/preferences.yaml
. This tells SilverDict to extract all resource files in advance. - Put all dictionaries you'd use into
~/.silverdict/source
. - Restart the server to apply the change in preferences.
- Run
curl http://localhost:2628/api/management/scan
to index the dictionaries, or do it in the web UI. - Run
curl http://localhost:2628/api/management/create_ngram_table
to create the ngram index, or do it in the web UI, if you want to use the ngram search (both-sides expansion). - Change
.silverdict/preferences.yaml
to your liking. - Change the filenames in
~/.silverdict/dictionaries.yaml
to reflect their paths on the target machine (user name, etc. may be different). - Fix any symbolic links in
~/.silverdict/cache/SilverDict
. - Move
~/.silverdict
and~/.cache/SilverDict
to the target machine; it is recommended to firsttar
them. - In the target machine, set the running mode to
server
in.silverdict/preferences.yaml
. - Start the server with systemd. You can find a sample unit file in the GitHub repo. It is not recommended to run the server as the root user.
- MDict dictionaries use several times more memory than other formats.
- HTML-formatted StarDict dictionaries are the best in terms of performance.
- Hunspell dictionaries use a large amount of memory, so be careful when using them, and only use them for languages you need.