Author: trang_vu
Date: 2011-08-11 07:53:23 -0400 (Thu, 11 Aug 2011)
New Revision: 4741
Added:
jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1654/readme.txt
Modified:
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java
Log:
JCR-1654: Performance issues due to SecureRandom.nextBytes under heavy load
Fix description
* Avoid UUID generation for id of SessionImpl.
Now, id of Sessionimpl is generated as "System.currentTimeMillis() + "_"
+ SEQUENCE.incrementAndGet()"
Modified:
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java
===================================================================
---
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java 2011-08-11
11:14:35 UTC (rev 4740)
+++
jcr/branches/1.12.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/SessionImpl.java 2011-08-11
11:53:23 UTC (rev 4741)
@@ -49,7 +49,6 @@
import org.exoplatform.services.jcr.impl.xml.exporting.BaseXmlExporter;
import org.exoplatform.services.jcr.impl.xml.importing.ContentImporter;
import org.exoplatform.services.jcr.impl.xml.importing.StreamImporter;
-import org.exoplatform.services.jcr.util.IdGenerator;
import org.exoplatform.services.security.ConversationState;
import org.exoplatform.services.security.Identity;
import org.xml.sax.ContentHandler;
@@ -67,6 +66,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.atomic.AtomicLong;
import javax.jcr.AccessDeniedException;
import javax.jcr.Credentials;
@@ -100,6 +100,8 @@
public class SessionImpl implements ExtendedSession, NamespaceAccessor
{
+ private static final AtomicLong SEQUENCE = new AtomicLong();
+
public static final int DEFAULT_LAZY_READ_THRESHOLD = 100;
private final RepositoryImpl repository;
@@ -150,7 +152,7 @@
this.workspaceName = workspaceName;
this.container = container;
this.live = true;
- this.id = IdGenerator.generate();
+ this.id = System.currentTimeMillis() + "_" + SEQUENCE.incrementAndGet();
this.userState = userState;
this.repository =
(RepositoryImpl)container.getComponentInstanceOfType(RepositoryImpl.class);
Added: jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1654/readme.txt
===================================================================
--- jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1654/readme.txt (rev
0)
+++ jcr/branches/1.12.x/patch/1.12.10-GA/JCR-1654/readme.txt 2011-08-11 11:53:23 UTC (rev
4741)
@@ -0,0 +1,60 @@
+Summary
+
+ * Status: Performance issues due to SecureRandom.nextBytes under heavy load
+ * CCP Issue: CCP-1032, Product Jira Issue: JCR-1654.
+ * Complexity: low
+
+The Proposal
+Problem description
+
+What is the problem to fix?
+During the benchmarks we encounter a weird slowness off UUID generation in the system.
+A detailed study has been performed and in short it occurs sometimes and for some OS the
UUID method is really slow under heavy load which causes a huge bottleneck.
+
+Fix description
+
+How is the problem fixed?
+ * Avoid UUID generation for id of SessionImpl. Now, id of Sessionimpl is generated as
"System.currentTimeMillis() + "_" + SEQUENCE.incrementAndGet()"
+
+Patch file: JCR-1654.patch
+
+Tests to perform
+
+Reproduction test
+* No
+
+Tests performed at DevLevel
+* No
+
+Tests performed at QA/Support Level
+* No
+Documentation changes
+
+Documentation changes:
+* No
+Configuration changes
+
+Configuration changes:
+* No
+
+Will previous configuration continue to work?
+* No
+Risks and impacts
+
+Can this bug fix have any side effects on current client projects?
+
+ * Function or ClassName change
+
+Is there a performance risk/cost?
+* Little increase performance under heavy load.
+
+Validation (PM/Support/QA)
+
+PM Comment
+* Patch approved.
+
+Support Comment
+*
+
+QA Feedbacks
+*