Open vinhnglx opened 7 years ago
:erlang.term_to_binary/1
to accept an Erlang term and returns an encoded byte sequence as a binary value.:erlang.binary_to_term/1
to decodecast
promotes scalability of the system. Because of cast
for asynchronous request. def store(key, data) do
# use an alias have a downside is that you can only run one instance of database server process
GenServer.cast(:database_server, {:store, key, data})
end
Casts allow client processes to move on immediately after a request is issued.
This comes at cost of Consistency.
__MODULE__
is used to specify the name of the current module. We can write module name instead but__MODULE__
guards the code against a possible change of the module name.and the test case may be
So, in the future, if we have multiple clients issue requests to the single Kito.Cache process, this cause a bottleneck. Because we only have one Kito.Cache process and you can handle only one server process simultaneously, regardless of how many CPU resources you have.
In general, a single process Kito.Cache can handle only one request at a time. If the client request handling takes 1 second then you can only process 60 requests per minute - your system won't be able to handle higher loads.