[ 
https://issues.apache.org/jira/browse/IGNITE-23049?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Alexander Lapin updated IGNITE-23049:
-------------------------------------
    Description: 
h3. Motivation

Originally HybridClockImpl used 
{code:java}
systemUTC().instant().toEpochMilli(){code}
 within Reduce latency for txn preparing phase it was substituted with 
{code:java}
FastTimestamps.coarseCurrentTimeMillis(){code}
that likely led to decreased test stability:
 # 
[ClockWaiterTest.futureCompletesWithoutClockUpdatesfailure|https://ci.ignite.apache.org/buildConfiguration/ApacheIgnite3xGradle_Test_RunAllTests/8409117?hideProblemsFromDependencies=false&hideTestsFromDependencies=false&expandBuildDeploymentsSection=false&expandCode+Inspection=true&expandBuildProblemsSection=true&expandBuildChangesSection=true&expandBuildTestsSection=true]
 # 
[IndexMetaStorageRecoveryTest.testMissingDropTable|https://ci.ignite.apache.org/buildConfiguration/ApacheIgnite3xGradle_Test_RunAllTests/8411374?hideProblemsFromDependencies=false&hideTestsFromDependencies=false&expandCode+Inspection=true&expandBuildChangesSection=true&expandBuildDeploymentsSection=false&expandBuildProblemsSection=true&expandBuildTestsSection=true]
 # 
[ItIgniteDistributionZoneManagerNodeRestartTest.testScaleDownTimerIsRestoredAfterRestart(defaultZone=true)|https://ci.ignite.apache.org/buildConfiguration/ApacheIgnite3xGradle_Test_RunAllTests/8414582?hideTestsFromDependencies=false&hideProblemsFromDependencies=false&expandBuildTestsSection=true&expandBuildDeploymentsSection=false&expandCode+Inspection=true&expandBuildProblemsSection=true&expandBuildChangesSection=true]

Thus, it seems reasonable to benchmark following basis for HybridClock in order 
to choose the fastest and most reliable
 * systemUTC().instant().toEpochMilli()
 * System.currentTimeMillis()
 * FastTimestamps.coarseCurrentTimeMillis()

h3. Defition of Done
 * Write benchmarks and compare results.

h3. UPD№1

In average, and what's more important according to UpsertKvBenchmark 
{*}FastTimestamps ≈ currentTimeMillis < systemUTC{*}, ** thus we may substitute 
unstable FastsTimestamps with currentTimeMillis after proving its stability.

Benchmark results for three HybridClock implementations within 1, 5 and 10 
threads:

 
{code:java}
Chip: Apple M3 Pro Total Number of Cores: 11 (5 performance and 6 efficiency) 
Memory: 36 GB

Benchmark                                                (implementationName)  
Mode  Cnt     Score     Error  Units
HybridClockBenchmark.hybridClockNowFiveThreads           HybridClockSystemUTC  
avgt   10   515.640 ±  39.361  us/op
HybridClockBenchmark.hybridClockNowFiveThreads   HybridClockCurrentTimeMillis  
avgt   10   253.520 ±  39.885  us/op
HybridClockBenchmark.hybridClockNowFiveThreads      HybridClockFastTimestamps  
avgt   10   218.364 ±  14.804  us/op
HybridClockBenchmark.hybridClockNowSingleThread          HybridClockSystemUTC  
avgt   10    48.886 ±   3.840  us/op
HybridClockBenchmark.hybridClockNowSingleThread  HybridClockCurrentTimeMillis  
avgt   10    14.379 ±   0.074  us/op
HybridClockBenchmark.hybridClockNowSingleThread     HybridClockFastTimestamps  
avgt   10     4.153 ±   0.199  us/op
HybridClockBenchmark.hybridClockNowTenThreads            HybridClockSystemUTC  
avgt   10  1498.397 ±  19.352  us/op
HybridClockBenchmark.hybridClockNowTenThreads    HybridClockCurrentTimeMillis  
avgt   10   847.807 ±   8.346  us/op
HybridClockBenchmark.hybridClockNowTenThreads       HybridClockFastTimestamps  
avgt   10  3027.382 ± 175.118  us/op 




Win 10, 2 cores

Benchmark                                                (implementationName)  
Mode  Cnt    Score    Error  Units
HybridClockBenchmark.hybridClockNowFiveThreads           HybridClockSystemUTC  
avgt   10  376.678 �  5.800  us/op
HybridClockBenchmark.hybridClockNowFiveThreads   HybridClockCurrentTimeMillis  
avgt   10  329.343 �  4.630  us/op
HybridClockBenchmark.hybridClockNowFiveThreads      HybridClockFastTimestamps  
avgt   10  259.633 �  7.708  us/op
HybridClockBenchmark.hybridClockNowSingleThread          HybridClockSystemUTC  
avgt   10   24.561 �  0.285  us/op
HybridClockBenchmark.hybridClockNowSingleThread  HybridClockCurrentTimeMillis  
avgt   10    9.907 �  0.061  us/op
HybridClockBenchmark.hybridClockNowSingleThread     HybridClockFastTimestamps  
avgt   10   10.102 �  0.186  us/op
HybridClockBenchmark.hybridClockNowTenThreads            HybridClockSystemUTC  
avgt   10  672.293 � 11.405  us/op
HybridClockBenchmark.hybridClockNowTenThreads    HybridClockCurrentTimeMillis  
avgt   10  534.624 � 31.084  us/op
HybridClockBenchmark.hybridClockNowTenThreads       HybridClockFastTimestamps  
avgt   10  526.803 � 14.244  us/op




Debian 12, CPU=intel 8250u 4 cores, 48GB. OpenJDK 11.0.20

Benchmark                                                (implementationName)  
Mode  Cnt     Score     Error  Units
HybridClockBenchmark.hybridClockNowFiveThreads           HybridClockSystemUTC  
avgt   10   671.298 ±  20.599  us/op
HybridClockBenchmark.hybridClockNowFiveThreads   HybridClockCurrentTimeMillis  
avgt   10   780.638 ±  62.643  us/op
HybridClockBenchmark.hybridClockNowFiveThreads      HybridClockFastTimestamps  
avgt   10  1182.727 ± 960.559  us/op
HybridClockBenchmark.hybridClockNowSingleThread          HybridClockSystemUTC  
avgt   10    46.180 ±   0.986  us/op
HybridClockBenchmark.hybridClockNowSingleThread  HybridClockCurrentTimeMillis  
avgt   10    29.254 ±   0.503  us/op
HybridClockBenchmark.hybridClockNowSingleThread     HybridClockFastTimestamps  
avgt   10     9.760 ±   0.127  us/op
HybridClockBenchmark.hybridClockNowTenThreads            HybridClockSystemUTC  
avgt   10  1509.756 ±  60.812  us/op
HybridClockBenchmark.hybridClockNowTenThreads    HybridClockCurrentTimeMillis  
avgt   10  1407.827 ±  22.288  us/op
HybridClockBenchmark.hybridClockNowTenThreads       HybridClockFastTimestamps  
avgt   10  1835.972 ± 172.746  us/op




mac os m1, 10 cores

Benchmark                                                (implementationName)  
Mode  Cnt     Score     Error  Units
HybridClockBenchmark.hybridClockNowFiveThreads           HybridClockSystemUTC  
avgt   10   614.132 ± 331.664  us/op
HybridClockBenchmark.hybridClockNowFiveThreads   HybridClockCurrentTimeMillis  
avgt   10   330.902 ±  13.540  us/op
HybridClockBenchmark.hybridClockNowFiveThreads      HybridClockFastTimestamps  
avgt   10   156.549 ±  10.527  us/op
HybridClockBenchmark.hybridClockNowSingleThread          HybridClockSystemUTC  
avgt   10    87.725 ±   1.370  us/op
HybridClockBenchmark.hybridClockNowSingleThread  HybridClockCurrentTimeMillis  
avgt   10    21.972 ±   3.774  us/op
HybridClockBenchmark.hybridClockNowSingleThread     HybridClockFastTimestamps  
avgt   10     8.082 ±   0.341  us/op
HybridClockBenchmark.hybridClockNowTenThreads            HybridClockSystemUTC  
avgt   10  1166.027 ±  50.319  us/op
HybridClockBenchmark.hybridClockNowTenThreads    HybridClockCurrentTimeMillis  
avgt   10   646.750 ±  58.910  us/op
HybridClockBenchmark.hybridClockNowTenThreads       HybridClockFastTimestamps  
avgt   10   297.513 ±  22.518  us/op {code}
and single-threaded UpsertKvBenchmark

 

 
{code:java}
Chip: Apple M3 Pro Total Number of Cores: 11 (5 performance and 6 efficiency) 
Memory: 36 GB

systemUTC
Benchmark                 (fsync)  Mode  Cnt  Score   Error  Units
UpsertKvBenchmark.upsert    false  avgt   10  9.150 ± 0.265  us/op
UpsertKvBenchmark.upsert     true  avgt   10  6.401 ± 0.349  us/op

currentTimeMillis
Benchmark                 (fsync)  Mode  Cnt  Score   Error  Units
UpsertKvBenchmark.upsert    false  avgt   10  6.535 ± 0.533  us/op
UpsertKvBenchmark.upsert     true  avgt   10  5.282 ± 0.265  us/op

FastTimestamps
Benchmark                 (fsync)  Mode  Cnt  Score   Error  Units
UpsertKvBenchmark.upsert    false  avgt   10  6.957 ± 0.449  us/op
UpsertKvBenchmark.upsert     true  avgt   10  5.237 ± 0.260  us/op {code}
 

 

 

  was:
h3. Motivation

Originally HybridClockImpl used 
{code:java}
systemUTC().instant().toEpochMilli(){code}
 within Reduce latency for txn preparing phase it was substituted with 
{code:java}
FastTimestamps.coarseCurrentTimeMillis(){code}
that likely led to decreased test stability:
 # 
[ClockWaiterTest.futureCompletesWithoutClockUpdatesfailure|https://ci.ignite.apache.org/buildConfiguration/ApacheIgnite3xGradle_Test_RunAllTests/8409117?hideProblemsFromDependencies=false&hideTestsFromDependencies=false&expandBuildDeploymentsSection=false&expandCode+Inspection=true&expandBuildProblemsSection=true&expandBuildChangesSection=true&expandBuildTestsSection=true]
 # 
[IndexMetaStorageRecoveryTest.testMissingDropTable|https://ci.ignite.apache.org/buildConfiguration/ApacheIgnite3xGradle_Test_RunAllTests/8411374?hideProblemsFromDependencies=false&hideTestsFromDependencies=false&expandCode+Inspection=true&expandBuildChangesSection=true&expandBuildDeploymentsSection=false&expandBuildProblemsSection=true&expandBuildTestsSection=true]
 # 
[ItIgniteDistributionZoneManagerNodeRestartTest.testScaleDownTimerIsRestoredAfterRestart(defaultZone=true)|https://ci.ignite.apache.org/buildConfiguration/ApacheIgnite3xGradle_Test_RunAllTests/8414582?hideTestsFromDependencies=false&hideProblemsFromDependencies=false&expandBuildTestsSection=true&expandBuildDeploymentsSection=false&expandCode+Inspection=true&expandBuildProblemsSection=true&expandBuildChangesSection=true]

Thus, it seems reasonable to benchmark following basis for HybridClock in order 
to choose the fastest and most reliable
 * systemUTC().instant().toEpochMilli()
 * System.currentTimeMillis()
 * FastTimestamps.coarseCurrentTimeMillis()

h3. Defition of Done
 * Write benchmarks and compare results.


> Benchmark HybridClock
> ---------------------
>
>                 Key: IGNITE-23049
>                 URL: https://issues.apache.org/jira/browse/IGNITE-23049
>             Project: Ignite
>          Issue Type: Improvement
>            Reporter: Alexander Lapin
>            Assignee: Alexander Lapin
>            Priority: Major
>              Labels: ignite-3
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> h3. Motivation
> Originally HybridClockImpl used 
> {code:java}
> systemUTC().instant().toEpochMilli(){code}
>  within Reduce latency for txn preparing phase it was substituted with 
> {code:java}
> FastTimestamps.coarseCurrentTimeMillis(){code}
> that likely led to decreased test stability:
>  # 
> [ClockWaiterTest.futureCompletesWithoutClockUpdatesfailure|https://ci.ignite.apache.org/buildConfiguration/ApacheIgnite3xGradle_Test_RunAllTests/8409117?hideProblemsFromDependencies=false&hideTestsFromDependencies=false&expandBuildDeploymentsSection=false&expandCode+Inspection=true&expandBuildProblemsSection=true&expandBuildChangesSection=true&expandBuildTestsSection=true]
>  # 
> [IndexMetaStorageRecoveryTest.testMissingDropTable|https://ci.ignite.apache.org/buildConfiguration/ApacheIgnite3xGradle_Test_RunAllTests/8411374?hideProblemsFromDependencies=false&hideTestsFromDependencies=false&expandCode+Inspection=true&expandBuildChangesSection=true&expandBuildDeploymentsSection=false&expandBuildProblemsSection=true&expandBuildTestsSection=true]
>  # 
> [ItIgniteDistributionZoneManagerNodeRestartTest.testScaleDownTimerIsRestoredAfterRestart(defaultZone=true)|https://ci.ignite.apache.org/buildConfiguration/ApacheIgnite3xGradle_Test_RunAllTests/8414582?hideTestsFromDependencies=false&hideProblemsFromDependencies=false&expandBuildTestsSection=true&expandBuildDeploymentsSection=false&expandCode+Inspection=true&expandBuildProblemsSection=true&expandBuildChangesSection=true]
> Thus, it seems reasonable to benchmark following basis for HybridClock in 
> order to choose the fastest and most reliable
>  * systemUTC().instant().toEpochMilli()
>  * System.currentTimeMillis()
>  * FastTimestamps.coarseCurrentTimeMillis()
> h3. Defition of Done
>  * Write benchmarks and compare results.
> h3. UPD№1
> In average, and what's more important according to UpsertKvBenchmark 
> {*}FastTimestamps ≈ currentTimeMillis < systemUTC{*}, ** thus we may 
> substitute unstable FastsTimestamps with currentTimeMillis after proving its 
> stability.
> Benchmark results for three HybridClock implementations within 1, 5 and 10 
> threads:
>  
> {code:java}
> Chip: Apple M3 Pro Total Number of Cores: 11 (5 performance and 6 efficiency) 
> Memory: 36 GB
> Benchmark                                                (implementationName) 
>  Mode  Cnt     Score     Error  Units
> HybridClockBenchmark.hybridClockNowFiveThreads           HybridClockSystemUTC 
>  avgt   10   515.640 ±  39.361  us/op
> HybridClockBenchmark.hybridClockNowFiveThreads   HybridClockCurrentTimeMillis 
>  avgt   10   253.520 ±  39.885  us/op
> HybridClockBenchmark.hybridClockNowFiveThreads      HybridClockFastTimestamps 
>  avgt   10   218.364 ±  14.804  us/op
> HybridClockBenchmark.hybridClockNowSingleThread          HybridClockSystemUTC 
>  avgt   10    48.886 ±   3.840  us/op
> HybridClockBenchmark.hybridClockNowSingleThread  HybridClockCurrentTimeMillis 
>  avgt   10    14.379 ±   0.074  us/op
> HybridClockBenchmark.hybridClockNowSingleThread     HybridClockFastTimestamps 
>  avgt   10     4.153 ±   0.199  us/op
> HybridClockBenchmark.hybridClockNowTenThreads            HybridClockSystemUTC 
>  avgt   10  1498.397 ±  19.352  us/op
> HybridClockBenchmark.hybridClockNowTenThreads    HybridClockCurrentTimeMillis 
>  avgt   10   847.807 ±   8.346  us/op
> HybridClockBenchmark.hybridClockNowTenThreads       HybridClockFastTimestamps 
>  avgt   10  3027.382 ± 175.118  us/op 
> Win 10, 2 cores
> Benchmark                                                (implementationName) 
>  Mode  Cnt    Score    Error  Units
> HybridClockBenchmark.hybridClockNowFiveThreads           HybridClockSystemUTC 
>  avgt   10  376.678 �  5.800  us/op
> HybridClockBenchmark.hybridClockNowFiveThreads   HybridClockCurrentTimeMillis 
>  avgt   10  329.343 �  4.630  us/op
> HybridClockBenchmark.hybridClockNowFiveThreads      HybridClockFastTimestamps 
>  avgt   10  259.633 �  7.708  us/op
> HybridClockBenchmark.hybridClockNowSingleThread          HybridClockSystemUTC 
>  avgt   10   24.561 �  0.285  us/op
> HybridClockBenchmark.hybridClockNowSingleThread  HybridClockCurrentTimeMillis 
>  avgt   10    9.907 �  0.061  us/op
> HybridClockBenchmark.hybridClockNowSingleThread     HybridClockFastTimestamps 
>  avgt   10   10.102 �  0.186  us/op
> HybridClockBenchmark.hybridClockNowTenThreads            HybridClockSystemUTC 
>  avgt   10  672.293 � 11.405  us/op
> HybridClockBenchmark.hybridClockNowTenThreads    HybridClockCurrentTimeMillis 
>  avgt   10  534.624 � 31.084  us/op
> HybridClockBenchmark.hybridClockNowTenThreads       HybridClockFastTimestamps 
>  avgt   10  526.803 � 14.244  us/op
> Debian 12, CPU=intel 8250u 4 cores, 48GB. OpenJDK 11.0.20
> Benchmark                                                (implementationName) 
>  Mode  Cnt     Score     Error  Units
> HybridClockBenchmark.hybridClockNowFiveThreads           HybridClockSystemUTC 
>  avgt   10   671.298 ±  20.599  us/op
> HybridClockBenchmark.hybridClockNowFiveThreads   HybridClockCurrentTimeMillis 
>  avgt   10   780.638 ±  62.643  us/op
> HybridClockBenchmark.hybridClockNowFiveThreads      HybridClockFastTimestamps 
>  avgt   10  1182.727 ± 960.559  us/op
> HybridClockBenchmark.hybridClockNowSingleThread          HybridClockSystemUTC 
>  avgt   10    46.180 ±   0.986  us/op
> HybridClockBenchmark.hybridClockNowSingleThread  HybridClockCurrentTimeMillis 
>  avgt   10    29.254 ±   0.503  us/op
> HybridClockBenchmark.hybridClockNowSingleThread     HybridClockFastTimestamps 
>  avgt   10     9.760 ±   0.127  us/op
> HybridClockBenchmark.hybridClockNowTenThreads            HybridClockSystemUTC 
>  avgt   10  1509.756 ±  60.812  us/op
> HybridClockBenchmark.hybridClockNowTenThreads    HybridClockCurrentTimeMillis 
>  avgt   10  1407.827 ±  22.288  us/op
> HybridClockBenchmark.hybridClockNowTenThreads       HybridClockFastTimestamps 
>  avgt   10  1835.972 ± 172.746  us/op
> mac os m1, 10 cores
> Benchmark                                                (implementationName) 
>  Mode  Cnt     Score     Error  Units
> HybridClockBenchmark.hybridClockNowFiveThreads           HybridClockSystemUTC 
>  avgt   10   614.132 ± 331.664  us/op
> HybridClockBenchmark.hybridClockNowFiveThreads   HybridClockCurrentTimeMillis 
>  avgt   10   330.902 ±  13.540  us/op
> HybridClockBenchmark.hybridClockNowFiveThreads      HybridClockFastTimestamps 
>  avgt   10   156.549 ±  10.527  us/op
> HybridClockBenchmark.hybridClockNowSingleThread          HybridClockSystemUTC 
>  avgt   10    87.725 ±   1.370  us/op
> HybridClockBenchmark.hybridClockNowSingleThread  HybridClockCurrentTimeMillis 
>  avgt   10    21.972 ±   3.774  us/op
> HybridClockBenchmark.hybridClockNowSingleThread     HybridClockFastTimestamps 
>  avgt   10     8.082 ±   0.341  us/op
> HybridClockBenchmark.hybridClockNowTenThreads            HybridClockSystemUTC 
>  avgt   10  1166.027 ±  50.319  us/op
> HybridClockBenchmark.hybridClockNowTenThreads    HybridClockCurrentTimeMillis 
>  avgt   10   646.750 ±  58.910  us/op
> HybridClockBenchmark.hybridClockNowTenThreads       HybridClockFastTimestamps 
>  avgt   10   297.513 ±  22.518  us/op {code}
> and single-threaded UpsertKvBenchmark
>  
>  
> {code:java}
> Chip: Apple M3 Pro Total Number of Cores: 11 (5 performance and 6 efficiency) 
> Memory: 36 GB
> systemUTC
> Benchmark                 (fsync)  Mode  Cnt  Score   Error  Units
> UpsertKvBenchmark.upsert    false  avgt   10  9.150 ± 0.265  us/op
> UpsertKvBenchmark.upsert     true  avgt   10  6.401 ± 0.349  us/op
> currentTimeMillis
> Benchmark                 (fsync)  Mode  Cnt  Score   Error  Units
> UpsertKvBenchmark.upsert    false  avgt   10  6.535 ± 0.533  us/op
> UpsertKvBenchmark.upsert     true  avgt   10  5.282 ± 0.265  us/op
> FastTimestamps
> Benchmark                 (fsync)  Mode  Cnt  Score   Error  Units
> UpsertKvBenchmark.upsert    false  avgt   10  6.957 ± 0.449  us/op
> UpsertKvBenchmark.upsert     true  avgt   10  5.237 ± 0.260  us/op {code}
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to