Hi,
disclaimer: I'm a newbie, so not on the head (nor the balls !)
Trying to understand how the architecture works, I added io:format(…) almost everywhere in the tutorial example; the object of my question is about a part that seems to be static (always the same PID), thus, might be a choke point.
When clients call, they're requests are processed by different PID, so I understand it as parallelism, but one part stays "static" (I also made tests with a lot of clients, with the same result) - so, my question is:
is it because the PID is fast released an re-used immediately ?
or, if it means all requests pass through the same PID, it is a choke point?
(The question behind this being: I use this code to I/O large data, such as a PDF, from a regular DB, will it choke if more users ask for the same kind of data at the same time?)
Here is the logs:
GET msg client-2
1> mydb_client_handler:handle_command_line({ok, Data}, Socket)
mydb_client_handler:parse_command(Data)
mydb_client_handler:handle_command_re_result({match, [Command, Arg]})
mydb_client_handler:handle_command({"GET", Key}, Socket)
mydb_client_handler:db_get(Key)
mydb_data:get(Key) / <0.77.0>
mydb_data:handle_msg({get, Key}, _From, Db) / <0.69.0>
mydb_db:get(Db, Key) / <0.69.0>
mydb_db:handle_dets_lookup([{_Key, Value}]) / <0.69.0>
mydb_client_handler:handle_reply(Reply, Socket) / Reply = {ok,"TEST MSG"}
mydb_client_handler:send_reply({ok, Val}, Socket)
mydb_client_handler:handle_task(Socket)
mydb_client_handler:read_line(Socket)
GET msg client-1
1> mydb_client_handler:handle_command_line({ok, Data}, Socket)
mydb_client_handler:parse_command(Data)
mydb_client_handler:handle_command_re_result({match, [Command, Arg]})
mydb_client_handler:handle_command({"GET", Key}, Socket)
mydb_client_handler:db_get(Key)
mydb_data:get(Key) / <0.76.0> <<< PID IS ≠ FROM client-2 - OK
mydb_data:handle_msg({get, Key}, _From, Db) / <0.69.0> <<< PID IS = FROM client-2 - WEIRD (CHOKE POINT ???)
mydb_db:get(Db, Key) / <0.69.0>
mydb_db:handle_dets_lookup([{_Key, Value}]) / <0.69.0>
mydb_client_handler:handle_reply(Reply, Socket) / Reply = {ok,"TEST MSG"}
mydb_client_handler:send_reply({ok, Val}, Socket)
mydb_client_handler:handle_task(Socket)
mydb_client_handler:read_line(Socket)
Anyway, thanks for e2, as it helps a lot to understand how Erlang works.