<?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>Forem: Amietubodie Collins Otonye</title>
    <description>The latest articles on Forem by Amietubodie Collins Otonye (@otonye7).</description>
    <link>https://forem.com/otonye7</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%2F869554%2F85d96be1-fb3e-4b62-a76c-53a02268cdf7.jpeg</url>
      <title>Forem: Amietubodie Collins Otonye</title>
      <link>https://forem.com/otonye7</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/otonye7"/>
    <language>en</language>
    <item>
      <title>How to improve the load and response time of your websites.</title>
      <dc:creator>Amietubodie Collins Otonye</dc:creator>
      <pubDate>Tue, 21 Jun 2022 15:53:34 +0000</pubDate>
      <link>https://forem.com/otonye7/how-to-improve-the-load-and-response-time-of-your-websites-5bka</link>
      <guid>https://forem.com/otonye7/how-to-improve-the-load-and-response-time-of-your-websites-5bka</guid>
      <description>&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F45coi1sbvs9yhrv9slp4.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F45coi1sbvs9yhrv9slp4.jpeg" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This can be done by done by adding a cache layer and shifting all your static content like javaScript, css, images and video files to the content delivery network which is also known as CDN.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Cache ?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Cache helps us to store data so that when we make request for that data later it can be served faster. We can use it store the result of expensive responses or frequently accessed data in memory. Every time you load a web page one or more database calls are executed to fetch data. The application performance is greatly affected by calling the database repeatedly. Cache can help us eliminate this problem.&lt;/p&gt;

&lt;p&gt;Cache is a temporary data store and it is more faster than the database. The advantages of using cache is to reduce the workload of the database and to improve the performance of the application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How does it work ?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When a web server receives a request it first checks if the response exists in the cache if it does it sends the response back to the client. How about if it does not exist? Then it queries the database for the response when it gets the response it saves the response in the cache before sending the response back to the user.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Content Delivery Network(CDN)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;CDN servers is used to cache static web content like css, javaScript, images and video files e.t.c. When a user visits a websites a CDN Server closer to the user will deliver all the static contents. if the CDN server are far from the user the slower the website will load. The closer you are to the CDN server the faster you get contents.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How does it work ?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When user A tries to get an image.png if the CDN server does not have image.png in the cache the CDN server request the file from the web server the web server now returns the image to the CDN server which include http headers and TTL which describes how long the image is cached then the CDN caches the image and returns it back to the user. Now if user B wants the same image the image is returned from the cache instead of from the server which a lot faster.&lt;/p&gt;

&lt;p&gt;Thanks for reading and God bless us all. &lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>javascript</category>
      <category>react</category>
    </item>
    <item>
      <title>Why Stateless Architecture is better than Stateful Architecture when scaling web applications</title>
      <dc:creator>Amietubodie Collins Otonye</dc:creator>
      <pubDate>Mon, 20 Jun 2022 21:48:34 +0000</pubDate>
      <link>https://forem.com/otonye7/why-stateless-architecture-is-better-than-stateful-architecture-when-scaling-web-applications-3klg</link>
      <guid>https://forem.com/otonye7/why-stateless-architecture-is-better-than-stateful-architecture-when-scaling-web-applications-3klg</guid>
      <description>&lt;p&gt;A stateful and stateless server has some key differences. A stateful server remembers client data from one request to the next. A stateful server retain states and needs to remember the past and apply it to current operations.&lt;/p&gt;

&lt;p&gt;The following image shows how a stateful architecture is designed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Mc3DdTvg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/752eamkgbp9mffw3b7xd.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Mc3DdTvg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/752eamkgbp9mffw3b7xd.jpeg" alt="Image description" width="504" height="304"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;From the diagram Client A data are stored in server 1. For Client A to be authenticated all http requests must be routed to server 1. Client B data are stored in server 2. For Client B to be authenticated all http requests must be routed to server 2 if a request is sent to server 1 or any other server the request will fail because those other servers does not contain Client B information. Same goes for Client A, Client C and Client D.&lt;/p&gt;

&lt;p&gt;This makes it very difficult to scale because of every request from the same client must be routed to the same server. Adding and removing servers are very difficult with this approach and it is difficult to handle if your server should fail.&lt;/p&gt;

&lt;h2&gt;
  
  
  STATELESS SERVERS
&lt;/h2&gt;

&lt;p&gt;In stateless architecture http request from a user can be sent to any web server which fetches data from the same data store. Below is an image of a stateless architecture.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iqxTXShV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ce3474t7g0hbs752zuus.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iqxTXShV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ce3474t7g0hbs752zuus.jpeg" alt="Image description" width="591" height="658"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The stateless system is more robust and scalable and it is also more simple than the stateful system.&lt;/p&gt;

&lt;p&gt;The added flexibility of autoscaling the web servers on the application layer depending on the network traffic allows you to not worry about overhead.&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
