We're updating the issue view to help you get more done. 

Avoid high CPU contention by not allocating Session UUIDs eagerly

Description

When generating high load with a benchmark on a scalable server, the primary bottleneck becomes the UUID assignment to each Session :

1 2 3 4 5 6 7 8 9 10 11 12 Stack Trace Count Duration sun.security.provider.NativePRNG$RandomIO.implNextBytes(byte[]) 28,035 883,878,174,458 sun.security.provider.NativePRNG$RandomIO.access$400(NativePRNG$RandomIO, byte[]) 28,035 883,878,174,458 sun.security.provider.NativePRNG.engineNextBytes(byte[]) 28,035 883,878,174,458 java.security.SecureRandom.nextBytes(byte[]) 28,035 883,878,174,458 java.util.UUID.randomUUID() 28,004 883,497,665,831 org.hibernate.id.uuid.StandardRandomStrategy.generateUUID(SharedSessionContractImplementor) 27,989 881,776,995,638 org.hibernate.internal.AbstractSharedSessionContract.<init>(SessionFactoryImpl, SessionCreationOptions) 27,989 881,776,995,638 org.hibernate.internal.AbstractSessionImpl.<init>(SessionFactoryImpl, SessionCreationOptions) 27,989 881,776,995,638 org.hibernate.internal.SessionImpl.<init>(SessionFactoryImpl, SessionCreationOptions) 27,989 881,776,995,638 org.hibernate.internal.SessionFactoryImpl$SessionBuilderImpl.openSession() 27,989 881,776,995,638 org.hibernate.internal.SessionFactoryImpl.buildEntityManager(SynchronizationType, Map) 23,157 802,857,346,608

This UUID generation can be avoided, especially when temporary tables are not necessary.

Environment

None

Status

Assignee

Sanne Grinovero

Reporter

Sanne Grinovero

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Priority

Major