This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final_key_lookup(Good, Bad, N, Const, ResolveFun, NotFoundFun, Access) -> | |
{NotFound, Reasons} = NotFoundFun(Bad, Const), | |
if | |
length(Good) >= Const -> {ok, ResolveFun(Good)}; | |
NotFound -> {ok, not_found, Reasons}; | |
true -> error_message(Good, Bad, N, Const, Access) | |
end. | |
% and |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%----------------------------------------------------------------- | |
%% Func: get_supervised_procs/0 | |
%% Purpose: This is the magic function. It finds all process in | |
%% the system and which modules they execute as a call_back or | |
%% process module. | |
%% This is achieved by asking the main supervisor for the | |
%% applications for all children and their modules | |
%% (recursively). | |
%% NOTE: If a supervisor is suspended, it isn't possible to call | |
%% which_children. Code change on a supervisor should be |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
grep -n -e \(gen_server\) /Users/brad/dev/erlang/dbcore/src/couchdb/*.erl /dev/null | |
/Users/brad/dev/erlang/dbcore/src/couchdb/couch_batch_save.erl:15:-behaviour(gen_server). | |
/Users/brad/dev/erlang/dbcore/src/couchdb/couch_config.erl:20:-behaviour(gen_server). | |
/Users/brad/dev/erlang/dbcore/src/couchdb/couch_db.erl:14:-behaviour(gen_server). | |
/Users/brad/dev/erlang/dbcore/src/couchdb/couch_db_updater.erl:14:-behaviour(gen_server). | |
/Users/brad/dev/erlang/dbcore/src/couchdb/couch_event_sup.erl:18:-behaviour(gen_server). | |
/Users/brad/dev/erlang/dbcore/src/couchdb/couch_external_manager.erl:14:-behaviour(gen_server). | |
/Users/brad/dev/erlang/dbcore/src/couchdb/couch_external_server.erl:14:-behaviour(gen_server). | |
/Users/brad/dev/erlang/dbcore/src/couchdb/couch_file.erl:14:-behaviour(gen_server). | |
/Users/brad/dev/erlang/dbcore/src/couchdb/couch_os_process.erl:14:-behaviour(gen_server). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(couchdb1@boorad)33> membership2_load:run(). | |
/Users/brad/dev/erlang/dbcore/src/dynomite/test/membership2_load.erl:19: membership can do 8259.786714444186 reqs/s | |
/Users/brad/dev/erlang/dbcore/src/dynomite/test/membership2_load.erl:24: | |
Avgs: [[], | |
[{config,4.0014815330505374e-5}, | |
{hashing,4.805948734283447e-5}, | |
{nodes,1.1756324768066407e-5}]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(membership2_load). | |
-include("../include/common.hrl"). | |
-export([load_nodeparts_for_key/0, start/0, stop/0, run/0]). | |
-define(IDS, [config, hashing, nodes]). | |
load_nodeparts_for_key() -> | |
%% {ok, _} = membership2:start_link(a, [a,b,c,d,e,f]), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%% nodeparts_for_key | |
handle_call({nodeparts_for_key, Key}, _From, | |
State = #membership{partitions=PMap}) -> | |
?prof(config), | |
Config = configuration:get_config(), | |
?forp(config), | |
?prof(hashing), | |
Hash = lib_misc:hash(Key), | |
Part = partitions:hash_to_partition(Hash, Config#config.q), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
NODE1="ec2-blah1.compute-1.amazonaws.com" | |
NODE2="ec2-blah2.compute-1.amazonaws.com" | |
NODE3="ec2-blah3.compute-1.amazonaws.com" | |
NODE4="ec2-blah4.compute-1.amazonaws.com" | |
while [ $# -gt 0 ]; do | |
case "$1" in | |
"1") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
check_nodes() -> | |
ErlangNodes = lists:usort([node() | erlang:nodes()]), | |
{ok, MemNodeList} = membership2:nodes(), | |
MemNodes = lists:usort(MemNodeList), | |
{ok, PMap} = partitions(), | |
{PMapNodeList, _PMapPartList} = lists:unzip(PMap), | |
PMapNodes = lists:usort(PMapNodeList), | |
case ErlangNodes =:= MemNodes andalso | |
ErlangNodes =:= PMapNodes andalso | |
MemNodes =:= PMapNodes of |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all_nodes_parts(AndPartners) -> | |
{ok, PMap} = partitions(), | |
all_nodes_parts(PMap, AndPartners). | |
all_nodes_parts(PMap, AndPartners) -> | |
NodeParts2 = | |
case AndPartners of | |
true -> | |
{Nodes, _Parts} = lists:unzip(PMap), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%%% -*- erlang-indent-level:2 -*- | |
%%%------------------------------------------------------------------- | |
%%% File: membership2.erl | |
%%% @author Cliff Moon <[email protected]> [] | |
%%% @copyright 2009 Cliff Moon | |
%%% @doc | |
%%% | |
%%% @end | |
%%% | |
%%% @since 2009-05-04 by Cliff Moon |