r/mit6824clojure • u/TheLastSock • Feb 28 '21
r/mit6824clojure • u/TheLastSock • Jun 25 '20
r/mit6824clojure Lounge
A place for members of r/mit6824clojure to chat with each other
r/mit6824clojure • u/vh-6824 • Jan 03 '21
Meeting on Jan 3, 2021
The lounge has been archived, which is why I’ve created this new post. Is everyone up for meeting today?
r/mit6824clojure • u/ErnestoGarciaGarcia • Oct 13 '20
Implementing find-first-conflict Spoiler
Reading https://phillippe.siclait.com/blog/raft-in-clojure by /u/siclait, I found function find-first-conflict. I'm proposing an alternative implementation here:
(defn find-first-conflict
[prev-index log entries]
(assert (>= prev-index -1))
(let [log-entries (drop (inc prev-index) log)
indexes (iterate inc (inc prev-index))
non-equal-indexes (map #(when (not= %1 %2) %3)
entries log-entries indexes)]
(some identity non-equal-indexes)))r/mit6824clojure • u/ErnestoGarciaGarcia • Sep 29 '20
Distributed transactions: Topics for meeting
Some possible topics from my side:
What is actually the difference between the Atomic and Isolated features? Does Atomic only refer to failure cases?
Is there any case when a 2PC can fail? I think I saw one case in Wikipedia; we can discuss about it.
r/mit6824clojure • u/vatselan • Sep 21 '20
[RAFT] What happens when a disconnected old leader joins with only a remaining follower?
I need to understand the conceptual way to solve this situation. From lab 2b test name "TestRejoin2B" has a scenario in which old leader rejoins immediately after disconnecting the new leader. The followers have committed for index 2 and also has increased its term. Old leader is still sitting with previous term. What the follower must do to make the agreement?
r/mit6824clojure • u/ErnestoGarciaGarcia • Aug 25 '20
Lab code for Raft: Synchronous RPC calls
In the provided lab code, the RPC call function blocks and returns the response. I don't think we should assume that the underlying transport will support correlating responses with requests , nor does Raft make that assumption. For example, Raft would just work on top of UDP. I believe we should tweak the provided code so that we get responses asynchronously. What do you think?
r/mit6824clojure • u/ErnestoGarciaGarcia • Aug 24 '20
Best practices to implement a machine?
I have implemented Raft 2A, until the point where tests are running correctly.
I have intentionally approached the implementation naively, which means that, as I was adding features, I was just:
Adding fields to the main Raft data structure (a map or record in Clojure),
Adding or extending the functions that react to incoming messages, responses and timers by operating on this plain data structure.
I have experienced issues as the program grew, especially regarding the behavior of timers (starting, cancelling, resuming, etc, from many points of the code), to the point that I had to correct many bugs for the tests to run ok, and it is still difficult to reason from the code whether the implementation is correct.
From this, I would like to redo/refactor into an approach where:
Features can be added in a more composable way, so that the correctness of every feature of the Raft algorithm can be reasoned separately, and adding or modifying features does not involve touching others.
Make the implementation automatically testable with different concurrent scenarios, which includes abstracting time away.
Is this your experience? Thoughts? Suggestions?
r/mit6824clojure • u/ErnestoGarciaGarcia • Aug 02 '20
Atom's swap-vals! operation
Regarding an issue that we were discussing some weeks ago, I have just found out that there is the swap-vals! operation for atoms, which not only returns the atom's value after the swap, but it also returns the previous value.
r/mit6824clojure • u/zackteo • Jul 23 '20
Kyle Kingsbury (jepsen_io) Quarantine DB Talk on Monday July 27 @ 4:30pm ET
r/mit6824clojure • u/TheLastSock • Jul 12 '20
web crawler spoilers Spoiler
The gist below contains two solutions to the webcrawler written in clojure by me and another by adrian smith who was kind enough to give me some pointers.
r/mit6824clojure • u/TheLastSock • Jul 11 '20
web crawlers and locks
There was some discussion in our second meeting about the coordination mechanism used in the webcrawler. I think the specific task here is probably irreverent to the trade offs. Here are my thoughts so far without having dived back into the lab for specifics.
The problem can be reduced to a circular dependency between two nodes. If we let the webcrawlers (wc) start on separate nodes.
The trade off is that the more coordination you do the more time you spend syncing that information to a shared state. Going from relaxed to strict we have
no coordination - both crawls do the full graph.
eventual constant - wc's write the nodes they have traversed to a shared state but two might visit the same node.
edge coordination - master waits for every edge to report their desired edge traversals and then it dedupes and sends back assignments
r/mit6824clojure • u/TheLastSock • Jul 08 '20
Lecture two video alternative.
Lecture two is largely about rpc and concurrency in go. Sense were not using go this isn't ideal. Core async (aclojure lib) and go are both based on csp. With that in mind, I suggest the following videos as an alternative:
Rich on core async: https://youtu.be/drmNlZVkUeE Tim on using core async: https://youtu.be/096pIlA3GDo ( I haven't seen this one myself).
I can't recommend anything on rpc. It's not a topic I'm well versed on.
r/mit6824clojure • u/TheLastSock • Jul 05 '20
Looking for video meeting solution.
The goal is that I won't have to attend ever meeting and "admit" each person joining a video meeting. E.g For both zoom and google meet currently the host (by default the meeting creator/me) has to click accept on everyone that joins.
This isn't ideal because i can't afford to attend both versions of the meeting, A and B and will likely just attend A. But sometimes i probably won't be able to attend meeting A.
A solution to this is a video conferencing tool that lets you have unhosted meetings. Or one a system where invites can join a meeting and someone gets assigned the host (i could do this ahead of time maybe). Both google and zoom have this feature but you have to pay for the service, which isn't ideal unless we collectively want to chip in.
I spent about half an hour looking and confirming the feature exists in some form but is behind a paywall on the two services (google and zoom) that i'm familiar with.
extra notes
* zoom also has a 40 minute limit to meets but that might be ideal to keep things short.
* If someone has an account they can copy the calendar and create the meetings and i'll help to do the rest.
* we could just have a first web link wins strategy from the lounge around right at the meeting time.
r/mit6824clojure • u/TheLastSock • Jul 04 '20
Map reduce questions
Feel free to ask questions about map reduce here. Lab & and lecture
r/mit6824clojure • u/TheLastSock • Jun 28 '20
None distributed but multithread map reduce in clojure
Most clojure devs are familiar with map and reduce which are in clojure core
(->> [1 2 3]
(map inc)
(reduce +))
=> 9But there is another library in clojure that provides parallelism, its part of reducers:
(require '[clojure.core.reducers :as r])example pulled right from clojure docs
(defn count-occurrences [coll]
(r/fold
(r/monoid #(merge-with + %1 %2) (constantly {})) ;
(fn [m [k cnt]] (assoc m k (+ cnt (get m k 0)))) ;
(r/map #(vector % 1) (into [] coll)))) ;
(defn word-count [s]
(count-occurrences (.split #"\s+" s)))
(def war-and-peace "http://www.gutenberg.org/files/2600/2600-0.txt")
(def book (slurp war-and-peace))
(def freqs (word-count book))
(freqs "Andrew")
;
breaking this down
folds signature looks like this:
([reducef coll])
([combinef reducef coll] )
([n combinef reducef coll]))so this example here we can label the inputs so we can visualize better whats going on...
(defn count-occurrences [coll]
(r/fold
(r/monoid #(merge-with + %1 %2) (constantly {})) combinef
(fn [m [k cnt]] (assoc m k (+ cnt (get m k 0)))) reducef
(r/map #(vector % 1) (into [] coll)))) collthis operates over a multi threaded fork and join model to do map reduce in parallel. we should the arguments to fold from bottom to top follows the way things are processed
coll : the initial collection is split into chunks. e.g [hello 1] [hello 1] ...
reducef : this is where i believe individual jobs (thread, etc..) reduce the work there given so on a thread. you would see [hello 1] [hello 1] -> {:hello 2} as we add our words together
combinef** : this is where i believe the final "combining" effort is done across our works. Note, it's possible this logic is a duplicate of what reducef is going (hense the function arity with only 2 arguments). but in our case work on the prev thread {:hello 2} might be combined with another to yield {:hello 5}.
Note this isn't distributed in the sense that it runs across multiple computers, but some of the principles are the same. I was skimming over clojure core and hit this topic (again) and thought it would be interesting to share given the lecture topic this week (map reduce).
** i have no idea what -r/monoid is doing.
* title should read non-distributed
r/mit6824clojure • u/TheLastSock • Jun 27 '20
Class Launch!!
Some house keeping...
calendar: I set the first lecture review live meeting for next week. Check the calendar on the right for details. You should be able to sync that calendar so you get updates. let me know if thats not the case. Right now, largely just points to the official class links. We can fill in our calendar with details as we go. But it should be obvious that the first lecture is lec 1 and so on. You should read through the official class information as it clarifies dependence e.g you should read material before the video. Note that "lecture review - A" and "lecture review - B" are replicas, their the same meeting just at different times to give more options.
forum: This forum should largely be used to ask questions about the class, labs, etc... but It will likely serve as a way to make a few accoutrements and it might be ideal if you subscribe to notifications.
rules: We should make an effort to keep lab code private somehow, as in accordance with mits wishes.
need mods: It would be nice if someone volunteered to be a subreddit mod
chat: It looks like we can use reddit chat about what were learning
help: go to specific communities for help. e.g r/clojure for clojure questions and r/mit6824clojure for lab questions. I guess we can use r/distributed or r/DistributedSystems for help in that area, i don't know much about those communities though.
about me: This class should largely manage itself, that means i expect to do relatively little other then participate as best i can as another student. I would say i have intermediate knowledge of the topics were going to cover, but that won't count for much in the specific labs.
Most importantly, make friends have fun and make sure to sleep well.