Project 4 Flashcards

1
Q

WHat is Protocol Buffers

A

Protocol buffers are Google’s language-neutral, platform-neutral, extensible mechanism for serializing structured data – think XML, but smaller, faster, and simpler. You define how you want your data to be structured once, then you can use special generated source code to easily write and read your structured data to and from a variety of data streams and using a variety of languages.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

RPC service

A

An RPC service is a collection of message types and remote methods that provide a structured way for external applications to interact with web applications

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How to define the RPC service

A
  1. Define the message types used for requests and responses 2. Define the services interface that receive the request and sen the responses using the message types. Each service has its methods
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

.

A
  • . gRPC works particularly well with protocol buffers and lets you generate the relevant RPC code directly from your .proto files using a special protocol buffer compiler plugin.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Steps to create application that uses RPC

A
  1. Define message formats and services interface in a .proto file. 2. Run the protocol buffer compiler to compile the code. Generate C++ code you need to work with the message types. The .proto files are the input 3. Use the C++ protocol buffer API to write and read messages. This is creating files in C++ that import the code in the previous step from the compilation and that uses it to read and write
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Why Use Protocol Buffers?

A
  • solve serialize and retrieve structured data - With protocol buffers, you write a .proto description of the data structure you wish to store. From that, the protocol buffer compiler creates a class that implements automatic encoding and parsing of the protocol buffer data with an efficient binary format. The generated class provides getters and setters for the fields that make up a protocol buffer and takes care of the details of readi
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Why gRPC uses Protocol Buffers

A

Interface Definition Language (IDL) and as its underlying message interchange format.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Benefits of gRPC

A
  • you can easily create a gRPC server in Java with clients in Go, Python, or Ruby
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What is the stub in gRPC?

A

On the client side, the client has a stub (referred to as just a client in some languages) that provides the same methods as the server.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How gRPC uses protocol buffers

A

gRPC uses protoc with a special gRPC plugin to generate code from your proto file: you get generated gRPC client and server code, as well as the regular protocol buffer code for populating, serializing, and retrieving your message type

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Diagram of how the gRPC server and clients intereact

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Proto3 accessor methods Singular String Fields

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Proto3 accessor methods Singular Numeric Fields

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Step 1 gRPC tutorial

A

define the gRPC service and the method request and response types using protocol buffers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What code is generated by protoc

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Step 2 gRPC tutorial

A

Next we need to generate the gRPC client and server interfaces from our .proto service definition. We do this using the protocol buffer compiler protoc with a special gRPC C++ plugin.

17
Q

What are deadlines

A

Deadlines allow gRPC clients to specify how long they are willing to wait for an RPC to complete before the RPC is terminated with the error DEADLINE_EXCEEDED

18
Q

Why use deadlines?

A

If there are no deadline, service at risk of running out of resources, like memory, which would increase the latency of the service, or could crash the entire process in the worst case.

19
Q

What is the AFS

A

AFS uses the Weak Consistency model.[5] Read and write operations on an open file are directed only to the locally cached copy. When a modified file is closed, the changed portions are copied back to the file server. Cache consistency is maintained by callback mechanism. When a file is cached, the server makes a note of this and promises to inform the client if the file is updated by someone else. Callbacks are discarded and must be re-established after any client, server, or network failure, including a timeout. Re-establishing a callback involves a status check and does not require re-reading the file itself.