Skip to content

Instantly share code, notes, and snippets.

View jankotek's full-sized avatar

Jan Kotek jankotek

View GitHub Profile
/opt/jdk8/bin/java -agentpath:/opt/jprofiler10/bin/linux-x64/libjprofilerti.so=port=33389 -Xmx1G -Djava.io.tmpdir=/home/jan/tmp/ -Dfile.encoding=UTF-8 -classpath /opt/jdk8/jre/lib/charsets.jar:/opt/jdk8/jre/lib/deploy.jar:/opt/jdk8/jre/lib/ext/cldrdata.jar:/opt/jdk8/jre/lib/ext/dnsns.jar:/opt/jdk8/jre/lib/ext/jaccess.jar:/opt/jdk8/jre/lib/ext/jfxrt.jar:/opt/jdk8/jre/lib/ext/localedata.jar:/opt/jdk8/jre/lib/ext/nashorn.jar:/opt/jdk8/jre/lib/ext/sunec.jar:/opt/jdk8/jre/lib/ext/sunjce_provider.jar:/opt/jdk8/jre/lib/ext/sunpkcs11.jar:/opt/jdk8/jre/lib/ext/zipfs.jar:/opt/jdk8/jre/lib/javaws.jar:/opt/jdk8/jre/lib/jce.jar:/opt/jdk8/jre/lib/jfr.jar:/opt/jdk8/jre/lib/jfxswt.jar:/opt/jdk8/jre/lib/jsse.jar:/opt/jdk8/jre/lib/management-agent.jar:/opt/jdk8/jre/lib/plugin.jar:/opt/jdk8/jre/lib/resources.jar:/opt/jdk8/jre/lib/rt.jar:/home/jan/iohk/iodb/target/scala-2.12/test-classes:/home/jan/iohk/iodb/target/scala-2.12/classes:/home/jan/.ivy2/cache/ch.qos.logback/logback-classic/jars/logback-classic-1.2.3.jar:/home/jan/.iv
package org.mapdb.crash;
/**
* Created by jan on 4/2/16.
*/
public class Prime {
static boolean isPrime(int n) {
@jankotek
jankotek / _HelloWorld.java
Created May 27, 2015 18:28
LZV versus LZ4
package examples;
import net.jpountz.lz4.LZ4Compressor;
import net.jpountz.lz4.LZ4Factory;
import net.jpountz.lz4.LZ4FastDecompressor;
import net.jpountz.lz4.LZ4SafeDecompressor;
import org.mapdb.CompressLZF;
import org.mapdb.DB;
import org.mapdb.DBMaker;
/*
- previous example was using `byte[]` as a backend, so it was failing. This example uses DirectByteBuffer
- it had cache which was consuming a lot of Heap
- set JVM memory limits:
-Xmx64M -XX:MaxDirectMemorySize=2G
- current master branch does not have storage statistics. I did rewrite and its not implemented yet.

Overview

Append-Only-Files is key-value storage where key is 8-byte long and value serialized byte[]. It writes modified data to the end of the file, never overwriting existing data. In theory it is more durable than other transactional stores such as write-ahead-log.

Because older versions are kept around it is very easy to implement snapshots and other advanced features.

@jankotek
jankotek / gist:9450559
Created March 9, 2014 16:47
MapDB overview video transcript
1 - Hello
--------------
Hello, I am Jan Kotek and in this podcast I will give you quick overview of MapDB;
an embedded java database engine.
2 - MapDB
---------
Traditional Java collections are limited to a few gigabytes by garbage collector and heap size.
@jankotek
jankotek / The Complexity Trap
Created December 23, 2013 10:09
The Complexity Trap
*This is section from 'A Cryptographic Evaluation of IPsec' by N. Ferguson and B. Schneier. I think it applies to programming in general.*
*Original can be found at: https://www.schneier.com/paper-ipsec.html*
Security’s worst enemy is complexity.
This might seem an odd statement, especially in the light of the many simple
systems that exhibit critical security failures. It is true nonetheless. Simple fail-
ures are simple to avoid, and often simple to fix. The problem in these cases