<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Megha Sahay</title>
    <description>The latest articles on DEV Community by Megha Sahay (@meghasahay).</description>
    <link>https://dev.to/meghasahay</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1181245%2Ff7c0578f-3950-41c8-891d-ab8e25d070fe.jpeg</url>
      <title>DEV Community: Megha Sahay</title>
      <link>https://dev.to/meghasahay</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/meghasahay"/>
    <language>en</language>
    <item>
      <title>gRPC vs GraphQL vs REST vs Websockets</title>
      <dc:creator>Megha Sahay</dc:creator>
      <pubDate>Mon, 30 Oct 2023 04:04:42 +0000</pubDate>
      <link>https://dev.to/meghasahay/grpc-vs-graphql-vs-rest-vs-websockets-3440</link>
      <guid>https://dev.to/meghasahay/grpc-vs-graphql-vs-rest-vs-websockets-3440</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--m6NcsesQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/2048/1%2AbNUUwcI2DtnCdHShn6B1Ww.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--m6NcsesQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/2048/1%2AbNUUwcI2DtnCdHShn6B1Ww.png" alt="" width="800" height="800"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Many software architects face problems to choose between the best suitable technology for their services. A communication technology that is operational, practical and should allow developers to define a set of CRUD (Create, Read, Update and Delete) methods for processing data.&lt;/p&gt;

&lt;p&gt;In this article I have tried to compare REST architecture style, gRPC , GraphQL and WebSockets communication protocols. SOAP is not considered because it is no longer a preferred method of communication in modern web applications. This first section gives introduction to these communication protocols. Then comparing the performance of these protocols. Concluding with some results from research papers.&lt;/p&gt;

&lt;h2&gt;
  
  
  REST
&lt;/h2&gt;

&lt;p&gt;It stands for Representational State Transfer which is an architecture style. This was introduced and defined by &lt;a href="https://en.wikipedia.org/wiki/Roy_Fielding"&gt;Roy T. Fielding&lt;/a&gt; in 2000. When we think of REST which is a concept of resources. A resource can be thought as a thing that service is aware of like an Employee for example. The server will create different representation of this Employee on request. Once the client has a representation of Employee then it can make request to change it, if the operation is successful then a HTTP success code is retuned otherwise an HTTP error code is returned. REST is commonly used over HTTP.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;How does HTTP request work?&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--cy6xvDoq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/6806/1%2ARK8yJRAX7hRiY-0YuRVTow.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cy6xvDoq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/6806/1%2ARK8yJRAX7hRiY-0YuRVTow.png" alt="A typical Request/Response anatomy" width="800" height="371"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When we open a web browser of any website. The browser acts as a client that makes a request to remote server. A request can be considered as a text document which contains mainly these information :&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;*verb *— What action to perform on server.&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Get : Request resource&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Post : Create resource&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Put : Update resource&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Patch : Partial update&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Delete : Delete resource&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;*header *— Information and meta data about the request. It can be content type, content length, authorization (who is making a call), Accept (which content type client is able to understand), cookies and much more.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This can be considered as header example.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Cache-control: no-cache
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;*3. content/body *— It is the information that can optionally asked for to fulfill a request. it can be HTML/CSS/JavaScript/Json or any other format.&lt;/p&gt;

&lt;p&gt;Below shows a typical HTTP request with verb, header and content.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;POST /api/employee HTTP/1.1
Host: myWebApi.com
Content-Type: application/json
Cache-Control: no-cache

{
     "Name": "Megha Sahay",
     "Age": 25
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Response&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Response is a textual document containing status code that says success or failure , headers (content type) and content that server sends in response.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Status code — Operation status&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;100–199 : informational&lt;/p&gt;

&lt;p&gt;200–299: success&lt;/p&gt;

&lt;p&gt;300–399: Redirection information&lt;/p&gt;

&lt;p&gt;400–499: client error&lt;/p&gt;

&lt;p&gt;500–599: server errors&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Header - It is set of headers just like request header.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Content - Very much like request content that contains the response information.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;An example of HTTP response. The status code of 200 (ok) is returned. The header information consists of the date server, accept-ranges, content-length, content-type. The content or the body of response is an HTML document as shown below.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;HTTP/1.1 200 OK
Date: Thu, 03 Jan 2022 23:30:00 GMT
Server: gws
Accept-Ranges: bytes
Content-Length: 68894
Content-Type: text/html; charset=UTF-8

&amp;lt;!doctype html&amp;gt;&amp;lt;html …
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Benefits of REST with HTTP&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;One endpoint&lt;/em&gt;&lt;/strong&gt; — GET retrieves a resource in an idempotent way and POST creates new resource. This means that we can avoid a lot of createEmployee and editEmployee methods. Which means that we can POST the Employee representation to request that server can create new resource and we can use GET request to fetch a representation of a resource. HTTP helps REST to have one endpoint in the form of an Employee resource.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;**Large supporting tools — *&lt;/em&gt;*A lot of monitoring, caching, load balancers tools have out of box support for HTTP. This helps to effectively handle large volumes of traffic and route them cleverly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;**Security *&lt;/em&gt;*— Makes security process easier one can use all available security controls with HTTP to secure communication.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Summary&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To sum up REST architecture style can result in better performance and scalability in simple, lightweight applications.&lt;/p&gt;

&lt;h2&gt;
  
  
  WebSocket Protocol
&lt;/h2&gt;

&lt;p&gt;It is a communication protocol that enables two-way communication. Which would mean that the server is independent of the client and doesn't have to wait for client for request. The server can send data independently. This can be possible by establishing a single TCP connection between client and server.&lt;/p&gt;

&lt;p&gt;The websocket protocol consists of two phases :&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;**Handshake — *&lt;/em&gt;*When the client sends an HTTP request, it should have several headers set. The below is an example of the client request.&lt;/p&gt;

&lt;p&gt;GET /chat HTTP/1.1 Host: server.mywebsite.com &lt;br&gt;
Upgrade: websocket &lt;br&gt;
Connection: Upgrade &lt;br&gt;
Sec-WebSocket-Key: gdhsddfdtwDkjskiqw1== &lt;br&gt;
Origin: &lt;a href="http://mywebsite.com"&gt;http://mywebsite.com&lt;/a&gt; &lt;br&gt;
Sec-WebSocket-Protocol: chat, superchat &lt;br&gt;
Sec-WebSocket-Version:14&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The server then replies with its own handshake response which has HTTP code set to 101. Example response is below:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;HTTP/1.1 101 Switching Protocols 
Upgrade: websocket 
Connection: Upgrade 
Sec-WebSocket-Accept: hdgsahdywqySDASDDA+xOo= 
Sec-WebSocket-Protocol: chat
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;em&gt;TCP connection&lt;/em&gt;&lt;/strong&gt; — When the handshake is completed successfully the communication is done via a single TCP connection using The Websocket Protocol. The client server send data independently in chunks called messages. Message consists of frames which are transferred across sides.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The connection to be closed, a unique frame is sent by one of the peers. The frame has the contact of closure. When some other peer receives it, responds with close frame. So that the connection is safely closed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Summary&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To summarize web sockets are Real-time, bidirectional, persistent connections. Suitable for low-latency data exchange. A low latency is a computer network that is optimized to process high volume of data with minimal delay.&lt;/p&gt;

&lt;h2&gt;
  
  
  gRPC (Google remote procedure call)
&lt;/h2&gt;

&lt;p&gt;gRPC is an open source system that implements remote procedure call concept. It was developed by Google in 2015 as a successor of RPC system called Stubby. Stubby, an RPC framework that consists of core RPC layer that can handle internet-scale of tens of billions of requests per seconds. Stubby was made as open-source called gRPC.&lt;/p&gt;

&lt;p&gt;RPC is a Remote Procedure Call, at the Client Code, it just looks like you’re calling a local function from the server. It supports streaming, language independent, low latency.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;What makes gRPC so fast?&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Based on HTTP/2 communication protocol- It is the newest version of popular HTTP protocol. It dynamically increases network efficiency and enables real-time communication by providing a framework for long lived connections.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Protocol buffers — It is a cross platform mechanism developed by Google which allows to define data structures and interfaces in .proto files. Then, developed file can be used to generate a file in targeted language (i.e., Java, Python, Go , C#). The benefit of this is that one Protobuf file can generate an API for different language that is implementing server side, and other which is implementing client side. What is more, Protocol Buffer is a binary format what means that is faster and smaller than other formats (i.e, JSON or XML).&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Summary&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;gRPC is based on RPC framework uses HTTP/2 and protobuf an binary format, making it very fast. It can be used when you need faster communication. Therefore it should be used in scenario that needs real time data streaming and large data loads.&lt;/p&gt;

&lt;h2&gt;
  
  
  GraphQL
&lt;/h2&gt;

&lt;p&gt;It is an open source solution for querying and mutating(changing) data via remote API. It was first developed by Facebook but was publicly available in 2015. Now it is developed by Linux Foundation. It is not tied to any specific database or storage engine. It is backed by existing code and data.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;In short GraphQL has only one endpoint, which is HTTP post request.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;We simply send a single query to a GraphQL server that includes the concrete data requirements. The server then responds with JSON object as response.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;If a client wants to fetch the researcher data that includes the id, research title and members of the project. Then, the client only specifies exactly which data it needs in a query and sends a request using the HTTP POST method.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Clients have the flexibility to define what type of data to fetch from the database. It helps when the client needs a flexible response format to avoid extra massive data transfer. It is also supported in various popular programming languages such as Python, C#, JavaScript, etc. Two things are the most important part of GraphQL, i.e., Schema and Resolver function. GraphQL requires 3 important parts that must be define firstly.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;**mutation - *&lt;/em&gt;*to update, input, and delete data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;**query - *&lt;/em&gt;*for calling or getting data&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;**type — *&lt;/em&gt;*to describe the type of field/data&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Summary&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;GraphQL is database neutral technology that provides flexibility to the client to get data from multiple servers in a single response. GraphQL was developed to solve a mobile problem. However, those benefits may not be relevant to your project. There are some drawbacks to it for an application like Lack of proper pagination, caching, and MIME types are real issues. As resolvers are harder to maintain managing GraphQL is complex. So, graphQL is suitable for mobile apps or when you have complex schema or you receive data from multiple sources are to name a few.&lt;/p&gt;

&lt;h2&gt;
  
  
  REST vs GraphQL architecture
&lt;/h2&gt;

&lt;p&gt;This section illustrates the major differences between gRPC, REST and GraphQL.&lt;/p&gt;

&lt;p&gt;The main difference between REST and GraphQL APIs technology is the availability of the number of endpoints when they are handling requests. GraphQL tries to collect every request to one place, whereas the REST is built such that each resource is handled by specific endpoints. The REST configuration creates a complicated situation whenever there is a change on the back-end, and it causes an adjustment to the front-end to query the exact endpoint for the desired resource. On the other hand, GraphQL takes some time when the request is handled at a single endpoint to find the right resource. Figure below illustrates the difference between REST and GraphQL architecture.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Hc4Bhbg_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/2380/1%2A3T8nMoGsMWQiWEa1tgCZ7A.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Hc4Bhbg_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/2380/1%2A3T8nMoGsMWQiWEa1tgCZ7A.jpeg" alt="Image reference [research paper](https://www.mdpi.com/2073-431X/10/11/138) Illustration of the difference between REST and GraphQL architectures" width="800" height="475"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  gRPC vs REST vs GraphQL
&lt;/h2&gt;

&lt;p&gt;The parameters chosen for comparison between gRPC, REST and GraphQL is the architecture, data organization, the supported operations, data fetching, community support, Performance, Development speed, learning curve for developers, self documentation, file uploading capabilities, in build caching, stability and real world use case. It can be seen from the below summary table that no one technology is winner. There are some tradeoffs if you have a simple application REST can be sufficient as gRPC and GraphQL adds unnecessary complexity.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ha7Y1Efn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/6968/1%2AMoZkxlQ7RICMhEdX3kJNPQ.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ha7Y1Efn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://cdn-images-1.medium.com/max/6968/1%2AMoZkxlQ7RICMhEdX3kJNPQ.png" alt="" width="800" height="459"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  gRPC vs REST vs GraphQL vs Websocket a performance comparison a closer look
&lt;/h2&gt;

&lt;p&gt;In this section we will take a closer look at performance comparison. The parameters are time and memory consumed for inserting/fetching elements to/from database.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;em&gt;**Time measured for fetching/inserting elements *&lt;/em&gt;*— WebSockets protocol turned out to be the slowest and the least stable. gRPC protocol was the fastest in this task.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;em&gt;**Memory measured for fetching/inserting element *&lt;/em&gt;*— WebSockets offers the best memory usage out of 4 presented communication protocols. In both fetching and inserting it achieved the best result. Other protocols use noticeably more resources, especially gRPC which is the most memory-consuming mechanism of communication in this comparison.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;gRPC protocol is the fastest in transferring data between client and server. The WebSockets protocol achieved similar results to REST when transferred data was small. When data was larger it turned out to be the slowest. REST style was moderately fast. It turned to be slower than gRPC, but was never the worst in any category. GraphQL had some troubles with small data. It was the worst in inserting and fetching one element from database. It was slightly faster than the WebSockets in fetching a larger data.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Summary&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If a programmer is looking for the fastest way to transfer data and does not care about message size the relevant option will be gRPC. On the other hand, if delivery time is not crucial and there is need of low memory usage the right option will be WebSocket. REST protocol is also an interesting way to communicate. It provides decent memory usage, time performance and what is the most important it is easily accessible, which means that every new client can easily connect to server. There is also GraphQL which provides the worst memory usage to time performance ratio especially in single element operations. This means that this protocol should be used in other way, e.g., nested data structures where data is fetched with queries.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;GraphQL — &lt;a href="https://www.howtographql.com/basics/0-introduction/"&gt;https://www.howtographql.com/basics/0-introduction/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;gRPC — &lt;a href="https://grpc.io/blog/grpc-on-http2/"&gt;https://grpc.io/blog/grpc-on-http2/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Book — &lt;a href="https://www.amazon.se/-/en/Sam-Newman/dp/1491950358"&gt;Building Microservices: Designing Fine-Grained Systems&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Research paper — &lt;a href="https://doi.org/10.48550/arXiv.2212.07475"&gt;https://doi.org/10.48550/arXiv.2212.07475&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Research Paper — &lt;a href="https://www.mdpi.com/2073-431X/10/11/138"&gt;https://www.mdpi.com/2073-431X/10/11/138&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Protocol buffers official documentation: &lt;a href="https://protobuf.dev/overview/"&gt;https://protobuf.dev/overview/&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>graphql</category>
      <category>grpc</category>
      <category>rest</category>
      <category>communicationprotocol</category>
    </item>
    <item>
      <title>gRPC</title>
      <dc:creator>Megha Sahay</dc:creator>
      <pubDate>Mon, 30 Oct 2023 03:56:33 +0000</pubDate>
      <link>https://dev.to/meghasahay/grpc-vs-graphql-vs-rest-vs-websockets-1bg4</link>
      <guid>https://dev.to/meghasahay/grpc-vs-graphql-vs-rest-vs-websockets-1bg4</guid>
      <description></description>
    </item>
    <item>
      <title>Container to Docker</title>
      <dc:creator>Megha Sahay</dc:creator>
      <pubDate>Fri, 20 Oct 2023 12:18:56 +0000</pubDate>
      <link>https://dev.to/meghasahay/container-to-docker-4o1l</link>
      <guid>https://dev.to/meghasahay/container-to-docker-4o1l</guid>
      <description>&lt;p&gt;Hello everyone in the previous series I have given gentle introduction to the docker as a technology with some terminologies in simple English. In this series which is the last one. I will explain about the need of docker technology and history of containers. The other details that you will need to get started is already available in the official documentation of docker &lt;a href="https://docs.docker.com/get-started"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  History of containers
&lt;/h3&gt;

&lt;p&gt;It was 1979 when the concept of containers first emerged. More than a decade ago when there was a requirement of a new application. A brand new server would be necessary. Then it was required to decide how large the server would be needed. There would be one server per application. The company would usually end up buying servers larger than needed. The point is that a lot of resources was wasted in infrastructure setup.&lt;/p&gt;

&lt;h3&gt;
  
  
  Virtual Machines
&lt;/h3&gt;

&lt;p&gt;What is VM (virtual machines) ? It is a set of software (read virtualization software) that creates an abstract layer over computer hardware that allows the hardware elements of a single computer like memory, processors, storage etc. to be divided into multiple virtual computers, commonly called virtual machines. VMware Inc, came up with virtual machines that would enable us to run multiple applications on a single server see the picture below. This would save a lot of money for companies.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UAaaVMHG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fgc5qhlg2siq1v5znsxd.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UAaaVMHG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/fgc5qhlg2siq1v5znsxd.png" alt="Image description" width="800" height="386"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Physical server with multiple virtual machines&lt;/p&gt;

&lt;p&gt;As seen clearly in the picture all VMs require their own operating system (OS) which is main disadvantage. As every OS needs memory, storage that could be used to provide resources for applications. The overhead of OS is that it needs monitoring and licensing, also patching. Patching is defined as updates that address security vulnerabilities in OS. There point is a lot of resources and effort is wasted in VMs as well. To overcome the problem of VMs containers were introduced.&lt;/p&gt;

&lt;h3&gt;
  
  
  Containers
&lt;/h3&gt;

&lt;p&gt;Google has been using containers for Gmail, YouTube and any search since very long. This was done to cater the shortcomings of VM. The main difference between container and VM is that container share the OS. This saves on the memory, CPU and storage. Significantly reduce licensing, monitoring and patching cost. It saves lot of money for the company.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--wHKz-MKj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vw8omybuxs87i2qma07f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wHKz-MKj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vw8omybuxs87i2qma07f.png" alt="Image description" width="800" height="440"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Containers share the operating system of physical server&lt;br&gt;
The absence of OS is what makes containers light weight and portable.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;What is Docker?&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
Docker started with a company and not a technology. It was called dotCloud, Inc. If you say docker you may mean these things — Docker Inc company, the technology and docker open source project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Docker, Inc&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It is an American technology company that automates code inside containers. The major product include Docker Hub, a repository for containers, Docker Desktop a user interface application for windows platform. It was started as a Platform as a service (PaaS) provider named dotCloud. It used Linux containers (LXC), that was first introduced in 2008. It was the implementation of Linux container manager. It used control groups (cgroups). Cgroups was launched by Google in 2006 for limiting, accounting and isolating resource usage. LXC works on single Linux kernel that doesn't require any patches. These containers were created and managed by an internal tool named Docker. The dotCloud company was not doing well until 2013. They made their inhouse containers public and as a product which we all know is very profitable now.&lt;/p&gt;

&lt;p&gt;“The word Docker comes from a British word meaning&lt;/p&gt;

&lt;p&gt;dock worker — someone that loads and unloads goods from ships”&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;The docker technology&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When we talk about Docker as a technology we refer to the Docker Engine. It is a software that runs and manages containers. It can be thought as a core container runtime that runs containers. It can be downloaded from docker website here. The Docker Engine comes in two editions:&lt;/p&gt;

&lt;p&gt;Enterprise Edition — This is the licensed edition that has comparatively slower release cycle, additional features and official support.&lt;br&gt;
Community Edition — This is the open source edition which involves a lot of contributions, quick release cycle.&lt;br&gt;
&lt;em&gt;&lt;strong&gt;As open source&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;It is an open source docker project it was renamed as Moby project. It provides the set of tools, components and assemblies for container based system. You can see the list of Moby projects here. You are free to download it as it is an open source. Most of the projects are written in Go programming language.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this article we have seen the evolution of containers. Whenever there was a need of application there was a new server bought by companies. That required a lot of resources and overhead. Then came VMs that made possible to run multiple application on single server. The disadvantage of VMs are that it needs separate OS. To overcome this issue containers were introduced. The containers are light weight as they share OS. Containers were difficult to implement initially. Then Docker Inc came up with container virtualization technologies.&lt;/p&gt;

&lt;p&gt;We learned about Docker Inc, company. Docker was the first initiator of container. As docker is an open source that is available in moby repository on &lt;a href="https://github.com/moby/moby"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>docker</category>
      <category>container</category>
      <category>softwareengineering</category>
    </item>
  </channel>
</rss>
