Practice meeting, Jan. 22nd

8 views
Skip to first unread message

Lyle Kopnicky

unread,
Jan 18, 2020, 3:58:23 PM1/18/20
to pdxfunc
When: Monday, Jan 22th, 2020, 6:30-8:30pm

Where: Collective Agency Downtown, Suite 1108, 511 SW 10th Ave, Portland, OR (opposite side of the floor from the elevators)

From Chapter 14, "Distributed Programming", of Parallel and Concurrent Programming in Haskell, we'll discuss the distributed key-value store exercise. You are encouraged to try it yourself beforehand. At the meeting anyone will be able to present and contribute to the discussion. If we have time remaining, we will start reading through Chapter 15, "Debugging, Tuning, and Interfacing with Foreign Code".

Meetup link to RSVP:

Hope to see you then!

Lyle Kopnicky

unread,
Jan 18, 2020, 4:03:36 PM1/18/20
to pdxfunc
My mistake - the meeting is on January 20th, not January 22nd.

Lyle Kopnicky

unread,
Feb 17, 2020, 4:31:07 PM2/17/20
to pdxfunc
We concluded Chapter 14 and the distributed key-value store exercise.

Although I was able to solve Parts 1-3, I knew that my solution would run into trouble with Part 4, when replicating the database between nodes for fault tolerance. This is because each replica will return a response, but we only look at one of the messages. So the other responses will stay queued up, and be read the next time we make a request, thus tying together the responses to the wrong request.

We looked at Marlow's solution from the Github repo, and he had a much better way of doing it. Instead of sending every message over to the main untyped channel for the requesting process, generate a separate typed channel per request. Send the "sending" end of that channel along with the original request. Then even if both replicas respond, after we read the response, we close the channel, throwing away the other response.

It's a good general principle to follow when constructing application using distributed-process: any message for which you expect a response should be sent along with its own new channel by which the response will be returned.

- Lyle
Reply all
Reply to author
Forward
0 new messages