Skip to content

Instantly share code, notes, and snippets.

Evan neomantra

Block or report user

Report or block neomantra

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@neomantra
neomantra / High_Performance_Redis.md
Last active Mar 22, 2019
Notes on running Redis with HPC techniques
View High_Performance_Redis.md

High Performance Redis

In response to this brief blog entry, @antirez tweeted for some documentation on high-performance techniques for Redis. What I present here are general high-performance computing (HPC) techniques. The examples are oriented to Redis. but they work well for any program designed to be single- or worker-threaded and asynchronous (e.g. uses epoll).

The motivation for using these techniques is to maximize performance of our system and services. By isolating work, controlling memory, and other tuning, you can achieve significant reduction in latency and increase in throughput.

My perspective comes from the microcosm of my own bare-metal (vs VM), on-premises deployment. It might not be suitable for all scenarios, especially cloud deployments, as I have little experience with HPC there. After some discussion, maybe this can be adapted as [redis.io documentation](https://redis.io/do

@neomantra
neomantra / taskset_child_threads.sh
Created Mar 11, 2019
Invokes `taskset` on the child threads of the specified processes.
View taskset_child_threads.sh
#!/bin/bash
# Copyright 2013-2019 Neomantra BV. All rights reserved.
# Released under the MIT License.
usage()
{
cat >&2 <<EOF
usage: $0 [-h] [-v] [-c cpulist] ppid1 [ppid2 [...]]
Given a list of parent process IDs, this script finds their child
View Dockerfile.lua_ipython_kernel
# Builds lua_ipython_kernel on centos
ARG IMAGE_BASE="centos"
ARG IMAGE_TAG="7"
FROM ${IMAGE_BASE}:${IMAGE_TAG}
RUN yum install -y \
epel-release \
&& yum install -y \
@neomantra
neomantra / Dockerfile_cpp
Created Sep 19, 2017
Aeron C++ Dockerfile
View Dockerfile_cpp
# Dockerfile for Aeron C++ SDK
#
# Copyright (c) 2017 Neomantra BV
# Released under the MIT License, see LICENSE.txt
FROM debian:stretch-slim
MAINTAINER Evan Wies <evan@neomantra.net>
ARG AERON_VERSION="master"
View bson_float_test.c
/// cc -o bson_float_test bson_float_test.c -lbson-1.0.0
#include <stdio.h>
#include <libbson-1.0/bson.h>
int main(int argc, const char* argv[])
{
bson_t b;
bson_init(&b);
@neomantra
neomantra / tuple_iter_inline.cpp
Created Dec 15, 2016
experiment with tuple iteration, boost::fusion versus manual template recursion.
View tuple_iter_inline.cpp
#include <iostream>
#include <boost/fusion/adapted/std_tuple.hpp>
#include <boost/fusion/algorithm/iteration/for_each.hpp>
struct One {
int value() const { return 1+rand(); }
};
struct Two {
int value() const { return 2+rand(); }
@neomantra
neomantra / tuple_iter_inline.cpp
Created Dec 15, 2016
experiment with tuple iteration, boost::fusion versus manual template recursion.
View tuple_iter_inline.cpp
#include <iostream>
#include <boost/fusion/adapted/std_tuple.hpp>
#include <boost/fusion/algorithm/iteration/for_each.hpp>
struct One {
int value() const { return 1+rand(); }
};
struct Two {
int value() const { return 2+rand(); }
View matrix_bench_ffi.lua
local ffi = require("ffi")
local new = ffi.new
--[[
All numeric calculations are performed with doubles. Using
floats for storage saves memory (for big arrays). But arithmetic
is usually slower due to the required float<->double conversions.
]]
local Matrix
local MatrixStructure = ffi.typeof("double[16]")
@neomantra
neomantra / bcname.lua
Created Apr 10, 2014
Convert LuaJIT bytecode number to name.
View bcname.lua
-- Converts a LuaJIT bytecode number to name
--
-- usage: luajit bcname.lua bytecode_number [bytecode_number2 [...]]
--
-- example:
-- $ luajit-2.1 bcname.lua 71 72
-- VARG
-- ISNEXT
--
-- From: http://www.freelists.org/post/luajit/frames-and-tail-calls,1
@neomantra
neomantra / output.txt
Last active Aug 29, 2015
FFI serializer fake metamethod
View output.txt
$ luajit ~/Desktop/serialize_metamethod.lua
2 =%= 3
cdata<struct 98>: 0x0004d738
You can’t perform that action at this time.