Can somebody please tell me difference between JSON, Thrift and REST ? How one can decide which one to use ? Which one is the fastest one ?
JSON is based on a subset of the JavaScript Programming Language. Representative State Transfer (REST) is a client-server architectural style that uses the HTTP protocol in a simple and effective way. Systems that adhere to REST practices are often referred to as RESTful interfaces.
Thrift is an interface definition language and binary communication protocol used for defining and creating services for numerous programming languages. It was developed at Facebook for "scalable cross-language services development" and as of 2020 is an open source project in the Apache Software Foundation.
Thrift can be set up to use HTTP and JSON pretty easily if you want it (say if your client is somewhere on the internet and needs to pass firewalls) Thrift supports persistent connections and avoids the continuous TCP and HTTP handshakes that HTTP incurs.
For some, REST means a server that exchanges JSON documents with a client over HTTP. Not only is that not a complete definition, but it's also not always true. The REST specification doesn't require HTTP or JSON. (The spec doesn't mention JSON or XML at all.)
JSON is only data format, you can apply it in various situations, from storing data in NoSQL databases, to encoding of parameters in REST call
REST Is way of organizing client-server interaction. Central to the REST is resource, identified by its ID. REST server provides operations upon that resource, like deleting, updating, etc. REST calls are typically stateless, in another words, the server does not keep any client state, but it gets all information necessary for the operation from the call itself. REST is typically provided on top of HTTP, and URI- is used to encode resource id, operation and parameters. In addition parameters are often encoded with JSON. REST servers are usually built on top of HTTP servers, and clients use some HTTP client technology like curl.
Thrift is lightweight binary remote procedure call protocol. In interface definition langugage you define operations, and structure of parameters they take. Thrift compiler generates stubs for client and the server, and code to marshal calls into the binary format. That calls are then transfered over the wire according to one of the Thrift transports. Thrift clients and servers can be implemented in number of languages and technologies.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With