Closed windkit closed 7 years ago
Fixed
%% log/app/error
[E] gateway_0@127.0.0.1 2016-12-22 12:11:46.320087 +0900 1482376306 leo_gateway_app:after_process_0/1 226
[{cause,{{invalid_configuration,"(8 * 1024 * 1024) * ${cache.cache_workers} >= ${cache.cache_ram_capacity}"},
[{leo_gateway_app,get_options,0,[{file,"src/leo_gateway_app.erl"},{line,576}]},
{leo_gateway_app,after_process_1,2,[{file,"src/leo_gateway_app.erl"},{line,255}]},
{leo_gateway_app,after_process_0,1,[{file,"src/leo_gateway_app.erl"},{line,221}]},
{application_master,start_it_old,4,[{file,"application_master.erl"},{line,273}]}]}}]
%% log/app/error
[E] gateway_0@127.0.0.1 2016-12-22 13:39:17.881906 +0900 1482381557 leo_gateway_app:after_process_0/1 225
[{cause,{{invalid_configuration,"(8 * 1024 * 1024) * ${cache.cache_workers} >= ${cache.cache_disc_capacity}"},
[{leo_gateway_app,get_options,0,[{file,"src/leo_gateway_app.erl"},{line,582}]},
{leo_gateway_app,after_process_1,2,[{file,"src/leo_gateway_app.erl"},{line,254}]},
{leo_gateway_app,after_process_0,1,[{file,"src/leo_gateway_app.erl"},{line,221}]},
{application_master,start_it_old,4,[{file,"application_master.erl"},{line,273}]}]}}]
Description
There is implicit lower bound of memory cache capacity in
leo_gateway
, you need at least8*1024*1024 bytes (8 MB)
for each cache worker.On the other hand, there is a implicit upper limit for memory cached object at
8*1024*1024 bytes (8 MB)
Users are not aware about the limitation and fail to meet the requirements actually shuts down the memory cache.
Implicit Lower Bound for Memory Cache Capacity
We can test with leo_mcerl unit test. At https://github.com/leo-project/leo_mcerl/blob/develop/test/test_leo_mcerl.erl#L40 Setting the capacitiy to
8 * 1024 * 1024 - 1
causes test case to fail.Effect in GW
Memory Cache does not work,
leo_cache_api:put/2
always fails.(p.s. oom is always returned when there is error in
leo_mcerl/c_src/leo_mcerl_nif.c
)Underlying Cause
At https://github.com/leo-project/leo_mcerl/blob/develop/c_src/leo_mcerl_nif.c#L49
Setting the max to other value would adjust the minimum requirement accordingly.
Implicit Upper Bound for Memory Cached Object
Effect in GW
Object larger than
8 MB
but smaller thancache.cache_disc_threshold_len
would not be cached (Not large enough for Disk Cache, Too large for Memory Cache)Underlying Cause
At https://github.com/leo-project/leo_mcerl/blob/develop/c_src/leo_mcerl_nif.c#L49
Summary
Inside
leo_mcerl/c_src/leo_mcerl_nif.c
, there is a hard-coded limit8 * 1024 * 1024 (8 MB)