Mecking riakc_pb_socket:get/3

2015-11-02 Thread Michael Martin

Hi all,

I'm trying to meck riakc_pb_socket:get/3 in my eunit tests, and 
consistently get a function_clause error.


The meck:expect looks like:

meck:expect(riakc_pb_socket, get, [Pid, ?RIAK_TYPE_AND_BUCKET, 
?TestOid], {ok, ?TestRiakObject}),


where Pid is a pid, the macro ?RIAK_TYPE_AND_BUCKET evaluates to 
{<<"buckettype">>, <<"bucketname">>},
and ?TestOid evalutes to 
<<"809876fd89ac405680b7251c2e57faa30004524100486220">>).


With the exception of the Pid, the other arguments, as well as the 
expected response, are taken from a live,

running system, where the call to riakc_pb_socket:get/3 works as expected.

Looking at the source for riakc_pb_socket:get/3, I see that the -spec 
looks like:


-spec get(pid(), bucket(), key()) -> {ok, riakc_obj()} | {error, term()}.

and the types bucket() and key() are defined as:
-type bucket() :: binary(). %% A bucket name.
-type key() :: binary(). %% A key name.

In reality, when using bucket types, shouldn't the bucket() type be a 
tuple? At any rate, changing it

to tuple() didn't help my case any.

Can anyone show me an example of a working meck:expect for 
riakc_pb_socket:get/3?


Thanks,
Michael

___
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com


Latency of Riak KV drops with small size server goes long

2015-11-02 Thread mtakahashi-ivi
I use Riak KV with small size server(c4.xlarge@AWS 1 instance). When I run
riak several days, latency of riak KV seems to be long.
So I checked latency of riak KV by using basho bench with smaller server. At
first, I checked write latency.
My questions are
1. Why write latency drops continuously? How can I avoid it?
2. yokozuna Java process becoms to allocate big siz of memory.
   Initially it is about 500MB, finally it become 2GB. JVM option set in
search.solr.jvm_options is "-Xmx1g", 2GB exceeds the value.
   Is it normal behavior?
3. Write latency also periodically drops every about 1 sec. What is this
cicle?

-- Result summary ---
 

-- Benchmark environment ---
Basho bench server:
 c4.xlarge: 7.5GB RAM

Riak KV Server:
 c4.large: 3.75GB RAM

Riak version: 2.1.1
riak.conf:
 ring_size = 16
 storage_backend = leveldb
 search = on
 Any others except server addresses are same as default value.

Bucket property:
 {
   "props": {
 "name": "BUCKET_A",
 "active": true,
 "allow_mult": false,
 "basic_quorum": false,
 "big_vclock": 50,
 "chash_keyfun": {
   "mod": "riak_core_util",
   "fun": "chash_std_keyfun"
 },
 "claimant": "riak@172.31.0.160",
 "dvv_enabled": true,
 "dw": "quorum",
 "last_write_wins": false,
 "linkfun": {
   "mod": "riak_kv_wm_link_walker",
   "fun": "mapreduce_linkfun"
 },
 "n_val": 1,
 "notfound_ok": false,
 "old_vclock": 86400,
 "postcommit": [],
 "pr": 0,
 "precommit": [],
 "pw": 0,
 "r": 1,
 "rw": "quorum",
 "search_index": "BUCKET_A_SEARCH_INDEX",
 "small_vclock": 50,
 "w": 1,
 "young_vclock": 20
   }
 }

Basho bench configuration:
 "json_v" is not real one. I modified field names for this report.
-
{mode, max}.

{duration, 4320}.

{concurrent, 300}.

{driver, basho_bench_driver_http}.

 %% Preload 1 million keys
{key_generator, {int_to_str, {uniform_int, 1}}}.
{value_generator, {fixed_bin, 100}}.

{generators, [
{string_g, {key_generator, {int_to_str, {uniform_int, 5,
{bucket_g, {key_generator, {int_to_str, {uniform_int, 3
]}.

{values, [
{json_v,
{"{\"attr1_i\":0,\"attr2_i\":0,\"attr3_s\":\"~s\",\"attr4_s\":\"\",\"attr5_i\":4,\"attr6_i\":318,\"attr7_i\":9,\"attr8_i\":4,\"attr9_i\":14,\"attr10_i\":1010,\"attr11_i\":1005,\"attr12_i\":1015,\"attr13_i\":30,\"attr14_i\":15,\"attr15_i\":45,\"attr16_i\":19,\"attr17_i\":14,\"attr18_i\":24,\"attr19_i\":1,\"attr20_l\":1446088404435,\"attr21_i\":1,\"attr22_s\":\"TEST:tstff:310\",\"attr23_i\":3,\"attr24_s\":\"TESTtstff310\",\"attr25_l\":1445869988879,\"attr26_l\":1446088413157,\"attr27_i\":6473}",
[string_g]}}
]}.

{headers, [
{json_h, [{'Content-Type', 'application/json'}]}
]}.

{targets, [
  {map_targets, [
{"172.31.0.160", 8098, {"/types/BUCKET_TYPE_A/buckets/BUCKET_A/keys/~s",
[key_generator]}}
]}
]}.


{operations, [
{{post, map_targets, json_v, json_h}, 1}
]}.
-




--
View this message in context: 
http://riak-users.197444.n3.nabble.com/Latency-of-Riak-KV-drops-with-small-size-server-goes-long-tp4033651.html
Sent from the Riak Users mailing list archive at Nabble.com.

___
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com