What are the 4 internal software layers involved in a thrift service? What are they for?
Give an example of a thrift IDL (.thrift file) for an interface that calculates the square root of a number, and throws an exception
service MathService {
double sqrt(1: double num) throws (1: IllegalArgument ia)
}exception IllegalArgument {
1: string message;
}
What are the 9 base types for the thrift IDL?
bool byte i16 i32 i64 double binary string void
What are the 3 types of datatype containers in the thrift IDL?
list
set
map
What are the other language constructs that thrift provides in its IDL?
const typedef enum struct exception
What are the field modifiers for function signatures that thrift provides in its IDL?
required
optional
default values
What is the “oneway” keyword used for in the thrift IDL?
building oneway thrift RPCs
What does the service keyword define in the thrift IDL?
A service consists of a set of named functions, each with a list of parameters and a return type
What does the “namespace” keyword determine in the thrift IDL?
Determines the java package
After the IDL has been defined in a thrift file (lets call it file.thrift), what command is used to generate the source code files for the services?
thrift –gen file.thrift
What steps must a synchronous thrift RPC client program execute when calling a service handler and invoking an RPC from the server?
Client must:
1. create a TSocket object using the network address of the server
What steps must a single-threaded thrift RPC server program execute when setting up a server which allows clients to invoke RPC calls to it?
What is the purpose of having the same “Protocol” and the “Transport” on the client and server for thrift RPC?
Protocol ensures that the data encoding formatting matches for the server and the client (JSON or otherwise)
Transport ensures that the network protocols that the server and client use are consistent
In what way does a thrift client violate the principle of location transparency?
The thrift client must know the host name and port number of a given server
In what way does a thrift client-server system violate the principle of location transparency?
Server may throw a variety of exceptions, and the exceptions will be passed along the network to the Client
Thrift _______, ________ and ______ _______ are not thread safe in a multi-threaded client
transports
protocols
client stubs
Asynchronous thrift RPC clients must provide a _______ ______ to be invoked upon completing a request
callback function
Asynchronous thrift RPC clients must use a non-blocking ________ and ________
socket
transport
What are some synchronization primitives used between a callback method on an asynchronous RPC client, and an RPC server (in java)?
Conditions
or
CountDownLatch
What steps must an Asynchronous thrift RPC client program execute when calling a service handler and invoking an RPC from the server?
Client must:
1. Create a TNonblockingTransport object using the network address of the server (internally creates a socket connection)
What steps must a multi-threaded thrift RPC server program execute when setting up a server which allows clients to invoke RPC calls to it?
Server must:
1. Create the server socket object with a port number to bind to
What are the names of the 5 thrift server implementations in Java?
How does the thrift TSimpleServer in Java work?
TSimpleServer uses a single thread and blocking I/O
How does the thrift TNonblockingServer in Java work?
TNonblockingServer uses a single thread and non blocking I/O. It can handle parallel connections but executes requests serially just like TSimpleServer.