Distributed Lab 2: RPC in Go

Related tags

Utilities dislab2
Overview

Distributed Lab 2: RPC in Go

Using the lab sheet

There are two ways to use the lab sheet, you can either:

Ratings

Each question is rated to help you balance your work:

  • 🔴 ⚪ ⚪ ⚪ ⚪ - Easy, strictly necessary.
  • 🔴 🔴 ⚪ ⚪ ⚪ - Medium, still necessary.
  • 🔴 🔴 🔴 ⚪ ⚪ - Hard, necessary if you're aiming for higher marks.
  • 🔴 🔴 🔴 🔴 ⚪ - Hard, useful for coursework extensions.
  • 🔴 🔴 🔴 🔴 🔴 - Hard, beyond what you need for any part of the coursework.

1: Deploying the Chat System 🔴 ⚪ ⚪ ⚪ ⚪

Following from the end of last week's lab, you should now have a distributed system -- a chat client and server. Hopefully you've already tested these out locally, but now you need to put them to the test by running them in a properly distributed fashion.

For this, we will make use of AWS. Follow the guides for setting up instances, accessing them, and opening required ports.

In particular, you should:

  • create two t2.micro instances, (guide)
  • make sure Go is installed on your instances (guide)
  • load your client/server code onto the instances (e.g., via git)
  • open ports to allow communication between instances (guide)
  • start your server running on one instance (ssh guide)
  • connect to your server with your client on another instance
  • connect to your server from your local machine
  • communicate between clients via your (genuinely) distributed system!

Make sure you stop your instances when you have finished!

Frequently Asked Questions

  • My code worked locally but it doesn't on AWS: The main reason for this happening is incorrect IP addresses. To connect to the server from another AWS instance, you will need to use the private IP address. To connect to the server from a non-AWS computer (i.e. your personal computer) you need to use the public IP address. Think about why this may be the case, how do private and public IP addresses work?

  • I use go run client.go and get panic: runtime error: invalid memory address or nil pointer dereference: You are not passing in the IP address of the server to the client. Run it like this go run client.go -ip ip:port replacing ip and port with the appropriate values.

  • What is git? How do I copy files with it? Git is a version control system, it allows you to keep track of your changes. When we suggest loading files to AWS, we are suggesting that you should use a git repository and pushing your changes to the remote repository, then cloning/pulling these changes to your AWS instance. GitHub, GitLab and many others are services that allow for this process. Still stuck? You can try using SCP - we do not recommend this though. You should be familiar with git at this point.

2: Using RPC - Secret Strings 🔴 ⚪ ⚪ ⚪ ⚪

Follow the video from this week to create a simple RPC system that allows clients to call the functions of a server via a defined interface. As with last week, this is best attempted in stages:

  • Stage 1: Write server code to enable access to the "secret" string manipulation function. Test it by writing a client that sends a string to be reversed.
  • Stage 2: Enable Premium Tier service by implementing the FastReverse function in the server.
  • Stage 3: Update your client to read words from the wordlist file and reverse them all.
  • (Optional) run multiple server instances, and speed up the work by having your client split the load between servers.

3: 99 Bottles of Beer 🔴 🔴 🔴 ⚪ ⚪

So far we've been focusing on client-server systems. However, there are times when we don't really want a distinction in roles between components -- when we might want them to act as peers, all running the same code.

For this task, you are going to solve the "99 Bottles of Beer" problem in a distributed fashion. Rather than a single process singing the lyrics all by itself, you're going to run at least three instances of your code, on different machines, and have these buddies share the work of singing the song verse-by-verse, in order.

Here's how it should go:

  • Buddy 1: "99 bottles of beer on the wall, 99 bottles of beer. Take one down, pass it around..."
  • Buddy 2: "98 bottles of beer on the wall, 98 bottles of beer. Take one down, pass it around..."
  • Buddy 3: "97 bottles of beer on the wall, 97 bottles of beer. Take one down, pass it around..."
  • Buddy 1: "96 bottles of beer on the wall, 96 bottles of beer. Take one down, pass it around..."

All the way down until there are no more bottles of beer on the wall, which the final singer should note appropriately with your preferred ending to the song.

Use 3 for testing, but your solution should be able to handle any number of buddies singing along. There should be no difference in the code, just different flags on the commandline.

Hints:

  1. Each process needs to accept an ip:port string for the 'next' buddy who will follow on from them in the song. You'll have to configure them in a loop.
  2. You don't want clients to try connect to each other straight away, or you won't have time to set the final process running so that the first can connect.
  3. When you set up the processes, you'll also need some way to indicate which of them should start the song (I suggest allowing any n bottles of beer, for testing purposes). Only the last process you set up should need to be told the n to count down from.
  4. You may need to look at client.Go rather than client.Call.

Don't forget to stop any AWS instances!

Go library to interface with NEAR nodes' JSON-RPC interface

StreamingFast Solana library for Go Go library to interface with NEAR nodes' JSON-RPC interface Contributing Issues and PR in this repo related strict

StreamingFast 1 Nov 9, 2021
RSS3 distributed hosting node implemention.

RSS3 distributed hosting node implemention.

Natural Selection Labs 13 Dec 1, 2021
Distributed Lab 2: RPC in Go

Distributed Lab 2: RPC in Go Using the lab sheet There are two ways to use the lab sheet, you can either: create a new repo from this template - this

null 0 Oct 22, 2021
Antenna RPC is an RPC protocol for distributed computing, it's based on QUIC and Colfer. its currently an WIP.

aRPC - Antenna Remote Procedure Call Antenna remote procedure call (aRPC) is an RPC protocol focused on distributed processing and HPC. aRPC is implem

Raphael de Carvalho Almeida 3 Jun 16, 2021
Distributed Lab 3: Message Broker in Go

Distributed Lab 3: Message Broker in Go Using the lab sheet There are two ways to use the lab sheet, you can either: create a new repo from this templ

null 0 Oct 29, 2021
Cap'n Proto library and parser for go. This is go-capnproto-1.0, and does not have rpc. See https://github.com/zombiezen/go-capnproto2 for 2.0 which has rpc and capabilities.

Version 1.0 vs 2.0 Update 2015 Sept 20: Big news! Version 2.0 of the go-bindings, authored by Ross Light, is now released and newly available! It feat

Jason E. Aten, Ph.D. 282 Jun 9, 2022
RPC explained by writing simple RPC framework in 300 lines of pure Golang.

Simple GoRPC Learning RPC basic building blocks by building a simple RPC framework in Golang from scratch. RPC In Simple Term Service A wants to call

Ankur Anand 542 Jun 17, 2022
rpc/v2 support for JSON-RPC 2.0 Specification.

rpc rpc/v2 support for JSON-RPC 2.0 Specification. gorilla/rpc is a foundation for RPC over HTTP services, providing access to the exported methods of

High Performance, Kubernetes Native Object Storage 3 Jul 4, 2021
Go Substrate RPC Client (GSRPC)Go Substrate RPC Client (GSRPC)

Go Substrate RPC Client (GSRPC) Substrate RPC client in Go. It provides APIs and types around Polkadot and any Substrate-based chain RPC calls. This c

Chino Chang 1 Nov 11, 2021
RPC Framework abstraction layer. Provides foundation of the RonyDesc to generate RPC server/client codes.

RonyKit RonyKit provides the abstraction layer for creating a cluster aware API server. By defining separate components for each task, you are almost

Ronak Software Group 3 Feb 21, 2022
Distributed-Services - Distributed Systems with Golang to consequently build a fully-fletched distributed service

Distributed-Services This project is essentially a result of my attempt to under

Hamza Yusuff 6 Jun 1, 2022
Concurrency Lab 2 Go Example

Concurrency Lab 2 If you're stuck look at examples on Go by Example Using the lab sheet There are two ways to use the lab sheet, you can either: creat

null 0 Oct 12, 2021
Concurrency Lab 1 Go Example

Concurrency Lab 1 If you're stuck look at examples on Go by Example Using the lab sheet There are two ways to use the lab sheet, you can either: creat

null 0 Oct 11, 2021
Concurrency Lab examples on Go

Concurrency Lab 1 If you're stuck look at examples on Go by Example Using the lab sheet There are two ways to use the lab sheet, you can either: creat

null 0 Oct 22, 2021
TNO MPC Lab - Shamir Secret Sharing

TNO MPC Lab - Shamir Secret Sharing The TNO MPC lab consists of generic software components, procedures, and functionalities developed and maintained

TNO - MPC Lab 1 Jun 26, 2022
TNO MPC Lab - Paillier

TNO MPC Lab - Paillier The TNO MPC lab consists of generic software components, procedures, and functionalities developed and maintained on a regular

TNO - MPC Lab 0 Nov 3, 2021
A simple and sussy project is an implementation of SOMMIP Lab 1 written in Golang

SOMMIP Lab 1 Isac Arthur Table of Contents About The Project Getting Started Prerequisites Installation Supported commands About The Project This very

Arthur 1 Nov 10, 2021
A go tasks for students lab

Go tasks one first tasks for students lab Palindrome Given the string, check if it is a palindrome. Example For inputString = "aabaa", the output shou

Denis 0 Nov 20, 2021
Kong and Consul Lab For Golang

Kong and Consul Lab Prerequisites docker Deploy Consul Server docker run -d -p 8500:8500 -p 8600:8600/udp --name=consul-server consul agent -server -u

Ridwan Dwi Siswanto 1 Nov 25, 2021
Gophercon lab "Get Go-ing with GitHub Actions"

GitHub Action Using Go This is a starting point for a GitHub Action based in Go. This repo provides all the structure needed to build a robust GitHub

Doug Graiser 0 Dec 8, 2021
Explores GitHub Actions in Go Lab from GopherCon 2021

Gopher A Tweet An action that tweets. Gopher A Tweet was created based on GopherCon 2021s Gophers of Microsoft: GitHub Action in Go Lab to explore bui

Autumn Martin 0 Dec 10, 2021
mit 6.824 lab

lab-6.824 0. How to run? go版本: 1.13+ 在高于1.11的版本中报unexpected directory layout, 但是用较低版本goLand无法调试... unexpected dir layout 原因是不支持相对路径包引入, 遇到时在import 删掉.

JinyuChata 1 Dec 9, 2021
The kitchen part of the Restaurant simulation of the first lab at the Network Programming course

KitchenServerGo This is the kitchen part of the Restaurant simulation of the first lab at the Network Programming course. The dining hall part of the

null 0 Oct 13, 2021
learn mit 6.824 lab

MIT6.824 lab1 MapReduce timeout: command not found -> brew install coreutils panic data race -> 加锁 内层变量会屏蔽外部同名变量 test1 word-count 测试基本功能 test2 indexer

GoodbyeYesterDay 0 Jan 5, 2022
Os-signal-lab - Experiments with os signals and process trees

os-signal-lab Experiments with os signals and process trees There's a lot to rea

carl-fredrik grimberg 0 Feb 5, 2022
7 days golang programs from scratch (web framework Gee, distributed cache GeeCache, object relational mapping ORM framework GeeORM, rpc framework GeeRPC etc) 7天用Go动手写/从零实现系列

7 days golang programs from scratch README 中文版本 7天用Go从零实现系列 7天能写什么呢?类似 gin 的 web 框架?类似 groupcache 的分布式缓存?或者一个简单的 Python 解释器?希望这个仓库能给你答案

Dai Jie 10.7k Jun 26, 2022
Distributed reliable key-value store for the most critical data of a distributed system

etcd Note: The master branch may be in an unstable or even broken state during development. Please use releases instead of the master branch in order

etcd-io 40.4k Jul 5, 2022
Distributed lock manager. Warning: very hard to use it properly. Not because it's broken, but because distributed systems are hard. If in doubt, do not use this.

What Dlock is a distributed lock manager [1]. It is designed after flock utility but for multiple machines. When client disconnects, all his locks are

Sergey Shepelev 25 Dec 24, 2019
Distributed reliable key-value store for the most critical data of a distributed system

etcd Note: The master branch may be in an unstable or even broken state during development. Please use releases instead of the master branch in order

etcd-io 40.4k Jun 30, 2022