Skip to content

Instantly share code, notes, and snippets.

Avatar

Fabian Lange CodingFabian

View GitHub Profile
View swagger.json
{
"openapi": "3.0.1",
"info": {
"contact": {
"email": "support@instana.com",
"name": "© Instana",
"url": "http://instana.com"
},
"termsOfService": "https://www.instana.com/terms-of-use/",
"title": "Introduction to Instana public APIs",
View ContentionBenchmark.java
package com.fasterxml.jackson.benchmark;
import java.io.IOException;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Threads;
View Slow netty write
at sun.misc.Unsafe.putByte(Native Method)
at io.netty.util.internal.PlatformDependent0.putByte(PlatformDependent0.java:518)
at io.netty.util.internal.PlatformDependent.putByte(PlatformDependent.java:536)
at io.netty.buffer.UnsafeByteBufUtil.setByte(UnsafeByteBufUtil.java:133)
at io.netty.buffer.UnpooledUnsafeDirectByteBuf._setByte(UnpooledUnsafeDirectByteBuf.java:302)
at io.netty.buffer.AbstractByteBuf.writeByte(AbstractByteBuf.java:960
@CodingFabian
CodingFabian / gist:29ac2006442ff31efab47638d6a31184
Created Oct 11, 2017
Repeatable native memory crash of jvm
View gist:29ac2006442ff31efab47638d6a31184
*** Error in `java': double free or corruption (out): 0x00007f61dc21dc70 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x7c503)[0x7f621109e503]
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.131-2.b11.30.amzn1.x86_64/jre/lib/amd64/server/libjvm.so(+0x606659)[0x7f6210718659]
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.131-2.b11.30.amzn1.x86_64/jre/lib/amd64/server/libjvm.so(+0x6093ea)[0x7f621071b3ea]
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.131-2.b11.30.amzn1.x86_64/jre/lib/amd64/server/libjvm.so(+0x443557)[0x7f6210555557]
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.131-2.b11.30.amzn1.x86_64/jre/lib/amd64/server/libjvm.so(+0x443928)[0x7f6210555928]
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.131-2.b11.30.amzn1.x86_64/jre/lib/amd64/server/libjvm.so(+0x989ee3)[0x7f6210a9bee3]
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.131-2.b11.30.amzn1.x86_64/jre/lib/amd64/server/libjvm.so(+0x8e0391)[0x7f62109f2391]
/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.131-2.b11.30.amzn1.x86_64/jre/lib/amd64/server/libjvm.so(+0x8e17b7)[0x7f62109f37b7]
View A.java
public class A implements IF {
public void foo(Object arg) {
}
}
View flags
-XX:+UseSerialGC
-XX:InitialCodeCacheSize=4m -XX:ReservedCodeCacheSize=16m
-XX:-TieredCompilation -XX:CompressedClassSpaceSize=16m
-XX:MinMetaspaceExpansion=1M -XX:MaxMetaspaceExpansion=8M -XX:MaxMetaspaceSize=64m
-XX:MaxDirectMemorySize=16m
-noverify -Xmn16m -Xss265k -Xms40m -Xmx40m
@CodingFabian
CodingFabian / jep.md
Created Aug 5, 2016
Command Line Flag for suggested Processor Count
View jep.md

// // JDK Enhancement Proposal ("JEP") body template, v2.0 // // ==> Delete all lines starting with "//" // before entering a proposal into JBS // // Instances of this template are meant to be evolving documents. When // you initially draft a JEP you don't need to fill out every section of // the template, and in fact at that point you probably won't be able to // do so. As you get feedback and build consensus around your proposal

View jetty.java
HTTP2Client client = new HTTP2Client();
SslContextFactory sslContextFactory = new SslContextFactory(true);
HTTP2ClientConnectionFactory h2 = new HTTP2ClientConnectionFactory();
client.setClientConnectionFactory(h2);
client.addBean(h2);
client.addBean(sslContextFactory);
client.start();
FuturePromise<Session> sessionPromise = new FuturePromise<>();
client.connect(sslContextFactory, new InetSocketAddress(host, port), new ServerSessionListener.Adapter(), sessionPromise);
View simple karaf init.d
#!/bin/bash
export JAVA_HOME=/opt/jdk1.8.0_60
KARAF_HOME=/opt/apache-karaf
$KARAF_HOME/bin/status > /dev/null
case $1 in
start)
if [ "$?" -eq "1" ]; then
@CodingFabian
CodingFabian / FileAccess.java
Last active Apr 12, 2018
Nio vs Io File Absence performance
View FileAccess.java
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.Scope;
import org.openjdk.jmh.annotations.State;
// uses counter to ensure we get a cache miss from whatever might be caching
@State(Scope.Thread)
public class FileAccess {