Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Something seems weird #10

Open
JiffB opened this issue Sep 26, 2017 · 0 comments
Open

Something seems weird #10

JiffB opened this issue Sep 26, 2017 · 0 comments

Comments

@JiffB
Copy link

JiffB commented Sep 26, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant