-
Notifications
You must be signed in to change notification settings - Fork 24.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Kibana's long had a problems sending Elasticsearch thousands of fields to the source filtering API. It's probably not right to send *thousands* of fields to it, but, in turn, we don't really have a good excuse for rejecting them. I mean, we do. We reject them to keep ourselves from allocating too much memory and crashing. But we can do better. This makes us tollerate significantly larger field lists much more efficiently. First, this changes the way we generate the "guts" of the filter API so that we use a *ton* less memory thanks to Daciuk, Mihov, Watson, and Watson: https://www.aclweb.org/anthology/J00-1002.pdf Lucene has an implementation of their algorithm built right in. We just have to plug it in. With this a list of four thousand fields generates thirty four thousand automata states instead of hundreds of thousdands. Next we replace the algorithm that the source filtering uses to match dotted field names with one that doesn't duplicate the automata we build. This cuts that thirty four thousand states to seventeen thousand. Finally we bump the maximum number of automata states we accept from 10,000 to 50,000 which is *comfortable* enough to handle the number of state need for that four thousand field list. 50,000 state automata will likely weigh in around a megabyte of heap. Heavy, but fine. Thanks to Daciuk, et al, you can throw absolutely massive lists of fields at us before we get that large. I couldn't do it with copy and paste. I don't have that kind of creativity. I expect folks will shy away from sending field lists that are megabytes long. But I never expected thousands of fields, so what do I know. Those the are enough for to take most of what kibana's historically sent us without any problems. They are still huge requests and they'd be better off not sending massive lists, but at least now the problem isn't so pressing. That four thousand field list was 120kb over the wire. That's big request!
- Loading branch information
Showing
5 changed files
with
4,069 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.