<?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: Gabriella Amaefule</title>
    <description>The latest articles on DEV Community by Gabriella Amaefule (@gabriellaamah).</description>
    <link>https://dev.to/gabriellaamah</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%2F305736%2F01ad4845-2dce-45df-858e-860a07e46ddb.png</url>
      <title>DEV Community: Gabriella Amaefule</title>
      <link>https://dev.to/gabriellaamah</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gabriellaamah"/>
    <language>en</language>
    <item>
      <title>Understanding The Operating System - The Brain Behind Your Computer</title>
      <dc:creator>Gabriella Amaefule</dc:creator>
      <pubDate>Fri, 04 Apr 2025 20:38:40 +0000</pubDate>
      <link>https://dev.to/gabriellaamah/understanding-the-operating-the-brain-behind-your-computer-cp3</link>
      <guid>https://dev.to/gabriellaamah/understanding-the-operating-the-brain-behind-your-computer-cp3</guid>
      <description>&lt;h2&gt;
  
  
  What is an Operating system
&lt;/h2&gt;

&lt;p&gt;An operating system (OS) acts as a resource manager, where 'resources' refer to computer hardware such as the CPU, RAM, disk storage, and I/O devices. It simplifies program execution by allocating memory and facilitating communication between software and hardware. In reality, a computer has only one set of these physical resources yet hundreds of programs rely on them simultaneously. The OS efficiently distributes these resources among all running applications.&lt;/p&gt;

&lt;p&gt;Additionally, the operating system ensures smooth and effective performance through three key functions:&lt;/p&gt;

&lt;p&gt;i. Virtualization&lt;br&gt;
ii. Concurrency&lt;br&gt;
iii. Persistence&lt;/p&gt;
&lt;h2&gt;
  
  
  Virtualization: The Art Of Creating Illusions
&lt;/h2&gt;

&lt;p&gt;Imagine you have a single apple but need to share it among five children at the same time. To make this work, you create a visual copy of the apple for each child. Now, all five happily believe they’re eating their own apple unaware of the illusion.&lt;/p&gt;

&lt;p&gt;In computing terms:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The apple represents a single core CPU (or any physical resource like memory).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The children are programs demanding simultaneous processing.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The visual copies are virtualized resources.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example - CPU virtualization&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const process = require("process")

function virtualizationExample(){
    for(let i = 0; i &amp;lt; 5; i++){
        console.log(`PID- ${process.pid} ${i}` )
    }
}

virtualizationExample()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;in our terminal, run the command &lt;/p&gt;

&lt;p&gt;&lt;code&gt;node visual.js &amp;amp; node visual.js &amp;amp; node visual.js &amp;amp; node visual.js&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;the following will be displayed in the terminal&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;macbook@Gabriella-Macbook tt % node visual.js &amp;amp; node visual.js &amp;amp; node visual.js &amp;amp; node visual.js 
[1] 10125
[2] 10126
[3] 10127
PID- 10126 0
PID- 10128 0
PID- 10125 0
PID- 10127 0
PID- 10126 1
PID- 10127 1
PID- 10125 1
PID- 10126 2
PID- 10127 2
PID- 10125 2
PID- 10126 3
PID- 10127 3
PID- 10126 4
PID- 10125 3
PID- 10127 4
PID- 10125 4
PID- 10128 1
PID- 10128 2
PID- 10128 3
PID- 10128 4
[1]    done       node visual.js
[3]  + done       node visual.js
[2]  + done       node visual.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;An interesting insight to see. even though we only have one CPU, our system still manages to run 4 programmes at once and we can see a mix of process id's from each of the diffrent process - (A process is a running program)&lt;/p&gt;

&lt;p&gt;How does this work? The operating system employs clever scheduling policies to rapidly switch between processes, creating the seamless illusion of parallelism. (We’ll dive deeper into these policies in a future article!)&lt;/p&gt;

&lt;h2&gt;
  
  
  Concurrency: The Art of Juggling Processes
&lt;/h2&gt;

&lt;p&gt;Let’s revisit our apple analogy. When we created virtual instances of the apple for each child, it seemed like every child had their own apple. But in reality, we were quickly passing a single apple between them so fast that no one noticed the switch.&lt;/p&gt;

&lt;p&gt;In computing terms, this is exactly how the operating system handles multiple processes on a single CPU. For example, when you run four instances of a program, the OS rapidly cycles between them allocating resources to PID-10126, then PID-10128, then PID-10125, and so on.&lt;/p&gt;

&lt;p&gt;This lightning fast switching happens in milliseconds and is called context switching. It’s the magic behind the illusion that your computer is running dozens of programs simultaneously, even with just one CPU core.&lt;/p&gt;

&lt;h2&gt;
  
  
  Persistence: How Data Survives Power Off
&lt;/h2&gt;

&lt;p&gt;In systems, memory is volatile especially memory associated with a running program (process). when our system is abruptly shut down or turned off, all the data stored in the memory of the process is lost and so, our system need a means to store data persistently.&lt;/p&gt;

&lt;p&gt;In modern systems, a hard drive (HDD - Hard Disk Drive) or an SSD (Solid State Drive) is used to store data permanently. &lt;/p&gt;

&lt;p&gt;The software in the operating system that manages how data is stored on the disk is called the &lt;strong&gt;File System&lt;/strong&gt;. it handles storage and easy retrieval of files in an efficient manner.&lt;/p&gt;

&lt;p&gt;Unlike the CPU and Memory, The Operating system does not create a virtualized form of the disk storage.&lt;/p&gt;

&lt;p&gt;In a Nodejs context, whenever we use the &lt;code&gt;fs&lt;/code&gt; library, system calls are routed to the file system of the operating system.&lt;/p&gt;

&lt;p&gt;The operating system sends I/O request to the storage device through the device driver - (A code in the operating system that deals with the operation of a device in a system) in order to figure out where this new data will be stored in the file system and ensures it keeps track of the structure currently maintained in the file system.&lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;In this article we covered the major functionality of the operating system and how it accomplishes it. we started with virtualization - how the operating system creates an illusion of abundant resources and how it uses concurrency to share this single resource among running programs and how it ensures persistency of data using the file system.&lt;/p&gt;

&lt;p&gt;Together, these three pillars enable your computer to run smoothly, efficiently, and reliably.&lt;/p&gt;

&lt;p&gt;Thank you reaching this far!. Dont forget to like ❤️, share 🔃 and comment 💬&lt;/p&gt;

</description>
      <category>visualization</category>
      <category>concurrency</category>
      <category>persistence</category>
      <category>operatingsystem</category>
    </item>
    <item>
      <title>Understanding the concept of caching in software developement</title>
      <dc:creator>Gabriella Amaefule</dc:creator>
      <pubDate>Wed, 29 Jan 2025 22:07:07 +0000</pubDate>
      <link>https://dev.to/gabriellaamah/understanding-the-concept-of-caching-in-software-developement-7e</link>
      <guid>https://dev.to/gabriellaamah/understanding-the-concept-of-caching-in-software-developement-7e</guid>
      <description>&lt;p&gt;&lt;strong&gt;What is caching ?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Caching is a technique used to store the results of frequently accessed requests or database queries in an auxiliary data store. This allows the data to be quickly retrieved the next time it is requested, reducing the need to recompute or fetch it from the original source. By leveraging caching, systems can improve performance, reduce latency, and decrease the load on primary data sources.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why is Caching Important?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Caching is a critical technique used in developing scalable systems and applications. One of the key factors that determine the scalability of an application is its ability to compute and return responses in as little time as possible. Caching plays a vital role in achieving this by reducing the amount of computation and workload handled by the application. Specifically, it minimizes the number of database calls, which are often resource-intensive.&lt;/p&gt;

&lt;p&gt;By reusing previously computed or fetched data, caching helps to optimize resource utilization, including CPU, memory, and network bandwidth. This not only improves the efficiency of the system but also ensures that resources are available for other critical tasks.&lt;/p&gt;

&lt;p&gt;Lastly, caching significantly enhances the user experience by delivering faster and more consistent responses to end-users. This is especially important in high-traffic applications where latency can negatively impact user satisfaction.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Types of Caching&lt;/strong&gt;&lt;br&gt;
 Below, we explore how caching is implemented across different layers of an application:&lt;/p&gt;

&lt;p&gt;i. Client-Side Caching&lt;br&gt;
On the client interface, responses for frequently requested calls to the server can be cached in the browser cache, local storage, or session storage. This ensures that the data is readily available when requested again, reducing the need for repeated server calls. Examples include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Search Tools: In platforms like Google, responses for frequently searched queries are cached.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Social Media Apps: Profiles of popular celebrities or frequently accessed user data are cached.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;E-Commerce Apps: Product details from the inventory are cached to speed up page loads.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;ii. Server-Side Caching&lt;br&gt;
On the server side, caching is used to reduce the load on primary data sources and improve response times. Common use cases include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Database Queries: Caching the results of frequently executed database queries.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Third-Party API Calls: Storing responses from external APIs to avoid repeated calls.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;File Reads: Caching data read from files to minimize disk I/O operations.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;iii. CPU Caching&lt;br&gt;
Modern CPUs utilize caching to bridge the gap between the processor and the main memory. CPU caches store frequently accessed program instructions and data, enabling faster access and improving overall system performance.&lt;/p&gt;

&lt;p&gt;In this article, we will focus on how caching can be effectively implemented on both the server side and client side of an application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How Client-Side Caching Works&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fq182388olxlzafr69lir.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fq182388olxlzafr69lir.png" alt="How caching is implemented on the UI" width="800" height="624"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When a user visits a web application for the first time, the client (e.g., a browser) initiates a GET request to fetch data, such as the entire product inventory. Here's how the process unfolds:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Request Initiation:&lt;br&gt;
At the marker (i), the client sends a request to the server to retrieve the required data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Data Retrieval:&lt;br&gt;
At the marker (ii), the server processes the request and returns the requested data (e.g., the product inventory) to the client.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Data Caching:&lt;br&gt;
Upon receiving the data, the client saves it at the marker (iii) into a cache. This cache could be the browser cache, local storage, or session storage, depending on the implementation.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Subsequent Requests&lt;/strong&gt;&lt;br&gt;
If the user makes another request for the same data (e.g., the product inventory), the client follows these steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Cache Check:&lt;br&gt;
The client first checks its cache to see if the data is already available locally.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cache Hit:&lt;br&gt;
If the data is found in the cache (a cache hit), the client retrieves and returns the data directly without making another round trip to the server. This significantly reduces latency and improves performance.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cache Miss:&lt;br&gt;
If the data is not found in the cache (a cache miss), the process starts over:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;The client sends a new request to the server.&lt;/li&gt;
&lt;li&gt;The server processes the request and returns the data.&lt;/li&gt;
&lt;li&gt;The client stores the newly fetched data in the cache for future use.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How Client-Side Caching Works&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.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%2Fnjs6cj0jt4fnwp4s2506.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.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%2Fnjs6cj0jt4fnwp4s2506.png" alt="How caching is implemented on the UI" width="800" height="404"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When a client makes its first request (i) to fetch data from the server, the server follows these steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Request Processing:&lt;br&gt;
The server receives the request and identifies the required data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Data Retrieval from Storage:&lt;br&gt;
At the marker (ii), the server retrieves the data from its storage, which could be a database (as in this example) or a file directory.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Data Caching:&lt;br&gt;
Once the data is retrieved, the server stores it in its cache at the marker (iii). This cache could be an in-memory store like Redis or Memcached.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Data Return:&lt;br&gt;
Finally, the server sends the requested data back to the client.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Subsequent Requests&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If the client requests the same data again, the server follows these steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Cache Check:&lt;br&gt;
The server first checks its cache to see if the data is already available.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cache Hit:&lt;br&gt;
If the data is found in the cache (a cache hit), the server retrieves and returns the data directly to the client without making another trip to the database. This reduces latency and minimizes the load on the database.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Cache Miss:&lt;br&gt;
If the data is not found in the cache (a cache miss), the process starts over:&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;The server retrieves the data from the database or file directory.&lt;/li&gt;
&lt;li&gt;The server stores the newly fetched data in its cache for future use.&lt;/li&gt;
&lt;li&gt;The server returns the data to the client.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;By understanding caching you can design systems that are faster, more scalable, and resource-efficient. However, caching should be implemented thoughtfully, considering the specific requirements and trade-offs of your application.&lt;/p&gt;

&lt;p&gt;Please don't forget to comment, like or share this article ❤️&lt;/p&gt;

</description>
      <category>discuss</category>
    </item>
    <item>
      <title>Load Testing For API With Apache Benchmark On Windows</title>
      <dc:creator>Gabriella Amaefule</dc:creator>
      <pubDate>Sat, 18 Mar 2023 18:43:31 +0000</pubDate>
      <link>https://dev.to/gabriellaamah/load-testing-for-api-with-apache-benchmark-on-windows-58oj</link>
      <guid>https://dev.to/gabriellaamah/load-testing-for-api-with-apache-benchmark-on-windows-58oj</guid>
      <description>&lt;p&gt;I recently had the need to carry out load testing on some endpoints that I created for a project on my Windows OS. Setting this up was part of a herculean task because most tutorials were done on an Ubuntu machine.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Load Testing
&lt;/h2&gt;

&lt;p&gt;Load Testing is a type of performance testing that gives you insight into how your web application or HTTP server would react when more demand is placed on it.&lt;/p&gt;

&lt;p&gt;For this article, we will focus on testing an HTTP server using Apache Benchmark on a Windows OS.&lt;/p&gt;

&lt;h2&gt;
  
  
  Requirements
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Vs-code&lt;/li&gt;
&lt;li&gt;Apache Benchmark&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Installing Apache Benchmark
&lt;/h2&gt;

&lt;p&gt;The latest version of Apache Benchmark for windows can be installed &lt;a href="https://www.apachelounge.com/download/#google_vignette" rel="noopener noreferrer"&gt;here&lt;/a&gt;&lt;/p&gt;

&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%2F2pid86g3qg9ztye2r6hu.jpg" 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%2F2pid86g3qg9ztye2r6hu.jpg" alt="Latest Binary"&gt;&lt;/a&gt;&lt;/p&gt;

&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%2Fqijy2qi4i7vdlbdsuocy.JPG" 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%2Fqijy2qi4i7vdlbdsuocy.JPG" alt="Folder structure after unzipping"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Move into the &lt;code&gt;Apache24/bin&lt;/code&gt; directory and copy both the &lt;code&gt;ab&lt;/code&gt; and &lt;code&gt;abs&lt;/code&gt; executable files to your project directory (optional).&lt;/p&gt;

&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%2Fbl93ulh3j49hrjegfqf9.JPG" 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%2Fbl93ulh3j49hrjegfqf9.JPG" alt="ab and abs exec files"&gt;&lt;/a&gt;&lt;/p&gt;

&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%2Fs5tajmji0n6kyzs2dnzo.JPG" 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%2Fs5tajmji0n6kyzs2dnzo.JPG" alt="Current project structure"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Making a GET request to our server
&lt;/h2&gt;

&lt;p&gt;Run the following command in your terminal, in the directory where your &lt;code&gt;ab&lt;/code&gt; and &lt;code&gt;abs&lt;/code&gt; executable files are located:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

./ab -c 10 -n 20 http://localhost:8080/ 


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;-c&lt;/code&gt; Concurrency&lt;br&gt;
This indicates the number of multiple requests to make at a time. For this test, we are sending 10 requests to our server concurrently at the same time.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;-n&lt;/code&gt; Request&lt;br&gt;
This indicates the number of requests to perform.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;More of this flags and there descriptions can be found in the &lt;a href="https://httpd.apache.org/docs/2.4/programs/ab.html#:~:text=ab%20is%20a%20tool%20for,installation%20is%20capable%20of%20serving." rel="noopener noreferrer"&gt;Apache Benchmark site&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For this test, below is our expected response.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

this is ApacheBench, Version 2.3 &amp;lt;$Revision: 1903618 $&amp;gt;
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/
Licensed to The Apache Software Foundation, http://www.apache.org/

Benchmarking localhost (be patient).....done


Server Software:
Server Hostname:        localhost
Server Port:            8080

Document Path:          /
Document Length:        23 bytes

Concurrency Level:      10
Time taken for tests:   0.033 seconds
Complete requests:      20
Failed requests:        0
Total transferred:      19240 bytes
HTML transferred:       460 bytes
Requests per second:    606.58 [#/sec] (mean)
Time per request:       16.486 [ms] (mean)
Time per request:       1.649 [ms] (mean, across all concurrent requests)
Transfer rate:          569.85 [Kbytes/sec] received

Connection Times (ms)
              min  mean[+/-sd] median   max
Connect:        0    0   0.4      0       1
Processing:     3   12   3.9     13      18
Waiting:        2   10   4.0     10      17
Total:          3   13   3.8     13      18

Percentage of the requests served within a certain time (ms)
  50%     13
  66%     15
  75%     16
  80%     17
  90%     17
  95%     18
  98%     18
  99%     18
 100%     18 (longest request)


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;This provides a detailed insight into how our server performs when 10 concurrent requests are sent. It shows the amount of time it takes to process a certain percentage of our requests and provides in-depth analysis of our server's performance.&lt;/p&gt;

&lt;h2&gt;
  
  
  Making a POST request to our server using Apache Benchmark
&lt;/h2&gt;

&lt;p&gt;When making a POST request that requires a request body, we need to pass the data to our benchmark request. This is done by creating a &lt;code&gt;.txt&lt;/code&gt; file that should contain our request body data. The file should be in the same location as our &lt;code&gt;ab&lt;/code&gt; and &lt;code&gt;abs&lt;/code&gt; executable files.&lt;/p&gt;

&lt;p&gt;For this test, I created a &lt;code&gt;post.txt&lt;/code&gt; file that contains a JSON object representing our request body.&lt;/p&gt;

&lt;p&gt;The request body should be in one line with no extra end-of-line spaces.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TIP:&lt;/strong&gt; To place data in one line on VS Code, select the whole content and use this command &lt;code&gt;CTRL + SHIFT + J&lt;/code&gt;.&lt;/p&gt;

&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%2Fy57ex7nce2boflcr1om5.JPG" 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%2Fy57ex7nce2boflcr1om5.JPG" alt="File containing our request body data"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Proceed to run the following line of command in your terminal.&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

./ab -p post.txt -T application/json  -c 5 -n 5 http://localhost:8080/v1/product


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;-p&lt;/code&gt; Post File&lt;br&gt;
This indicates the file containing data to POST.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;code&gt;-t&lt;/code&gt; Content Type&lt;br&gt;
Content-type header to use for POST/PUT data, eg. application/x-www-form-urlencoded. Default is text/plain.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To test a server that requires an authentication header with Apache benchmark, the following command can be used:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

ab -p post.txt -T application/json -H 'Authorization: Token abcdbdhbuhfrhv' -c 10 -n 200 http://localhost:8080/v1/product


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;-H&lt;/code&gt; Custom header  -
This appends extra headers to the request. The argument is typically in the form of a valid header line, containing a colon-separated field-value pair (i.e., "Accept-Encoding: zip/zop;8bit").&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Note: Apache Bench only uses one OS thread irrespective of the concurrency level (specified by the -c flag). Therefore, when benchmarking high-capacity servers, a single instance of Apache Bench can be a bottleneck. To completely saturate the target URL, use additional instances of Apache Bench in parallel (if your server has multiple processor cores).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Don't forget to like, share and let me know if you found this helpful.&lt;/p&gt;

</description>
      <category>testing</category>
      <category>apache</category>
      <category>apitesting</category>
      <category>ab</category>
    </item>
    <item>
      <title>How to convert a PDF page to an image using Nodejs</title>
      <dc:creator>Gabriella Amaefule</dc:creator>
      <pubDate>Mon, 25 Jan 2021 20:55:15 +0000</pubDate>
      <link>https://dev.to/gabriellaamah/how-to-convert-a-pdf-page-to-an-image-using-nodejs-4inm</link>
      <guid>https://dev.to/gabriellaamah/how-to-convert-a-pdf-page-to-an-image-using-nodejs-4inm</guid>
      <description>&lt;p&gt;Recently, I had to work on a project where I was required to get the the cover page of pdf being sent to the server on each request. It was quite challenging because there were not enough resources to learn how to automate this task. I found a package which helped me, so I decided to share with the community!.&lt;/p&gt;

&lt;h3&gt;
  
  
  Project setup
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;RootFolder --
            |-pdfFileFolder --
                             |-myFile.pdf
            |-pdfImageFolder
            |-converter.js
            |-package.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Install third party library
&lt;/h3&gt;

&lt;p&gt;To effectively carry out this task, we need to install a third party library called &lt;a href="https://www.npmjs.com/package/pdf-poppler"&gt;pdf-poppler&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm i pdf-poppler
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Code
&lt;/h3&gt;

&lt;p&gt;copy the following line of code into the file labelled convert.js&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import {default as pdfConverter} from 'pdf-poppler'
import path from 'path'

function convertImage(pdfPath) {

    let option = {
        format : 'jpeg',
        out_dir : 'C:\\Users\\user\\Desktop\\RootFolder\\pdfImageFolder',
        out_prefix : path.basename(pdfPath, path.extname(pdfPath)),
        page : 1
    }
// option.out_dir value is the path where the image will be saved

    pdfConverter.convert(pdfPath, option)
    .then(() =&amp;gt; {
        console.log('file converted')
    })
    .catch(err =&amp;gt; {
        console.log('an error has occurred in the pdf converter ' + err)
    })

}

export default convertImage
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;strong&gt;convertImage function&lt;/strong&gt; contains an argument which is the path to the PDF file to be converted to an image. This function with it's argument can be called in any file where needed.&lt;/p&gt;

&lt;p&gt;Thank you for taking the time to read this post. If you've found this useful, please give it a ❤️ or 🦄, share and comment.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>pdf</category>
      <category>image</category>
    </item>
  </channel>
</rss>
