Wire-desktop: Long app start times: Slow decryption and high CPU use

Created on 12 Aug 2017  路  34Comments  路  Source: wireapp/wire-desktop

Wire Version: 2.15.2751
Wire for Web Version: 2017.08.08.1509
OS: Linux
Do you have an antivirus software installed: No

What steps will reproduce the problem?

  1. Open the application

What is the expected result?
Not seeing the loading screen for 5 minutes with my cpu hitting 100%.

What happens instead?
Loading screen for 5 minutes with my cpu hitting 100%.

Most helpful comment

Thanks for bearing with us on the slow app start. This has bugged us for way too long. We have identified one particular place in the code that was slowing down the app start significantly. It turned out to be a quite simply fix from the code point of view.

Previously the app became slower and slower on app start with an increasing database size. This no longer happens.

Internally we saw the duration of the impacted database call drop from 520ms to less than 3ms with a database that is almost a year old. This is the improvement for a single message that is being handled. When you decrypt a couple hundred of them you will definitely feel the improvement.

https://github.com/wireapp/wire-webapp/pull/3988

This optimization will be part of the next release. Please let us know if you see an improvement.

All 34 comments

Are you using the Deb package or a home build? Have you used Wire on this device previously but then left it for a while?

It sounds like you have a lot of messages that are being decrypted at startup.

Yeah I don't open it often because of performance problem (#661) so that must be the
decryption then (and also slow internet speed).
Is there a way I could set a cronjob or similar to get the new messages without actually opening the application? Something like

$ wire-desktop --pull-messages

I'm using the wire-desktop package from the AUR iirc.

Startup should be much quicker with libsodium-neon, but I can't recall if the compilation was working recently. @maximbaz, do you know if the neon compilation issue has been resolved?

As for starting Wire silently, the best option that I'm aware is wire-desktop --hidden which would start minimized to the tray. That's not what you're looking for though.

As for starting Wire silently, the best option that I'm aware is wire-desktop --hidden which would start minimized to the tray. That's not what you're looking for though.

Should I make a suggestion in this repo? I would like a way to get the messages without having the application run afterwards.

@tomleb sure. Or you could even rename this issue so that it reflects your request. I'm sure the devs will look at it. Although my guess is that you'd have to justify the use case.

e.g. Why not leave Wire running when you're at your computer? The slow startup will only happen once, then it should be quick on subsequent startups.

or

Try again once libsodium-neon is working correctly.

The issue is not solved, but the workaround is still the same - install lsb-release package and then reinstall wire-desktop from AUR.

Do I smell a temporary makedep? Or would that be overreaching?

We could add it, although this workaround is valid only for the current version, since the next version (or to be more precise, when Wire upgrades rust_sodium dependency) there is a different approach, we will add export RUST_SODIUM_DISABLE_PIE=1 in PKGBUILD (unless this is not done from within Wire).

Does the same procedure (lsb-release and reinstallation) work for the wire-desktop-bin package in the AUR as well? Or won't tha be affected because it uses the .deb file?

@safarileader, the deb files should already have libsodium-neon built-in, I'd imagine.

It takes also 5 minutes to load today on my system. Was faster in the past...

Here is a video about the experience: https://youtu.be/1bP_Lrc-3uE


screenshot from 2017-10-08 02 01 02

We are still investigating. Long loading times can have multiple isses. Some are unfortunately still expected at this time. To better track this problem down, please answer the following questions:

  • Which desktop platform are you using wire on? (Linux, macOS, Windows)
  • When did you last start the desktop app before now launching it with the long load time?
  • Are you using Wire with the same account on another device (desktop, mobile)?
  • Approx. how many messages have you written and received during the time since you last started the desktop app? (10s, 100s, 1000s)

Thank you very much for your replies.

On my Windows 10 laptop Wire can take up to 1.5 hours to load. CPU usage for Wire is around 50%.

@gregor thanks for investigating.

like you see in the video, i close it and start again directly.

I use it on one other desktop, but not very often becouse it louds too long.

There was aprox. 0 new messages in the 1 second it was closed.

Platform: elementary OS 0.4.1 Loki (based on Ubuntu 16.04.2 LTS) (Linux)

The other desktop is OS X 10.10.5.

i've got the same issue:
Platform: Linux (Manjaro KDE, so package from AUR) at home, Win10 at work - both show the same behaviour, win10 is MUCH worse, sometimes close to an hour of startup time, linux normally around 5min
last time normal start: can't remember :/
Account: Same account on android, linux and windows
Messages: normally i would say around 50ish, sometimes more, sometimes less. Now that you mention it, i THINK mondays are the worst at work, when many messages are written during the weekend - i'll have to keep an eye on that.

Looking at some of the performance profiles I see a really weird behavior. Something is throttling the decryption process. It seems to be decrypting a single event only before waiting for a second or longer before continueing with the next one. The cause is currently unknown. Any feedback that would help us understand this behavior, which apparently only happens to a few and not all users, would be greatly appreciated.

if there is any further testing i can do or information i can provide, i'm happy to help - is there a logfile that can help or a way to issue verbose logging?
edit: i've been observing it for the last 2 weeks and it really seems to be somewhat in relation to the amount of messages since the last login on the machine. I doesn't seem to be a linear correlation (more like 20messages - 1min, 100messages - 30min).

How big is your IndexedDB if you run into this issue?

here on Linux it's 34mb atm for ~/.config/Wire/IndexedDB/
On Windows it's much worse, i'll look at how big it is there tomorrow.

Are you using Wire with a single account only? If you have multiple accounts the IndexedDBs for the other accounts will be in Wire/Partitions/{partitionId}/IndexedDB

Nope, single account. I don'T see a partitions-folder either.
But i noticed that a folder in ~/.config/Wire/Service Worker/CacheStorage/ is pretty big (650mb), if that matters.
Where are those folders on Windows? Appdata?

edit:
So on Windows AppData\Roaming\Wire\IndexedDB was 42mb before starting, 34mb after starting and Starting took 27min

edit2: today it was way faster on windows -only 9min. IndexedDB before: 34,4mb, after: 53mb.
so it doesn't really seem to be directly correlated to the size fo indexedDB (or i'm understanding the indexedDB completely wrong ^^)

edit3: now i hadn't started wire on this machine for a week and had 1h04min startup-time. IndexedDB before: 43,7mb, after: 44,4mb

edit4: again, almost a weeks worth of messages: 1:35h decrypting, IndexedDB before: 44.3mb, after starting of decryption dropped to 33mb, later raised to 35mb and when finished went up to 46.3mb.

I'm super interested in this problem as well. Decrypt on my Windows machine is veeerrrry slow, although I'm also running an Ivy Bridge i5, so it's not exactly a modern processor. No idea how many messages it's generally decrypting but it's probably around 1000ish and it usually takes around 30mins

Happy to look at any logs / metrics that would be helpful. I use this machine infrequently (about once a week).

Intel Core i5-3570 @ 3.4Ghz
16GB RAM
SSD
Windows 10 Pro (1709 build 16299.192)
Wire 3.0.2828

@luciusbono Again the question about the size of your IndexedDB and whether you have a single or multiple accounts in you app?

For the first account:
What's the size of the folder %AppData%\Wire\IndexedDB?

If you have additional accounts:
What's the size of of the IndexedDB folders that can be found in %AppData%\Wire\Partitions\{SOME_UNIQUE_ID}?

Hi,

I still have the same issue where decryption of new messages takes a very long time. (~1h)

$ du -hs ~/.config/Wire/IndexedDB/
35M /home/tomleb/.config/Wire/IndexedDB/

I have a single account.
Scrolling is still slow.

I very rarely open the desktop app anymore due to these reasons.

It takes somewhere between 5 and 10 minutes to start Wire on my laptop: Core I7-6700HQ, Ubuntu 16.04, Wire 3.0.2816-2816 from .deb package.

My IndexedDB size is 12MB. I had 2 accounts set up, one experimental and disabled Wire for Teams account and one regular account Basically all messages are in the regular account.

On my various devices (Desktop Ryzen 5 1600x runing both Archlinux and Windows 10, as well as Surface Book gen 1 running Ubuntu 17.10 and Windows 10), it always takes ~10 minutes _at least_, or hours if it's been a long time since I've synced on that device, using up a LOT of CPU power (in Windows at least. Haven't measure in Linux).

On the other hand, if I have my Android phone (with no SIM card) completely disconnected from the internet, it can sync a day's worth of messages in about a minute once I connect it back.

Just for reference, this issue is also present on the macOS version of Wire desktop (I'm currently running version 3.1.2822 on macOS 10.13.4). Hope it will be fixed soon.

Still seeing this issue on Win10. Scrolling is extremely slow.

Thanks for bearing with us on the slow app start. This has bugged us for way too long. We have identified one particular place in the code that was slowing down the app start significantly. It turned out to be a quite simply fix from the code point of view.

Previously the app became slower and slower on app start with an increasing database size. This no longer happens.

Internally we saw the duration of the impacted database call drop from 520ms to less than 3ms with a database that is almost a year old. This is the improvement for a single message that is being handled. When you decrypt a couple hundred of them you will definitely feel the improvement.

https://github.com/wireapp/wire-webapp/pull/3988

This optimization will be part of the next release. Please let us know if you see an improvement.

Since we released the fix of the bottleneck database call, app start time has been drastically improved. We have been monitoring the situation here and through our CS channels and the core issue to be fixed. While we can and will continue to work on further improvements, the underlying problem discussed in this issue is considered fixed.

馃憤 thanks for the support, startup performance across all my clients has been great.

On Linux, the latest update to the wire-desktop client is a regression for me. Start-up times used to be greatly improved, with fast decryption even after long periods away. However, with the latest update (1 or 2 days ago), start-up decryption is slow again, even if there are only a couple of new messages.

I'm experiencing the same issue with the Linux desktop client as @robertnurnberg. Not sure about other platforms.

Same issue on macOS High Sierra 10.13.6 (17G65), Wire version 3.3.2862 (Wire for Web version 2018.10.15.0814) installed from the App Store. It would be awesome if you could fix this. Thanks in advance.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cardassian-tailor picture cardassian-tailor  路  4Comments

zorbathegreek picture zorbathegreek  路  3Comments

TheAresjej picture TheAresjej  路  5Comments

dependabot-preview[bot] picture dependabot-preview[bot]  路  3Comments

Nateowami picture Nateowami  路  3Comments