Skip to content

Instantly share code, notes, and snippets.

@dormando
dormando / gist:5e85c1c3d0015e79e9d22c2c3e155129
Created September 4, 2020 20:00
example POC proxy configuration.
-- local zone could/should be fetched from environment or local file.
-- doing so allows all configuration files to be identical, simplifying consistency checks.
local my_zone = 'z1'
function mcp_config_selectors(oldss)
-- alias mcp.server for convenience.
-- important to alias global variables in routes where speed is concerned.
local srv = mcp.server
-- local zones = { 'z1', 'z2', 'z3' }
@dormando
dormando / gist:a138a9a63b4c17e0b3d11a8f8cb7de1d
Created January 20, 2019 00:22
when I say "I enjoyed writing perl", these are the little things that add up
$ perldoc
Usage: perldoc [-hVriDtumUFXlT] [-n nroffer_program]
[-d output_filename] [-o output_format] [-M FormatterModule]
[-w formatter_option:option_value] [-L translation_code]
PageName|ModuleName|ProgramName
Examples:
perldoc -f PerlFunc
perldoc -q FAQKeywords
gcc -g -O2 -pthread -pthread -Wall -Werror -pedantic -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -lseccomp -o memcached memcached-memcached.o memcached-hash.o memcached-jenkins_hash.o memcached-murmur3_hash.o memcached-slabs.o memcached-items.o memcached-assoc.o memcached-thread.o memcached-daemon.o memcached-stats.o memcached-util.o memcached-bipbuffer.o memcached-logger.o memcached-crawler.o memcached-itoa_ljust.o memcached-cache.o memcached-linux_priv.o -levent
memcached-linux_priv.o: In function `drop_privileges':
/git/memcached/linux_priv.c:12: undefined reference to `seccomp_init'
/git/memcached/linux_priv.c:18: undefined reference to `seccomp_rule_add'
/git/memcached/linux_priv.c:19: undefined reference to `seccomp_rule_add'
/git/memcached/linux_priv.c:20: undefined reference to `seccomp_rule_add'
/git/memcached/linux_priv.c:21: undefined reference to `seccomp_rule_add'
/git/memcached/linux_priv.c:22: undefined reference to `seccomp_rule_add'
memcached-linux_priv.o:/git/memcache
@dormando
dormando / gist:af7a4418210ea4609d64
Last active August 29, 2015 14:11
mget bandwidth test
./memcached -t 32 -m 2000 -o hash_algorithm=murmur3
2 byte value sizes (10-20 bytes per key in response)
cmd_get avg/s ( 4/s sample): 20877372.2484227
cmd_set avg/s ( 4/s sample): 0
get_hits avg/s ( 4/s sample): 20877372.2484227
cmd_get avg/s ( 4/s sample): 20164041.5051711
cmd_set avg/s ( 4/s sample): 0
get_hits avg/s ( 4/s sample): 20164041.5051711
@dormando
dormando / gist:8833c8db028d73d71915
Created December 17, 2014 18:13
single key per get test
./memcached -t 16 -m 2000 -o hash_algorithm=murmur3
single keys per request. small size.
cmd_get avg/s ( 4/s sample): 1839021.74880433
cmd_set avg/s ( 4/s sample): 0
get_hits avg/s ( 4/s sample): 1839021.74880433
cmd_get avg/s ( 4/s sample): 1779819.53294892
cmd_set avg/s ( 4/s sample): 0
get_hits avg/s ( 4/s sample): 1779819.53294892
cmd_get avg/s ( 4/s sample): 1768751.01097961
./memcached -t 16 -m 2000 -o hash_algorithm=murmur3
200,000 items loaded.
mget=50 test. ascii protocol.
cmd_get avg/s ( 4/s sample): 14471090.2723673
cmd_set avg/s ( 4/s sample): 0
get_hits avg/s ( 4/s sample): 14471090.2723673
cmd_get avg/s ( 4/s sample): 14842022.182218
cmd_set avg/s ( 4/s sample): 0
get_hits avg/s ( 4/s sample): 14842022.182218
@dormando
dormando / gist:3120414
Created July 16, 2012 04:01
stock memcached with slab rebalancer turbo edition

Pseudo-random eviction

https://github.com/dormando/memcached/tree/slab_boost (the branch is here since it's not been merged into mainline yet)

I've made some small modifications to the slab rebalancing system to make it more aggressive. You can now reassign memory between classes all you want, compared to having to wait for a class to use up all the new items you just moved to it. The rebalancer and automover are now actually separate threads, instead of separate processes in the same thread. The rebalancer waits for a kickoff from a "slabs_reassign" command and immediately chews through memory. This command may be kicked off manually, via the slow automover (now known as automove=1), and via a new pants-on-fire "move slab page on first eviction" mode (automove=2).

memcached v1.4.13-slab_boost with slab_reassign,slab_automove=2

+---------------------------------------------------------+

@dormando
dormando / gist:3088511
Created July 11, 2012 06:50
twemcache vs memcached 1.4.13 super idiotic test
mc-crusher. cache daemons both running with -t 4 (default, four threads each)
conf/asciiconf (N conns, single key fetch per command)
twemcache: 430k/s peak
1.4.13: 478k/s peak
conf/mget_test (N conns, 50 keys fetched per command)
twemcache: 1.36m/s peak
@dormando
dormando / gist:1268659
Created October 6, 2011 20:58
delete+expire
set foo -> hi
-> (stored)
get foo
-> hi
delete foo 10
-> (deleted)
get foo
Memcached 1.4.1-rc1 Release Notes
=============================
Date: 2009-08-26 Wed
Table of Contents
=================
1 Download
2 Overview