-
Notifications
You must be signed in to change notification settings - Fork 488
[ADR] JMAP: Avoid ElasticSearch on critical reads #259
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
Changes from 1 commit
8deb190
a4ae094
532cccf
bc12fbc
5a3640f
2fe64cb
25c7d92
70f7898
5a03c80
892da60
3907a83
a95aa3d
f8d1b5d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| # 43. Avoid ElasticSearch on critical reads | ||
|
|
||
| Date: 2020-11-11 | ||
|
|
||
| ## Status | ||
|
|
||
| Accepted (lazy consensus). | ||
|
|
||
| Scope: Distributed James | ||
|
|
||
| ## Context | ||
|
|
||
| James powers the JMAP protocol. | ||
|
|
||
| A user willing to use a webmail will end up doing the following operations: | ||
| - `Mailbox/get` to retrieve the mailboxes. This call is resolved against metadata stored in Cassandra. | ||
| - `Email/query` to retrieve the list of emails. This call is nowadays resolved on ElasticSearch. | ||
|
chibenwa marked this conversation as resolved.
Outdated
|
||
| - `Email/get` to retrieve various levels of details. Depending of requested properties, this is either | ||
|
chibenwa marked this conversation as resolved.
Outdated
|
||
| resolved on Cassandra alone or on ElasticSearch. | ||
|
chibenwa marked this conversation as resolved.
Outdated
|
||
|
|
||
| So, ElasticSearch is queried on every JMAP interaction. Administrators thus need to enforce availability and good performance | ||
|
chibenwa marked this conversation as resolved.
Outdated
|
||
| for this component. | ||
|
|
||
| Relying on more software for every read also harms our resiliency as ElasticSearch outages have major impacts. | ||
|
chibenwa marked this conversation as resolved.
Outdated
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What do you expect? If you loose any service you loose James availability: S3, Cassandra, RabbitMQ, ElasticSearch.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I loose ES, given that ADR content, I only loose advanced search. My customers will be waaaay less complaining about "not having search" that "not being able to read their emails".
I and the people I work with are human, we do software, there will be unavailability on some of those services. The question now is how we deal with it. |
||
|
|
||
| Also we should mention our ElasticSearch implementation in Distributed James suffer the following flows: | ||
|
chibenwa marked this conversation as resolved.
Outdated
|
||
| - Updates of flags leads to updates of the all Email object, leading to sparse segments | ||
|
chibenwa marked this conversation as resolved.
Outdated
|
||
| - We currently rely on scrolling for JMAP (in order to ensure messageId uniqueness in the response while respecting limit & position) | ||
| - We noticed some very slow traces against ElasticSearch, even for simple queries. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. any clue why?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And clue why. But ElasticSearch slow performance likely would require its own ADR. That's a lengthy topic. Paging is one, there's many others. I described scrolling & data mutabilityu above. |
||
|
|
||
| Regarding Distributed James data-stores responsibilities: | ||
| - Cassandra is the source of truth for metadata, its storage need to be adapted to known access patterns. | ||
|
chibenwa marked this conversation as resolved.
Outdated
|
||
| - ElasticSearch allows resolution of arbitrary queries, and perform full text search. | ||
|
chibenwa marked this conversation as resolved.
Outdated
|
||
|
|
||
| ## Decision | ||
|
|
||
| Provide an optional view for most common `Email/query` requests both on Draft and RFC-8621 implementations. | ||
| This includes filters and sorts on 'sentAt'. | ||
|
|
||
| This view will be stored on Cassandra, and updated asynchronously via a MailboxListener. | ||
|
chibenwa marked this conversation as resolved.
Outdated
|
||
|
|
||
| ## Consequences | ||
|
|
||
| A migration task will be provided for new adopters. | ||
|
|
||
| Administrators would be offered a configuration option to turn this view on and off as needed. | ||
|
|
||
| If enabled administrators would no longer need to ensure high availability and good performances for ElasticSearch. | ||
|
chibenwa marked this conversation as resolved.
Outdated
|
||
| We thus expect a decrease in overall ElasticSearch load, allowing savings compared to actual deployments. | ||
| Furthermore, we expected better performances by resolving such queries against Cassandra. | ||
|
chibenwa marked this conversation as resolved.
Outdated
|
||
|
|
||
| ## Alternatives | ||
|
|
||
| Those not willing to adopt this view will not be affected. By disabling the listener and the view usage, they will keep | ||
|
chibenwa marked this conversation as resolved.
|
||
| resolving all `Email/query` against ElasticSearch. | ||
|
chibenwa marked this conversation as resolved.
|
||
Uh oh!
There was an error while loading. Please reload this page.