You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by "HonestManXin (via GitHub)" <gi...@apache.org> on 2026/05/06 10:16:13 UTC
[PR] [opt](point query) use fastUniqueId instead of UUID.randomUUID to reduce contention [doris]
HonestManXin opened a new pull request, #63028:
URL: https://github.com/apache/doris/pull/63028
```
"mysql-nio-pool-52" #340 daemon prio=5 os_prio=0 tid=0x00007f3ac801d800 nid=0x3e35cd waiting for monitor entry [0x00007f39742d7000]
java.lang.Thread.State: BLOCKED (on object monitor)
at sun.security.provider.SecureRandom.engineNextBytes(SecureRandom.java:215)
- waiting to lock <0x00007f3f9c218f58> (a sun.security.provider.SecureRandom)
at sun.security.provider.NativePRNG$RandomIO.implNextBytes(NativePRNG.java:534)
at sun.security.provider.NativePRNG$RandomIO.access$400(NativePRNG.java:331)
at sun.security.provider.NativePRNG.engineNextBytes(NativePRNG.java:220)
at java.security.SecureRandom.nextBytes(SecureRandom.java:468)
at java.util.UUID.randomUUID(UUID.java:145)
at org.apache.doris.qe.StmtExecutor.execute(StmtExecutor.java:555)
at org.apache.doris.qe.MysqlConnectProcessor.handleExecute(MysqlConnectProcessor.java:246)
at org.apache.doris.qe.MysqlConnectProcessor.handleExecute(MysqlConnectProcessor.java:294)
```
In high‑concurrency point‑query scenarios, a large number of requests require generating a UUID for internal identification. When the request rate is high, frequent calls to `UUID.randomUUID()` can introduce contention and become a minor performance bottleneck.
For query, the UUID is only required to provide a unique identifier for request correlation, and cryptographic strength is not necessary. To reduce contention and improve throughput, this change introduces `fastUniqueId`, which generates RFC‑4122 compatible UUID v4 values using `ThreadLocalRandom`.
By using a per‑thread random generator instead of the shared random source used by `UUID.randomUUID()`, UUID generation scales better under high concurrency while still preserving the standard UUID format.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [opt](point query) use fastUniqueId instead of UUID.randomUUID to reduce contention [doris]
Posted by "HonestManXin (via GitHub)" <gi...@apache.org>.
HonestManXin commented on PR #63028:
URL: https://github.com/apache/doris/pull/63028#issuecomment-4396442154
run cloud_p0
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [opt](point query) use fastUniqueId instead of UUID.randomUUID to reduce contention [doris]
Posted by "HonestManXin (via GitHub)" <gi...@apache.org>.
HonestManXin commented on PR #63028:
URL: https://github.com/apache/doris/pull/63028#issuecomment-4388742372
run p0
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [opt](point query) use fastUniqueId instead of UUID.randomUUID to reduce contention [doris]
Posted by "morrySnow (via GitHub)" <gi...@apache.org>.
morrySnow commented on code in PR #63028:
URL: https://github.com/apache/doris/pull/63028#discussion_r3198777831
##########
fe/fe-core/src/main/java/org/apache/doris/common/util/UUIDUtils.java:
##########
@@ -0,0 +1,93 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.common.util;
+
+import org.apache.doris.thrift.TUniqueId;
+
+import java.security.SecureRandom;
+import java.util.Random;
+import java.util.UUID;
+import java.util.concurrent.ThreadLocalRandom;
+
+public class UUIDUtils {
Review Comment:
put it into fe-foundation module
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [opt](point query) use fastUniqueId instead of UUID.randomUUID to reduce contention [doris]
Posted by "HonestManXin (via GitHub)" <gi...@apache.org>.
HonestManXin commented on PR #63028:
URL: https://github.com/apache/doris/pull/63028#issuecomment-4395924865
run cloud_p0
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [opt](point query) use fastUniqueId instead of UUID.randomUUID to reduce contention [doris]
Posted by "HonestManXin (via GitHub)" <gi...@apache.org>.
HonestManXin commented on PR #63028:
URL: https://github.com/apache/doris/pull/63028#issuecomment-4394695233
run buildall
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [opt](point query) use fastUniqueId instead of UUID.randomUUID to reduce contention [doris]
Posted by "morrySnow (via GitHub)" <gi...@apache.org>.
morrySnow merged PR #63028:
URL: https://github.com/apache/doris/pull/63028
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [opt](point query) use fastUniqueId instead of UUID.randomUUID to reduce contention [doris]
Posted by "HonestManXin (via GitHub)" <gi...@apache.org>.
HonestManXin commented on PR #63028:
URL: https://github.com/apache/doris/pull/63028#issuecomment-4388068729
run p0
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [opt](point query) use fastUniqueId instead of UUID.randomUUID to reduce contention [doris]
Posted by "HonestManXin (via GitHub)" <gi...@apache.org>.
HonestManXin commented on code in PR #63028:
URL: https://github.com/apache/doris/pull/63028#discussion_r3199364078
##########
fe/fe-core/src/main/java/org/apache/doris/common/util/UUIDUtils.java:
##########
@@ -0,0 +1,93 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package org.apache.doris.common.util;
+
+import org.apache.doris.thrift.TUniqueId;
+
+import java.security.SecureRandom;
+import java.util.Random;
+import java.util.UUID;
+import java.util.concurrent.ThreadLocalRandom;
+
+public class UUIDUtils {
Review Comment:
Currently, UUID usages fall into two categories. One generates a UUID and then converts it to a TUniqueId, ultimately only requiring the TUniqueId. Since this path depends on Thrift, the generation of TUniqueId remains in fe-core. The other category only depends on UUID itself, and this part has been moved to fe-foundation.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [opt](point query) use fastUniqueId instead of UUID.randomUUID to reduce contention [doris]
Posted by "HonestManXin (via GitHub)" <gi...@apache.org>.
HonestManXin commented on PR #63028:
URL: https://github.com/apache/doris/pull/63028#issuecomment-4394688330
/review
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [opt](point query) use fastUniqueId instead of UUID.randomUUID to reduce contention [doris]
Posted by "HonestManXin (via GitHub)" <gi...@apache.org>.
HonestManXin commented on PR #63028:
URL: https://github.com/apache/doris/pull/63028#issuecomment-4387047277
/review
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [opt](point query) use fastUniqueId instead of UUID.randomUUID to reduce contention [doris]
Posted by "hello-stephen (via GitHub)" <gi...@apache.org>.
hello-stephen commented on PR #63028:
URL: https://github.com/apache/doris/pull/63028#issuecomment-4387037773
Thank you for your contribution to Apache Doris.
Don't know what should be done next? See [How to process your PR](https://cwiki.apache.org/confluence/display/DORIS/How+to+process+your+PR).
Please clearly describe your PR:
1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
3. What features were added. Why was this function added?
4. Which code was refactored and why was this part of the code refactored?
5. Which functions were optimized and what is the difference before and after the optimization?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org
Re: [PR] [opt](point query) use fastUniqueId instead of UUID.randomUUID to reduce contention [doris]
Posted by "HonestManXin (via GitHub)" <gi...@apache.org>.
HonestManXin commented on PR #63028:
URL: https://github.com/apache/doris/pull/63028#issuecomment-4387048212
run buildall
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org