-
Notifications
You must be signed in to change notification settings - Fork 263
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
Prime cache with message bodies through background job #4824
Comments
This is a really great idea! I personally badly need it as the loading time on my instance is still not as fast as Rainloop. It slows me down from switching completely to the Nextcloud Mail app for the day-to-day work. |
We'll work on this when time allows. |
Memcache would be very nice to have. Like tux, I also encounter long loading times as a result of a slow IMAP server. Should've done a search. This comment is a duplicate of #2621
|
I did some testing and it turns out that the builtin cache of horde does not seem to cache full message bodies. There was no measurable difference between loading bodies of cached and uncached messages. I suggest to implement a custom cache for message bodies if we really want to do this. |
If it's not worth it then let's put this ticket on hold for now. |
@st3iny Wondering how you tested this, is there a branch I can use? I'm trying out the Mail app now and fetching mail from IMAP the first time can take from 5 up to 10 seconds on our setup. After that, it's less than a second. Pre-fetching some emails (like the 100 most recent, or the 10 most recent of the current mailbox, or something else) could greatly improve the experience I think. |
IIRC, horde (imap lib we use) only caches message metadata but not the body itself. Therefore, priming the cache only benefits performance if we don't fetch the body afterwards. However, as we are fetching the body to be able to display it to the user we have to a full round trip to the imap server anyways => there won't be a measurable difference. If we really want to improve the performance on that end, we need to implement a custom message body cache. We could for example cache the bodies of the most relevant/recent messages in the database. |
I see. So the body is stored on the client side, and therefore way faster after the first load? What do you think about pre-fetching a bunch of emails when you open a mailbox? A custom message body cache (or implementing it in horde?) sounds like a more durable option, but also a much bigger change. |
Exactly. Once the email is opened on the client it is cached by the browser.
On the client-side? Sure, that would be a possibility but it would generate a lot of traffic. It could be improved by only fetching mails that are not cached on the client although I'm not sure if this is possible via JavaScript.
True. We discussed it internally and it might be implemented at some time. |
I had a quick look at the behaviour and I noticed the following. When I click on a message the following happens:
EDIT: the third step is initiated by the |
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as resolved.
This comment was marked as resolved.
I put my vote to this feature. |
Mail doesn't go to IMAP to fetch a list of messages, but we have to contact IMAP for the bodies. This can cause a slight delay when users browser their messages. To improve things we already have mem caching (through Horde) that is supposed to prevent the same message to be fetched twice. However, if the first fetch is triggered by the user, the user will experience the delay.
Therefore I propose that we try to prime the cache with message bodies from the cron background jobs, so that the most recent email (or all new?) are put into the cache.
Of course we might overfetch or underfetch, but that is inevitable. If it helps reduce loading times for 50% of the messages the user will browser then we've already won.
From a technical perspective we have to possibly check what type of cache is used as prefetching and caching on a cache that is not shared between CLI (cron) and web requests won't give any benefit.
The text was updated successfully, but these errors were encountered: