Skip to content

Instantly share code, notes, and snippets.

@danielmai
danielmai / 1_summary.md
Last active January 11, 2024 01:32
fio tests on aws instances

Summary: Fio tests

r5.2xlarge

r5.2xlarge instance in eu-west-1 with 200 GB EBS io1 volume and 3000 IOPS.

@MaZderMind
MaZderMind / ConnectionHandler.java
Last active March 27, 2020 15:15
Example of a Nonblokcing Socket-Server with java.nio which reads Input Line-by-Line.
package de.mazdermind;
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.CharBuffer;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.SocketChannel;
import java.nio.charset.Charset;
import java.nio.charset.CharsetDecoder;
import java.nio.charset.CharsetEncoder;
@jasonkeene
jasonkeene / go-intro.md
Last active May 25, 2019 18:28
Notes for the Programming Languages Club session on Go

Go is an imperative, compiled, statically-typed, garbage-collected, concurrent, general purpose programming language. It emphasizes fast compilation, fast execution, and a conservative, simple language design.

What is Go good for?

Server Software

Go has modern, native implementations of many networking protocols.

@iffy
iffy / results.txt
Created November 5, 2018 16:22
Small, probably non-representative benchmark of JSON Changelog with SQLite https://blog.budgetwithbuckets.com/2018/08/27/sqlite-changelog.html
python testsqlite.py 10000 :memory: 0
6.65568494797 seconds to do 10000 records db=:memory:, triggers=False
6.66251087189 seconds to do 10000 records db=:memory:, triggers=False
6.69321203232 seconds to do 10000 records db=:memory:, triggers=False
python testsqlite.py 10000 :memory: 1
6.76699709892 seconds to do 10000 records db=:memory:, triggers=True
6.82708096504 seconds to do 10000 records db=:memory:, triggers=True
6.82913088799 seconds to do 10000 records db=:memory:, triggers=True

Concurrency

Concurrent applications also make optimal use of the processors. But concurrent applications are difficult to develop, maintain, and debug. To develop thread-safe, high-performance, and scalable applications, Java’s low-level threading capabilities are insufficient.

Concurrent collection classes

The java.util.concurrent package includes a number of additions to the Java Collections Framework. These are most easily categorized by the collection interfaces provided:

  • BlockingQueue defines a first-in-first-out data structure that blocks or times out when you attempt to add items to a full queue, or retrieve from an empty queue.

pprof

With a single import _ "net/http/pprof" you can add profiling endpoints to a HTTP server.

package main

import (
	"fmt"
@BarDev
BarDev / 01 - create-kubernetes-cluster-gossip-aws.md
Last active September 15, 2018 23:48
Create Kubernetes Cluster Gossip on AWS

Create Kubernetes Cluster with KOPS using Gossip

See - Setup Minikube on Mac - by Wes Duff

https://github.com/wesleyduff/microservicesNode

Create Kops Credentials

aws iam create-group --group-name kops

aws iam attach-group-policy --group-name kops \
@silkeh
silkeh / grace.go
Created June 4, 2018 07:27
Golang graceful restart with TCP connections
package main
import (
"encoding/json"
"flag"
"io/ioutil"
"log"
"net"
"os"
"os/signal"
@nginx-gists
nginx-gists / api_backends.conf
Last active April 21, 2024 09:19 — forked from lcrilly/api_backends.conf
Deploying NGINX Plus as an API Gateway, Part 1
upstream warehouse_inventory {
zone inventory_service 64k;
server 10.0.0.1:80;
server 10.0.0.2:80;
server 10.0.0.3:80;
}
upstream warehouse_pricing {
zone pricing_service 64k;
server 10.0.0.7:80;
@AntoineCheron
AntoineCheron / basic-mono-creation.java
Last active October 30, 2022 23:42
Creation of a Mono
// Creating a Mono containing "Hello World !".
Mono<String> helloWorld = Mono.just("Hello World !");
// Creating an empty Mono
Mono<T> empty = Mono.empty();
// Creating a mono from a Callable
Mono<String> helloWorldCallable = Mono.fromCallable(() -> "Hello World !");
// Same with Java 8 method reference
Mono<User> user = Mono.fromCallable(UserService::fetchAnyUser);