-
Notifications
You must be signed in to change notification settings - Fork 25k
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
A large number of duplicated update mapping tasks take down master node. #66768
Comments
Pinging @elastic/es-distributed (Team:Distributed) |
This looks to be a duplicate of #50670 which is addressed by #51038 in 7.7.0. The fix is similar in effect to your proposal. I suggest:
I'm closing this as a duplicate, but please get back to us if the problem persists even after upgrading to the latest version. |
Thanks @DaveCTurner , proposal in #51038 mainly focus on data node's duplicated update mapping tasks. However, if we have 100 data nodes, and each data node has a primary shard, suppose we have 10k concurrent bulk operations need to update the same mapping, even we set So probably, we need to consider a general mechanism to de-duplicate master's tasks in the future, like shard failed, update mapping, create index, and add template, they probably have lots of duplicated tasks in high concurrency scenario. |
This already exists, and has been in place since long before 7.5.1: elasticsearch/server/src/main/java/org/elasticsearch/cluster/metadata/MetadataMappingService.java Lines 361 to 365 in 6181ba3
A few hundred put-mapping tasks, most of which are skipped by this code, shouldn't be presenting any problems. |
Thank you. This seems only for mapping update tasks, so how about creating index, adding template? 10k concurrent requests would cause 10k times of cluster state calculation and 10k listeners call (network request). |
It's pretty much the same story for creating indices and adding templates. Are you actually seeing problems with these in practice? If so, I suggest you open a separate issue with some more detail of how this is causing an impact. |
Issue
Elasticsearch version (
bin/elasticsearch --version
): 7.5.1Plugins installed: []
JVM version (
java -version
): 1.8.0.181OS version (
uname -a
if on a Unix-like system): CentOS Linux 3.1.0ES supports auto create index / update mapping during handling bulk request. We have created one index with 100 primary shards, and cluster has high concurrency bulk requests(20k+/s) to the target index at the same time, and they all have added same new fields (would concurrently trigger mapping update). Then huge duplicated update mapping tasks would make master hang for long time (cpu almost 100% consumed). Then other nodes disconnected from current master.
Related logs, you could see that lot's of duplicated
_doc
types of mapping update task has been calculated. And also they need to call lot's of listeners.Steps to reproduce:
I have veirfied the duplicated update mapping tasks in my local cluster.
I could see three update mapping tasks for type of
_doc
on master node:Proposal
Each shard bulk operation on primary shard would submit a mapping update task if the mapping has been changed:
elasticsearch/server/src/main/java/org/elasticsearch/action/bulk/TransportShardBulkAction.java
Lines 128 to 133 in 3f52894
If one index on single data node has submitted update mapping task to master, we could pending incoming mapping update task that has the same mapping update source and put them in a cache queue instead of sending duplicate task to master directly. Once the submitted update mapping task has been processed, simple to set the rest incoming task's status and continue to process bulk write. With this optimization, we could group update mapping tasks to node index level instead of shard bulk operation level.
If this idea is acceptable, I would provide a PR, thanks.
The text was updated successfully, but these errors were encountered: