Cache service example. It uses fasthttp as an http server and bigcache as the cache.
External benchmarks are provided.
go run main.go
Server listens on 8080 port.
#!/usr/bin/env bash | |
COWS_PATH="/usr/local/share/cows" | |
COW_FILES=($(ls $COWS_PATH)) | |
COWS=${#COW_FILES[@]} | |
rand_cow() { | |
#RAND_IDX=$(($RANDOM % $COWS)) | |
RAND_IDX=$((`od -vAn -N4 -tu4 < /dev/urandom` % $COWS)) |
#!/usr/bin/env bash
# Assuming OS X Yosemite 10.10.4
# Install XCode and command line tools
# See https://itunes.apple.com/us/app/xcode/id497799835?mt=12#
# See https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/xcode-select.1.html
xcode-select --install
/** | |
* Written by Gil Tene of Azul Systems, and released to the public domain, | |
* as explained at http://creativecommons.org/publicdomain/zero/1.0/ | |
*/ | |
package org.HdrHistogram; | |
import java.util.concurrent.TimeUnit; | |
import java.util.concurrent.atomic.AtomicLongFieldUpdater; | |
import java.util.concurrent.locks.ReentrantLock; |
import com.yammer.metrics.Metrics | |
import com.yammer.metrics.core.{Gauge, MetricName} | |
import management.{RuntimeMXBean, ManagementFactory} | |
import com.sun.management.UnixOperatingSystemMXBean | |
class PercentCpuGauge extends Gauge[Double] { | |
val runBean: RuntimeMXBean = ManagementFactory.getRuntimeMXBean | |
val osBean: UnixOperatingSystemMXBean = ManagementFactory.getOperatingSystemMXBean.asInstanceOf[UnixOperatingSystemMXBean] |
#!/usr/bin/env sh | |
# Download lists, unpack and filter, write to stdout | |
curl -s https://www.iblocklist.com/lists.php \ | |
| sed -n "s/.*value='\(http:.*=bt_.*\)'.*/\1/p" \ | |
| xargs wget -O - \ | |
| gunzip \ | |
| egrep -v '^#' |