Skip to content

Instantly share code, notes, and snippets.

View normanmaurer's full-sized avatar
🤙

Norman Maurer normanmaurer

🤙
View GitHub Profile
#!/bin/bash
if [[ $# -lt 0 ]] || [[ $# -gt 2 ]]; then
echo "Usage: $0 <pull request id> [<directory>]"
fi
PULL_REQ_ID="$1"
if [[ "x$2" != 'x' ]]; then
cd "$2" || exit 1
private static final Map<Class<?>, Boolean> SHARABLE_CACHE = PlatformDependent.newConcurrentHashMap();
// Not using volatile because it's used only for a sanity check.
boolean added;
/**
* Return {@code true} if the implementation is {@link Sharable} and so can be added
* to different {@link ChannelPipeline}s.
*/
public boolean isSharable() {
http://people.freebsd.org/~jasone/jemalloc/bsdcan2006/jemalloc.pdf
https://www.facebook.com/notes/facebook-engineering/scalable-memory-allocation-using-jemalloc/480222803919
http://www.downvids.net/scalable-memory-allocation-using-jemalloc-tech-talk-1-11-2011--505622.html
non thread local cache:
http://snag.gy/mKnnT.jpg
[nmaurer@mouth]~% wrk/wrk -H 'Host: localhost' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' -H 'Connection: keep-alive' -d 600 -c 256 -t 16 --pipeline 256 http://192.168.123.24:8080/plaintext
Running 10m test @ http://192.168.123.24:8080/plaintext
16 threads and 256 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 302.75ms 519.32ms 1.64s 77.30%
Req/Sec 137.23k 77.77k 241.56k 73.61%
1315609856 requests in 10.01m, 177.66GB read
private static int index(int val) {
int res = 0;
while (val > 1) {
val >>= 1;
res++;
}
return res;
}
System.out.println(8192 + " "+ index(8192 >> 13));
int i = normalizeCapacity(8192);
/ i ist immer power of 2
int indexOfArray = getIndex(i);
final static class SubPagePoolChunkCache<T> extends PoolChunkCache<T> {
SubPagePoolChunkCache(int size) {
super(size);
}
@Override
protected void initBuf(
PoolChunk<T> chunk, long handle, PooledByteBuf<T> buf, int reqCapacity, int normCapacity) {
chunk.initBufWithSubpage(buf, handle, reqCapacity, normCapacity);
/*
* Copyright 2012 The Netty Project
*
* The Netty Project licenses this file to you under the Apache License,
* version 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
[nmaurer@mouth]~% wrk/wrk -H 'Host: localhost' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' -H 'Connection: keep-alive' -d 120 -c 256 -t 16 --pipeline 256 http://192.168.123.24:8080/plaintext
Running 2m test @ http://192.168.123.24:8080/plaintext
16 threads and 256 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 21.02ms 49.32ms 1.08s 98.86%
Req/Sec 220.72k 48.46k 426.85k 76.21%
409282750 requests in 2.00m, 55.27GB read
Socket errors: connect 0, read 2317, write 2, timeout 126
Non-2xx or 3xx responses: 8426
Requests/sec: 3410714.48
# mpscqueue
[nmaurer@mouth]~% wrk/wrk -H 'Host: localhost' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' -H 'Connection: keep-alive' -d 120 -c 256 -t 16 --pipeline 256 http://192.168.123.24:8080/plaintext
Running 2m test @ http://192.168.123.24:8080/plaintext
16 threads and 256 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 23.14ms 18.78ms 388.48ms 90.68%
Req/Sec 188.70k 43.46k 332.65k 70.59%
359277675 requests in 2.00m, 48.52GB read
Requests/sec: 2994005.87
Transfer/sec: 414.02MB