Skip to content

Instantly share code, notes, and snippets.

Avatar

Vladimir Sitnikov vlsi

View GitHub Profile
View PostgreSQL and JDBC: striving for high performance
Vladimir Sitnikov is currently working on performance and scalability of NetCracker OSS.
Telecommunication companies world wide use NetCracker OSS for enterprise and network automation.
Vladimir is keen on Java and database performance: Oracle, PostgreSQL. He’s one of the committers
in the PostgreSQL JDBC driver project, and architect of many performance improvements.
Abstract.
Common Java wisdom is to use PreparedStatements and Batch DML in order to achieve top performance.
It turns out one cannot just blindly follow the best practices. In order to get high throughput, you need
to understand the specifics of the database in question, and the content of the data.
View Null2OptimisationsNull.java
/*
* Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
@vlsi
vlsi / 00_summary.md
Last active Dec 2, 2015
Sample release logs of pgjdbc
View 00_summary.md
@vlsi
vlsi / 00findings.txt
Last active Oct 20, 2015
if (ArrayIndexOutOfBoundsException) {...}
View 00findings.txt
This is a result of running https://github.com/vlsi/microbenches/commit/34c694dcb48acce0a37334631747fb371d80c80f
1) Best result for testSingle is for java7u55+catch(AIOOBE), however java7's results are not stable
2) java 7 results are very unstable:
For isntance:
# Warmup Iteration 1: 548,557 ns/op
...
# Warmup Iteration 6: 102,104 ns/op
...
@vlsi
vlsi / 01summary.txt
Last active Sep 3, 2015
ControlFlowExceptionBenchmark
View 01summary.txt
# i7-4960HQ CPU @ 2.60GHz, jdk1.8.0_51
Benchmark Mode Cnt Score Error Units
ControlFlowExceptionBenchmark.baseline avgt 10 8,434 ± 0,374 ns/op
ControlFlowExceptionBenchmark.baseline:·gc.alloc.rate avgt 10 0,002 ± 0,006 MB/sec
ControlFlowExceptionBenchmark.baseline:·gc.alloc.rate.norm avgt 10 ≈ 10⁻⁵ B/op
ControlFlowExceptionBenchmark.baseline:·gc.count avgt 10 ≈ 0 counts
ControlFlowExceptionBenchmark.nonWritable avgt 10 16,805 ± 1,247 ns/op
ControlFlowExceptionBenchmark.nonWritable:·gc.alloc.rate avgt 10 909,666 ± 61,399 MB/sec
ControlFlowExceptionBenchmark.nonWritable:·gc.alloc.rate.norm avgt 10 16,000 ± 0,003 B/op
ControlFlowExceptionBenchmark.nonWritable:·gc.churn.PS_Eden_Space avgt 10 90
@vlsi
vlsi / Jre7Test.java
Last active Aug 29, 2015
JRE 7 compatibility test
View Jre7Test.java
import java.time.Duration;
import java.util.Optional;
public class Jre7Test {
public static class MyClass {
public Optional<Duration> optional(java.time.Duration duration) {
return Optional.of(duration);
}
public void say(String greeting) {
@vlsi
vlsi / Quiz
Last active Aug 29, 2015
parallel_from_serial(index range scan) quiz
View Quiz
The goal is to make the following query perform an index range scan z_line_items on item_id column,
then broadcast the results to the slaves that would join z_orders table and check the order type.
Even though line_item scan is serial, the join of orders should go in parallel.
Oracle DB 11g is required. In Oracle 12c just adding parallel(n) is sufficient.
select sum(li.price)
from z_line_items li
, z_orders o
@vlsi
vlsi / jmh_report
Created Jun 3, 2015
Suggestion for jmh failure reporting
View jmh_report
Benchmark Mode Cnt Score Error
FinalizeStatement.createAndLeak avgt 2 OutOfMemoryError at iteration 3
FinalizeStatement.createAndLeak:·gc.alloc.rate.norm avgt 2 192,026
@vlsi
vlsi / HotspotAllocationProfilerTest output
Created Apr 12, 2015
HotspotAllocationProfilerTest output
View HotspotAllocationProfilerTest output
# Run complete. Total time: 00:00:05
Benchmark Mode Cnt Score Error Units
HotspotAllocationProfilerTest.allocateObject avgt 4,297 ns/op
HotspotAllocationProfilerTest.allocateObject:·allocated avgt 16,002 B/op
HotspotAllocationProfilerTest.allocateObject:·allocation.rate avgt 3202,343 MB/sec
HotspotAllocationProfilerTest.allocateObjectSampleTime sample 15583 56,291 ± 3,064 ns/op
HotspotAllocationProfilerTest.allocateObjectSampleTime:·allocated sample 16,001 B/op
HotspotAllocationProfilerTest.allocateObjectSampleTime:·allocation.rate sample 1941,053 MB/sec
HotspotAllocationProfilerTest.allocateObjectSingleShot ss 5 1287,800 ± 302,336 ns/op
@vlsi
vlsi / externals
Last active Aug 29, 2015
CopyOnWriteArrayList footprint in jre 1.8
View externals
$ sudo java -jar jol-cli-0.3-full.jar externals java.util.concurrent.CopyOnWriteArrayList
Running 64-bit HotSpot VM.
Using compressed oop with 3-bit shift.
Using compressed klass with 3-bit shift.
Objects are 8 bytes aligned.
Field sizes by type: 4, 1, 1, 2, 2, 4, 4, 8, 8 [bytes]
Array element sizes: 4, 1, 1, 2, 2, 4, 4, 8, 8 [bytes]
objc[33686]: Class JavaLaunchHelper is implemented in both /Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/bin/java and /Library/Java/JavaVirtualMachines/jdk1.8.0_40.jdk/Contents/Home/jre/lib/libinstrument.dylib. One of the two will be used. Which one is undefined.
java.util.concurrent.CopyOnWriteArrayList object externals: