Startup takes 4 minutes on Ubuntu 15.10 wily
Starting up the Linux client always took a minute or two, but nowadays it takes around 4 minutes on my machine.
wigy@xxxx:~/bin/ZeroNet$ ./zeronet.py
- Starting ZeroNet...
[14:06:04] - OpenSSL loaded, version: 01000204F
[14:06:04] - Version: 0.3.7 r1210, Python 2.7.10 (default, Oct 14 2015, 16:09:02)
[GCC 5.2.1 20151010], Gevent: 1.1b1
[14:06:04] - Creating FileServer....
[14:06:04] TorManager Tor controller connect error: error: [Errno 111] Connection refused in TorManager.py line 154 > _socket2.py line 186
[14:06:04] - Creating UiServer....
[14:09:51] - Removing old SSL certs...
[14:09:51] - Starting servers....
[14:09:51] Ui.UiServer --------------------------------------
[14:09:51] Ui.UiServer Web interface: http://127.0.0.1:43110/
[14:09:51] Ui.UiServer --------------------------------------
[14:09:52] FileServer Checking port 15441 using portchecker.co...
[14:09:53] FileServer [OK :)] Port open: Port 15441 is open.
Has anyone experienced this on other systems as well? Any hints what might happen just before removing the old SSL certs?
The root of the problem is currently it's need to load every content.json on startup. (if you start it using --debug or check log/debug.log you will see the load time per site) So if you have many site added and running the client from hdd it could take some time. (SSD performs better on loading many, small files)
There is multiple possibility to solve this:
- Lazy load content.json files to memory (only when requested by the client eg. need to verify a changed file). I have already made it working as experiment and it's also dramatically reduces the memory usage (80MB->40MB), but there is some command (list all content.json newer than X date) that needs to check every file. To workaround this problem maybe we should index the content.json modification date in a db or simple json file.
- Instead of using raw file system we could store the content.json files in database (Sqlite or Berkeley DB) I have also made benchmark on this, the results on an crazy slow, overloaded VPS (loading and parsing content.json from a site with 5000 users):
sqliteRead | 3.992s Mem: 10.50MB(+0.92MB)
bsddbRead | 2.624s Mem: 11.11MB(+0.61MB)
jsonRead | 331.137s Mem: 11.11MB(+0.00MB)
File size:
- On FS: 3.2MB
- Sqlite: 6MB
- Bsddb: 5.7MB
The same problem in Linux Mint 17.3 based on Ubuntu 14.04
Recent versions start up quite fast. Great ux improvement!