<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Kailash Kejriwal on Medium]]></title>
        <description><![CDATA[Stories by Kailash Kejriwal on Medium]]></description>
        <link>https://medium.com/@kailash360?source=rss-c660f17ebebd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*0jMtoN-pGCsRxCJFYXqZtQ.jpeg</url>
            <title>Stories by Kailash Kejriwal on Medium</title>
            <link>https://medium.com/@kailash360?source=rss-c660f17ebebd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 14:48:14 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kailash360/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[All about Vector Search, Vector Index and Vector Database - Part 1]]></title>
            <link>https://medium.com/@kailash360/all-about-vector-search-vector-index-and-vector-database-part-1-6e8b794079c3?source=rss-c660f17ebebd------2</link>
            <guid isPermaLink="false">https://medium.com/p/6e8b794079c3</guid>
            <category><![CDATA[vector-database]]></category>
            <category><![CDATA[vector-search]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[recommendation-system]]></category>
            <category><![CDATA[superintelligence]]></category>
            <dc:creator><![CDATA[Kailash Kejriwal]]></dc:creator>
            <pubDate>Thu, 01 Oct 2026 06:13:07 GMT</pubDate>
            <atom:updated>2026-10-01T06:16:15.598Z</atom:updated>
            <content:encoded><![CDATA[<h3>All about Vector Search, Vector Index and Vector Database — Part 1</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*50s8a7FSGHQerqcnUZ6T-Q.png" /></figure><p>We use AI tools in our day to day life. But have you ever wondered — how ChatGPT works? how recommendation engines work? Behind many AI applications that you see or you use, there is the concept of <strong>Vectors</strong>.</p><p>In this series, I will explain what Vector Search is, how Vector Index works, and how Vector Databases help us in this process.</p><h3>What is a Vector?</h3><p>Before diving into these topics, let us first understand what we mean by a Vector.</p><p>In simple terms, a Vector is just an array of elements of same data type. In context of AI, a <strong>Vector</strong> is an array of floating-point numbers, and it represents some information.</p><p>Now, what is their significance? Different human-readable media like text, audio, video are converted into Vectors. If you ask how we convert any data into a vector, then the answer lies with <strong>embedding models</strong>. They take a media as an input, say text or image, and return a Vector in output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7bc2vw4guFmElHl7ABiUUA.png" /><figcaption>Embedding Generation</figcaption></figure><p>These Vectors are usually large in size. The actual size depends on the embedding model that you use. For example, <em>all-MiniLM-L6-v2</em> produces vectors of 384 dimension, while OpenAI’s <em>text-embedding-3-large</em> produces a vector of whopping 3072 dimension.</p><h4><strong>Why do we need Vectors?</strong></h4><p>You may ask, <strong>why do we need to convert everything to Vectors? </strong>It is because it helps in finding similarity. Vectors that represent similar information are mathematically closer to each other than vectors which represent completely different information. Now, how do we calculate if two vectors are close to each other? We simply use distance calculation metrics, like Cosine similarity, Eucledian distance, etc.</p><p>For example, vectors of <strong>“I want to book a flight”</strong> and <strong>“I need to reserve an airline ticket”</strong> have higher Cosine similarity than vectors of <strong>“I want to book a flight” </strong>and<strong> “I need to buy a new laptop”</strong>. Hence, the first two sentences are semantically closer even though they use different words. This helps AI systems to understand which pieces of information is semantically closer or “related” to the input.</p><blockquote>It is important to mention that distance calculation should be performed between vectors of same dimension, and they should have been produced by the same embedding model.</blockquote><h3>What is Vector Search?</h3><p>Now that we know what a Vector is and how they work, we can proceed to understand Vector Search.</p><p>Imagine, you have an e-commerce application with list of 1000+ products along with their vectors. When a user searches for “comfortable trekking shoes”, you need to perform semantic matching between the user’s input and product description. This is where Vector Search kicks in. You convert the user’s input into a vector using an embedding model, calculate distance against all the available 1000+ vectors, find the 10 closest vectors to the input and return their associated products.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lsTVc_uhLhldMJ_rzXWUBA.png" /><figcaption>Vector Search workflow</figcaption></figure><p>Hurray! you have just performed <strong>Vector Search</strong>.</p><p>So, in simple terms, Vector Search is just finding top K vectors closest to your input vector. <em>Whenever an AI application needs to find semantically similar or “relevant” data, Vector Search can be used as a retrieval technique.</em></p><h4>Types of Vector Search</h4><p>Till now, we have learnt of vectors where most dimensions contain non-zero values. These are called <strong>Dense Vectors</strong>.</p><p>There is another type of vector, called a <strong>Sparse Vector</strong>, where most dimensions contain zero values. In text retrieval, sparse representations often focus on specific terms or tokens rather than their broader semantic meaning. When your search process involves a specific keyword i.e when exact terms matter, then you need to perform <strong>Sparse Vector Search</strong>.</p><p>For example, consider the text — <strong>I was charged a late payment fee</strong>. We need to pass it through a model to generate the sparse vector.</p><p>A sparse retrieval technique like <em>BM25</em>, or sparse embedding model such as <em>SPLADE </em>can represent the same text using mostly zeroes. Instead of storing all the zeros, you store only the non-zero entries.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BCDcdBv84jOAJbo2B4NFug.png" /><figcaption>How sparse vectors are generated</figcaption></figure><p>Here, the dimensions typically correspond to <strong>terms/tokens</strong>, and the non-zero values represent their importance.</p><p>We can also combine Sparse Vector Search and Dense Vector Search together, called <strong>Hybrid Search</strong>. In this type, we can perform Dense and Sparse vector search independently, combine their results, rearrange them using a re-ranker and return the most relevant results to the user. This approach is widely used in modern RAG systems.</p><h3>What is Vector Index?</h3><p><strong>Is Vector Search this simple?</strong> No. You can simply perform a linear search on your list of products if your product catalogue is small. Since we are comparing the query against every vector, this is known as <strong>Exact Nearest-Neighbour (ENN) search</strong>.</p><p>But consider e-commerce giants like Amazon, or an entire library — it will take a huge amount of time to find relevant information. This is where we need to optimise how we search over these vectors, and we do it by indexing these vectors. These indexes are called <strong>Vector Index</strong>.</p><p>There are multiple indexing strategies, like Inverted File Indexing, Hash Based Indexing, Graph Based Indexing. Out of these, the most popular one is <strong>Hierarchical Navigable Small World Index</strong> or <strong>HNSW Index</strong>. It is perhaps one of the finest indexing techniques, where vectors are stored in a layered graph. Due to this design, it takes minimal time to return closest vectors, and reduces search latency.</p><p>However, with this indexing technique, you perform vector search only on a subset of vectors, and “may” miss out on some potential products in the result. Hence, <strong>recall</strong>, which measures the number of true nearest neighbours returned by an approximate search divided by the total number of requested nearest neighbours (k), becomes an important factor to examine the efficiency of Vector Search with HNSW indexing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3IMwijLZ7Q6qFMca7Rjf8g.png" /><figcaption>How HNSW Indexing works</figcaption></figure><p>There are other parameters like the number of edges for each node in the graph (denoted by m), size of the candidate list explored during search (denoted by hnsw_ef), which influence the accuracy of the results. This is a completely separate domain of it’s own and I will discuss it in a separate blog.</p><p>These concepts are enough to build a fundamental concept of Vectors, and everything around it. We can now proceed to understand Vector Databases in the next blog of this series.</p><p><a href="https://medium.com/@kailash360/all-about-vector-search-vector-index-and-vector-database-part-2-e4e2743113f3">All about Vector Search, Vector Index and Vector Database - Part 2</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6e8b794079c3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[All about Vector Search, Vector Index and Vector Database - Part 2]]></title>
            <link>https://medium.com/@kailash360/all-about-vector-search-vector-index-and-vector-database-part-2-e4e2743113f3?source=rss-c660f17ebebd------2</link>
            <guid isPermaLink="false">https://medium.com/p/e4e2743113f3</guid>
            <category><![CDATA[qdrant]]></category>
            <category><![CDATA[semantic-search]]></category>
            <category><![CDATA[vector-database]]></category>
            <category><![CDATA[pinecone]]></category>
            <category><![CDATA[milvus]]></category>
            <dc:creator><![CDATA[Kailash Kejriwal]]></dc:creator>
            <pubDate>Thu, 01 Oct 2026 06:11:07 GMT</pubDate>
            <atom:updated>2026-10-01T06:11:07.715Z</atom:updated>
            <content:encoded><![CDATA[<h3>All about Vector Search, Vector Index and Vector Database — Part 2</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t310MXuWrK4P6f45pNNk2A.png" /></figure><p>In the previous blog, we got a good idea of what Vectors are and how they work. Now, as we know about the basics, we are good enough to proceed with <strong>Vector Databases</strong>.</p><h3>What are Vector Databases?</h3><p>As the name suggests, Vector Databases are specialized databases to store vectors efficiently such that vector search can be performed with minimal latency. Vector DBs provide an abstraction layer for storing, indexing, filtering, and retrieving vectors, saving developers from implementing these components from scratch. There are a lot of Vector Databases in the market, with the popular choices being <strong>Qdrant</strong>, <strong>Milvus</strong>, <strong>Pinecone</strong>.</p><p>I performed benchmarking of different Vector Databases under different workloads. You can give it a read below.</p><p><a href="https://medium.com/@kailash360/choosing-the-right-vector-database-recommendations-from-real-benchmarking-results-59e8d2983854">Choosing the Right Vector Database: Recommendations from Real Benchmarking Results</a></p><p>At a high level, Vector Databases seem to perform only vector storage and vector search. But, as you dive deeper, you find there’s a lot more going on.</p><h4>Vector Search in Vector Databases</h4><p>Vector DBs store the vectors that serve as a knowledge base for many AI applications. When a query vector is provided to the vector database, it returns the nearest results along with the original data.</p><p>Vector databases were initially built around the core problem of efficient Vector Search. Over time, they have evolved to support features such as filtering, quantization, distributed search, replication, and more.</p><p>You can tune different configurations in Vector DBs, and pass different search parameters to optimize your vector search while trading between latency and recall.</p><h4>Capacity Planning</h4><p>Let us assume, we have 1M products, each having a vector of 768 dimension, Float32 data type. A single vector of this size takes up 768 x 4 bytes = 3072 bytes i.e <strong>3 KiB</strong> of disk storage. For 1M vectors, this becomes <strong>~3 GB disk storage</strong>.</p><p>We have a primary key representing each vector in the data. The HNSW index contains an adjacency list of these primary keys, representing the multi-layered graph. For 1M vectors, these components occupy a good enough storage and become noticeable.</p><p>For a rough estimation, let us say the size of total data is 1.5 times of original vectors, i.e 1.5 <strong>×</strong> 3 GB = <strong>4.5 GB of disk storage</strong>. Such a volume of data is easily manageable, and can be loaded onto RAM for vector search.</p><blockquote>The exact overhead depends heavily on the database and its configuration, so a fixed multiplier such as 1.5× should only be treated as a rough example rather than a general rule.</blockquote><p>Alternatively, modern vector databases like <a href="https://medium.com/u/dd8d63417cf4">Qdrant</a> can use memory-mapped or disk-backed storage when keeping the entire dataset in RAM isn’t practical.</p><h4>Quantization</h4><p>Now, as your data grows to 10M, and then 100M, the raw vectors alone start to consume 30 GB, and then 300 GB storage. It would be impractical to have such a volume of data be directly loaded in memory. Instead, we compress these vectors, which requires less memory. This is called <strong>Quantization</strong>.</p><p>Quantization reduces the precision that is used to represent vector values. This allows them to consume less memory. Common approaches include <strong>Scalar Quantization</strong>, which can represent values using fewer bits, and provide upto 4-16x compression. <strong>Binary Quantization</strong>, which represents each dimension using a single bit, can provide 32x compression.</p><p>Lower-precision data types such as Float16 can also reduce storage and memory requirements, although this is distinct from some quantization schemes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*6mc_3wZQdCuR3DzfFOXDcQ.png" /><figcaption>Quantization technique</figcaption></figure><p>Quantization reduces overall memory required by each vector, and leaves a noticeable impact for a large scale data. However, this is a lossy compression and the actual information is not preserved. <strong>As the degree of compression grows, we see a drop in recall</strong>. It also reduces the search time as the distance calculation is now performed on a smaller data type than float32 data type.</p><p>Vector databases natively support different quantization techniques. Vector databases can generate quantized representations of the original vectors as part of their indexing/optimization process. The exact behaviour depends on the database and its configuration.</p><p>Some vector databases like <a href="https://qdrant.tech/">Qdrant</a> allow to configure whether you want to keep the quantized vectors pinned in memory for faster access during search, or stored in the disk to reduce memory consumption.</p><p>The recall drop caused by Quantization techniques, can be mitigated using <strong>Oversampling</strong> and <strong>Rescoring</strong>.</p><h4>Metadata Filtering &amp; Indexing</h4><p>Another important aspect of vector databases is the metadata that you store along with your vectors.</p><p>Imagine you have a dataset of 100M products. You can also store some metadata along with it, such as colour, brand, size, etc. During vector search, you can apply filters on these metadata fields to only search over the products that match your filtering criteria. This is called <strong>Metadata Filtering </strong>or<strong> Payload Filtering</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*P7vV7yaQAz6kiNSibYsKug.png" /><figcaption>Metadata with vectors in a Vector Database</figcaption></figure><p>It is very efficient when you have a large distribution of data across multiple domains or types. Applying metadata filters can significantly reduce the number of candidate vectors that need to be considered. Modern vector databases can integrate filtering with vector search so that the search process efficiently navigates only the relevant subset of the dataset.</p><p>When you have a large number of records, say 100M products, then the filtering process itself can become a time-consuming task. This is where we need to index the metadata fields as well. This is called <strong>Metadata Indexing </strong>or <strong>Payload Indexing</strong>.</p><p>Yes, we index them just like we index fields in SQL and other NoSQL databases. This speeds up the filtering phase and reduces overall search latency. Depending on the vector database, you can create indexes on metadata fields that are frequently used for filtering. The database then maintains these indexes to make filtering more efficient.</p><h4>Other Concepts</h4><p>Vector databases are not just limited to the concepts that we discussed above. In production, we need to check for data ingestion, GPU-based indexing, sharding, replication, observability and much more. I will cover these topics in a separate blog.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e4e2743113f3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Optimizing Qdrant at Scale: From 3 QPS to 700+ QPS on 100M Vectors]]></title>
            <link>https://medium.com/@kailash360/optimizing-qdrant-at-scale-from-3-qps-to-700-qps-on-100m-vectors-07a58d24e832?source=rss-c660f17ebebd------2</link>
            <guid isPermaLink="false">https://medium.com/p/07a58d24e832</guid>
            <category><![CDATA[performance-optimization]]></category>
            <category><![CDATA[qdrant]]></category>
            <category><![CDATA[vector-search]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[vector-database]]></category>
            <dc:creator><![CDATA[Kailash Kejriwal]]></dc:creator>
            <pubDate>Mon, 21 Sep 2026 16:47:21 GMT</pubDate>
            <atom:updated>2026-09-21T16:47:21.343Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6Al0UuG7uVaumn2Pg7r9qw.png" /></figure><p><a href="https://qdrant.tech/">Qdrant</a> is a popular choice among vector databases for building AI applications. The default configurations are often sufficient for small scale datasets. But as the data grows, we need to calibrate different configurations and search parameters to achieve the desired search performance.</p><p>I benchmarked Qdrant (<a href="https://github.com/qdrant/qdrant/releases/tag/v1.19.1">v1.19.1</a>) for similarity search over <strong>100M dense vectors</strong>, while tuning the search parameters like hnsw_ef , Top K, request protocol and more. The results showed that relatively small configuration changes could have a significant impact on latency and throughput.</p><blockquote>There is no single “best” Qdrant configuration. The right configuration is a trade-off between recall, latency, throughput, and resource utilization.</blockquote><h4>Benchmark Setup</h4><p>The benchmarking was performed on an octa-core virtual machine, equipped with 64 GB of memory and a 1.7 TB NVMe SSD.</p><p>I opted for a custom tool to run vector search on the <a href="https://huggingface.co/datasets/linyq/laion_text_debiased_100M">LAION-large-100m</a> dataset. The tool executed sequential as well as concurrent requests to understand how Qdrant performs under load.</p><h4>How I benchmarked Qdrant</h4><p>The dataset already provided with the test data i.e query vectors, and the ground truth, which simplified the benchmarking process. During ingestion, the vectors were compressed using <strong>Binary Quantization</strong> technique, while the original vectors were stored on disk. The quantized vectors, HNSW index graph, and ID trackers were pinned in memory.</p><p>As recommended in the <a href="https://qdrant.tech/documentation/tutorials-operations/large-scale-search/#uploading-and-indexing">Qdrant documentation</a> for searching over quantized vectors, the benchmarking invlolved both <em>oversampling</em> and <em>rescoring.</em></p><p>With a <strong>Top K = 100</strong>, I ran sequential search for 10 minutes and concurrent search for 5 minutes at different concurrency levels. The tool continuously cycled through the 1,000 test queries during these runs and captured the metrics including recall, p95 latency (both client-side and server-side), resource overhead. This allowed me to understand the complete behaviour of Qdrant under different workloads.</p><h4>Results</h4><p>While it is not practical to show all the benchmark results, a few interesting configurations and their results are shown below. We will discuss the different tunings and their effects in detail in the sections that follow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/994/1*HLNxfxD2eWZQGUrYAU7HaQ.png" /></figure><h4>Key Observations</h4><ul><li>Tuning the <strong>hnsw_ef</strong> brought a significant impact on the p95 latency. Reducing it from the default 128 to 16 significantly reduced the search effort, bringing server-side p95 latency down, from <strong>~406 ms </strong>to<strong> ~6 ms</strong>,<strong> </strong>a<strong> ~67x improvement. </strong>The impact was even larger under concurrency, where the server-side p95 latency improved by <strong>~108x</strong> at 16 concurrent requests. There was a minimal drop in recall.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PdDcw1una09dUrTMh7xnIA.png" /><figcaption>Effect of tuning hnsw_ef on latency and recall</figcaption></figure><p><a href="https://qdrant.tech/documentation/faq/qdrant-fundamentals/#if-limit-is-higher-than-hnsw_ef-does-qdrant-automatically-adjust-hnsw_ef"><em>Qdrant documentation</em></a><em> mentions that the effective value of search parameter is </em><em>hnsw_ef = max(hnsw_ef, limit). However, our observations showed that </em><em>hnsw_ef still has a significant impact even when it is below </em><em>limit. As clarified by the Qdrant community, this rule applies only to the lower layer of the HNSW graph, while the upper layers continue to use the configured </em><em>hnsw_ef value.</em></p><ul><li>The <strong>Oversampling factor (OS) </strong>determines how many candidates are retrieved from the quantized search stage before their original full-precision vectors are used for rescoring. For vector dimensions like 768 and above, as the number of candidate vectors increases, it brings a noticeable impact. Changing the OS from <strong>2 </strong>to<strong> 1.5</strong>,<strong> </strong>and<strong> </strong>then<strong> 1.2</strong> reduced the p95 latency by <strong>~20%</strong>. Without oversampling i.e OS = 1, there was a significant drop in recall.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qE_K-ra2Tjimokd2LQKdmg.png" /><figcaption>Effect of tuning oversampling factor on latency and recall</figcaption></figure><ul><li>The<strong> request protocol</strong> also plays an important factor. Shifting from HTTP/REST to gRPC saved the cost of serializing + deserializing the payload, further reducing latency by <strong>~25%</strong>. There was no impact on recall as similarity search is independent of request protocol.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R0eN_ZVnVbXPjj1AyPP-gA.png" /><figcaption>Effect of changing request protocol on latency and recall</figcaption></figure><ul><li>In Qdrant, we can also use <strong>io_uring </strong>which<strong> </strong>simply lets the database handle disk I/O asynchronously, so it can do more I/O operations with less CPU overhead and better performance. You can enable io_uring in Qdrant by setting QDRANT__STORAGE__PERFORMANCE__IO_URING=auto in the container environment. With io_uring enabled, there was a <strong>~15%</strong> improvement in p95 latency, and a negligible change in recall.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m2Jpxy8iOnPxCS6Q_AfuOw.png" /><figcaption>Effect of setting async disk I/O on latency and recall</figcaption></figure><ul><li>Another option is to reduce the number of search results by lowering <strong>Top K</strong> from 100 to 50. While there was almost no change in the server-side p95 latency for sequential run, the same for concurrent runs reduced by <strong>~75%</strong>. However, tuning the limit is not always an option, especially if your use case demands a large number of search results.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yxU4DKRU95K-inEipx3IbA.png" /><figcaption>Effect of tuning number of search results on latency and recall</figcaption></figure><h4>Further Steps</h4><ul><li>Qdrant community suggests that, in order to minimize latency, we can set the <strong>number of segments</strong>, i.e default_segment_number, equal to the number of available CPU cores, allowing a single request to utilize as many cores as possible.</li><li>To maximize throughput, we should use <strong>fewer and larger segments</strong> (typically around 2), allowing multiple requests to be processed in parallel across the available cores. Larger segments can also reduce the number of calculations required during search, though they require more time to build the HNSW index. We can set the segment size in kilobytes using max_segment_size .</li></ul><p>I will leave it to the readers to perform these experiments and share their observations.</p><h4>Conclusion</h4><p>With the right combination of search parameters, server-side p95 latency dropped from <strong>~400 ms</strong> to just <strong>~3 ms</strong> , while throughput increased from a few QPS to <strong>more than 700 QPS</strong>.</p><p>However, the HNSW graph density and the data characteristics play an important role in determining whether the above optimizations leave any significant impact. It is always recommended to take a sample of your data and runs benchmarks on it with different optimization techniques to find the optimal choice for your use-case.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=07a58d24e832" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Choosing the Right Vector Database: Recommendations from Real Benchmarking Results]]></title>
            <link>https://medium.com/@kailash360/choosing-the-right-vector-database-recommendations-from-real-benchmarking-results-59e8d2983854?source=rss-c660f17ebebd------2</link>
            <guid isPermaLink="false">https://medium.com/p/59e8d2983854</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[vector-database]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[database]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Kailash Kejriwal]]></dc:creator>
            <pubDate>Tue, 14 Jul 2026 08:16:11 GMT</pubDate>
            <atom:updated>2026-07-14T08:16:11.660Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PU3w3gZVHfb8SwGxRmiyxQ.png" /></figure><p>Choosing a vector database is less about picking the fastest system and more about making the right trade-offs.</p><p><strong>There is no one-size-fits-all answer</strong>. The “best” choice depends on factors like the size of your data, how much infrastructure you are willing to manage, and whether you care more about throughput, latency, or operational simplicity.</p><p>At smaller scales, most systems behave similarly. So, most of the databases do the job. But as the use-case scales and your data grows, those differences stop being subtle and start impacting real production systems. This blog focuses on turning benchmarking results into <strong>practical decisions</strong>.</p><p>I did a benchmarking exercise where I analyzed the behaviour of specialized vector databases like <a href="https://milvus.io/"><strong>Milvus</strong></a><strong>, </strong><a href="https://qdrant.tech/"><strong>Qdrant</strong></a><strong> </strong>and extensions like <a href="https://github.com/pgvector/pgvector"><strong>pgVector</strong></a><strong>, </strong>under realistic workloads, including their functionalities like filtering, ingestion, and scale. <a href="https://clickhouse.com/"><strong>ClickHouse</strong></a><strong>, </strong>an OLAP database,<strong> </strong>also<strong> </strong>provides vector search functionalities. Since we already had expertise in it,<strong> </strong>I included ClickHouse in the benchmarking process to evaluate if it can be used as a vector database. The goal of this blog is to move beyond raw metrics and understand what those benchmark numbers actually mean when you are building a system.</p><p>By the end of this article, you should have a clear answer to a more useful question: <strong>Which vector database should you use, and how does that choice change as you scale?</strong></p><h3>What is Vector Search?</h3><p>Before getting into vector databases and vector search, let us understand what a <strong>“Vector”</strong> actually is.</p><p>A <strong>Vector</strong> is essentially an array of numbers, that represents an entity like text, image, or video. In simple terms, it is how modern AI systems understand and compare data. Just like computers operate on bits, AI models operate on vectors, often with higher dimensions such as <strong>768</strong> or <strong>1536</strong>.</p><p>For example, the description of a product on Amazon can be represented as an array [0.23, 0.94, 0.34, 0.62 .......] of 768 dimension.</p><p>Moving ahead, <strong>Vector search</strong> is the process of finding the <em>closest </em>or<em> nearest </em>vectors to a given input vector. Now you may ask, what we mean by <em>nearest, </em>and why we need it.</p><p>Suppose, you are searching on <em>Amazon.com</em> with “shoes for trekking in rain”. Behind the scenes, an AI model first converts your query into a vector and compares it against vectors of the products available on the website. Then, it returns results like “Woodland waterproof hiking boots” or “Quechua outdoor trail shoes”, even if the exact words do not match. The most relevant results are always shown at the top.</p><p>This is done by calculating the <em>distance</em><strong><em> </em></strong>between the input vector and all the vectors stored in the Amazon database. Only the best few vectors <br>(with the minimum distance) are considered and eventually the results are shown to you.</p><blockquote><strong>Distance</strong> is evaluated using metrics like Cosine similarity, Euclidean distance and much more. <em>The lesser the distance, the more similar the vectors are. Each metric type is special in it’s own way, we can save it for another blog.</em></blockquote><p>Now, imagine we are searching for those shoes across millions of available products. In this case, we will need to evaluate the distance across a million vectors, and also find the closest vectors. This is a costly operation overall, and consumes computational resources.</p><p>This is where <strong>Vector Databases </strong>come in. Their job is simple — to store vectors efficiently and make similarity search fast enough.</p><h3>Benchmark Setup</h3><p>I used an octacore virtual machine, equipped with 64 GB memory and a 1.7 TB NVMe SSD, to run the benchmarking process.</p><p>Thanks to <a href="https://medium.com/u/3f9e50f14c9">Zilliz</a> for their benchmarking tool — <a href="https://github.com/zilliztech/VectorDBBench#what-is-vdbbench"><strong>VectorDBBench</strong></a>, which already provided with a well-developed benchmarking interface and dataset of multiple scales. The tool ran on the same VM, but had negligible resource footprints compared to the actual benchmarking process. You can clone their <a href="https://github.com/zilliztech/vectordbbench#quick-start">GitHub repository</a> and run your own benchmarks.</p><p>The benchmarking was performed across three dataset sizes:</p><ul><li><strong>50K vectors (1536 dimensions)</strong></li><li><strong>1M vectors (768 dimensions)</strong></li><li><strong>10M vectors (768 dimensions)</strong></li></ul><p>In each run, the benchmark was done serially on each database. Again, multiple such runs were conducted, and the results below are averaged to reduce variance.</p><h3>Results: 50K Vectors</h3><p>To start with the exercise, I took a dataset of 50K vectors and performed 3 insert + read runs on each database. The figures below are average of those runs.</p><pre>| Database    | QPS   | Recall (%) | Latency (ms) | CPU (%) | Memory (GB) |<br>|-------------|-------|------------|--------------|---------|-------------|<br>| ClickHouse  | 86.9  | 98.94      | 80.1         | 19.77   | 13.84       |<br>| Milvus      | 608.6 | 94.71      | 3.63         | 18.08   | 10.98       |<br>| Qdrant      | 184.6 | 98.99      | 11.5         | 22.89   | 11.40       |<br>| pgvector    | 141.3 | 99.29      | 14.5         | 26.60   | 11.32       |</pre><p>Each system shows a distinct profile. <strong>Milvus</strong> leads in throughput but sacrifices recall, favouring speed. <strong>pgvector</strong> achieves the highest recall but with high latency and CPU usage, making it resource-intensive. <strong>Qdrant</strong> balances near-perfect recall with moderate latency and CPU usage. <strong>ClickHouse</strong> also offers high recall but with higher latency and lower CPU usage, trading speed for analytical suitability.</p><h3>Results: 1M Vectors</h3><p>To simulate a production-like environment, I had to increase the input data. So, I took a dataset of 1M vectors and took 5 runs on all the databases. The figures below are average of them.</p><pre>| Database    | QPS    | Recall (%) | Latency(ms) | CPU (%) | Memory (GB) |<br>|-------------|--------|------------|-------------|---------|-------------|<br>| ClickHouse  | 102.96 | 98.40      | 14.98       | 48.65   | 16.70       |<br>| Milvus      | 822.14 | 95.31      | 3.23        | 30.58   | 14.08       |<br>| Qdrant      | 438.35 | 95.79      | 7.28        | 24.16   | 12.22       |<br>| pgvector    | 200.60 | 97.08      | 20.78       | 47.81   | 11.54       |</pre><p><strong>Milvus</strong> dominates in throughput with very low latency, making it ideal for speed-focused workloads, though with slightly lower recall. <strong>Qdrant</strong> offers a balanced profile with good performance and accuracy. <strong>ClickHouse</strong> prioritizes accuracy but has lower throughput and higher latency. <strong>pgvector</strong> delivers strong recall but lags in efficiency, with higher latency, higher CPU usage, and only moderate throughput.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5BUpcBs8R6q1CvPwgUEmEw.png" /><figcaption>Performance Comparison of Milvus, Qdrant, ClickHouse and pgVector for 1M dataset</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KsrKNUZ-JxPJXBQdeyx0cA.png" /><figcaption>CPU &amp; Memory consumption at 1M scale</figcaption></figure><h3>Results: 10M Vectors</h3><p>I also wanted to observe how these databases behave in an enterprise-scale environment, and now increased the dataset size to 10M vectors. This time, I performed 2 benchmarking runs.</p><pre>| Database   | QPS    | Recall (%) | Latency (ms) | CPU (%) | Memory (GB) |<br>|------------|--------|------------|--------------|---------|-------------|<br>| Milvus     | 144.17 | 96.23      | 12.6         | 52.85   | 40.10       |<br>| Qdrant     | 161.67 | 95.79      | 13.0         | 30.00   | 15.82       |<br>| ClickHouse | 1.85   | 96.94      | 12135        | 76.52   | 20.82       |</pre><p>At 10M scale, system differences become much clearer. <strong>Qdrant</strong> and <strong>Milvus</strong> are the only practically usable options. Qdrant offers the best balance of performance and efficiency, while Milvus provides slightly better recall but at a much higher resource cost. <strong>ClickHouse</strong> struggles significantly, with very low throughput, high latency, and heavy CPU usage, making it impractical for real-time search. <strong>pgvector</strong> fails to scale, unable to complete ingestion. Overall, specialized vector databases become essential at this scale, with Qdrant favoring efficiency and Milvus favoring accuracy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MRYMXqrOeoZV3G5PcMDl1Q.png" /><figcaption>Performance Comparison of Milvus, Qdrant, ClickHouse and pgVector for 10M dataset</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0Pn0Oo8xt9Lklbr_hgXUiA.png" /><figcaption>CPU &amp; Memory consumption at 10M scale</figcaption></figure><p><em>The benchmarking was performed keeping all the databases in their default configurations. We can definitely tune the parameters for each database, and the figures will improve. However, the relative performance still happens to be the same.</em></p><h3>Which Vector Database Should You Actually Use</h3><h4><strong>&lt;100K Vectors: Reuse What You Already Have</strong></h4><p>At smaller scales, system differences are minimal. Latency remains low, filtering overhead is negligible, and tuning has little impact. <strong>pgvector</strong> and <strong>ClickHouse</strong> perform well enough that introducing a specialized vector database offers no real benefit. Also, using an existing infrastructure reduces the operational overhead for the developer. But, future-scalability remains limited.</p><h4><strong>~1M Vectors: Trade-offs Emerge</strong></h4><p>At this scale, latency increases and filtering begins to impact performance. <strong>Qdrant</strong> and <strong>Milvus</strong> provide more stable latency and better resource efficiency. <strong>ClickHouse</strong> and <strong>pgvector</strong> remain usable but require careful tuning and show higher variability.</p><h4>~10M Vectors: Scalability is necessary</h4><p>At 10M vectors, resource constraints hit and ingestion challenges are visible. <strong>Qdrant</strong> and <strong>Milvus</strong> handle scale more predictably, while general-purpose databases require significant effort and compromises. At this scale, specialized vector databases become essential for maintaining performance and reliability.</p><h3>Milvus vs Qdrant at Scale (~10M Vectors)</h3><p>At ~10M scale, both <strong>Milvus</strong> and <strong>Qdrant</strong> deliver high-quality ANN search with comparable recall. In our benchmark, Qdrant achieved higher throughput while consuming significantly less CPU and memory, making it a more resource-efficient choice. Milvus maintained slightly higher recall, making it attractive when maximizing search accuracy is the primary objective.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*soun_jKETjoIMj6Tj5KGbg.png" /><figcaption>Resource v/s Recall compairson for Milvus and Qdrant at 10M scale</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zRLbDpEunBbzkLoCuIX0jQ.png" /><figcaption>Resource v/s Throughput compairson for Milvus and Qdrant at 10M scale</figcaption></figure><p>Their architectural differences explain this split. Milvus is backed by a larger ecosystem. It provides automatic re-sharding, suits large-scale, production-heavy deployments but adds operational complexity. Qdrant, built in Rust with fewer dependencies, focuses on simplicity, predictable performance, and ease of use. This makes Qdrant a strong choice for teams seeking efficiency without managing complex infrastructure. Some features like automatic re-sharding, GPU-acceleration and support for multiple indexing algorithms is not yet available in Qdrant OSS.</p><pre>| Feature        | Milvus            | Qdrant       |<br>|----------------|-------------------|--------------|<br>| Re-sharding    | Yes               | No (for OSS) |<br>| Github Stars   | 43.8K             | 30.3K        |<br>| Operations     | Hard              | Easy         |<br>| Dependencies   | Yes               | No           |<br>| Language       | Go + C++          | Rust         |<br>| License        | Apache 2.0        | Apache 2.0   |<br>| Foundation     | Linux Foundation  | No           |</pre><p>In practice, the choice comes down to priorities.</p><blockquote><strong>Milvus is optimized for performance and scalability, especially under heavy load, while Qdrant focuses on efficiency and operational simplicity.</strong></blockquote><h3>Final Thoughts</h3><p>At this point, the question is not which database is “best”, but which fits your workload, scale, and tolerance for tuning. Each system optimizes for different trade-offs that become clear at larger scales.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ctF9yQrjbGyRAokhojPJZw.png" /><figcaption>Overall Search Performance v/s Operational Simplicity for ClickHouse, Qdrant and Milvus for 10M scale</figcaption></figure><p><strong>Milvus</strong> is the most predictable, offering solid performance and a mature ecosystem, but with higher operational complexity. <strong>Qdrant</strong> provides a stable performance and ease of use with minimal tuning, but it trades off some peak performance. <strong>ClickHouse</strong> is powerful and flexible, especially for analytical workloads, but requires careful tuning and expertise if you want to use it as a vector database. <strong>pgvector</strong> is the most convenient, working well for small datasets but struggling to scale efficiently.</p><p><em>We focused on a smaller, representative set of systems (ClickHouse, Milvus, Qdrant, and pgvector) to keep the comparison controlled and meaningful, instead of diluting insights across alternatives like Weaviate, Pinecone, Chroma, Vespa, and Elasticsearch kNN, which vary significantly in architecture, abstraction, and deployment models.</em></p><p>Before you conclude, these numbers are not fixed. Most of these systems can be tuned quite aggressively, and the results can shift significantly based on configuration. That deserves its own deep dive, which I will cover in a separate blog.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=59e8d2983854" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Web 3.0 — A New Web-volution]]></title>
            <link>https://medium.com/tech-iiitg/web-3-0-a-new-web-volution-1970873089a3?source=rss-c660f17ebebd------2</link>
            <guid isPermaLink="false">https://medium.com/p/1970873089a3</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[web3]]></category>
            <category><![CDATA[blockchain]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Kailash Kejriwal]]></dc:creator>
            <pubDate>Sat, 04 Dec 2021 11:58:51 GMT</pubDate>
            <atom:updated>2021-12-04T11:58:51.972Z</atom:updated>
            <content:encoded><![CDATA[<h3>Web 3.0 — A New Web-volution</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*X9KCGT1yNWDFvEu3.png" /></figure><p>History has taught us that only change is constant, and drastic changes are not a matter of surprise when it comes to the field of any technology — more specifically, in Web Development. The web has changed a lot over the past few decades and yet again we have a new revolution in this domain — the <strong>Web 3.0</strong>. In this article I will discuss what exactly is web3 and how it is going to transform how the web architecture works.</p><h3>What are Web 1.0 and Web 2.0?</h3><p>Before explaining what Web 3.0 is, let me brief you about <strong>Web 1.0</strong> and <strong>Web 2.0</strong>. If you have ever visited <a href="https://www.wikipedia.org/"><strong><em>Wikipedia</em></strong></a> in your childhood , or maybe surfed these news channels — <a href="https://web.archive.org/web/20000815052826/http://cnn.com/"><strong><em>CNN.com</em></strong></a> , then you have noticed you could only view the data in the website — you could not send back any data from your end, or maybe interact much with the website. This was Web 1.0 — where the user can only read the data in the static web pages.</p><p>Then, there appeared Web 2.0. This version of the web allowed interaction with the webpages. Most of the websites we see today, including <a href="https://www.facebook.com/"><strong><em>Facebook</em></strong></a>, <a href="https://www.youtube.com/"><strong><em>YouTube</em></strong></a> — where the user can interact with the website and send data from his/her end, laid the foundation of Web 2.0. It changed the way we used the internet; there was a tech-boom. Some may argue that after the advent of Cloud Computing (using someone else’s resources in exchange of money) also revolutionized the web, so it “may” be termed as Web 2.5. Then finally, we have the Web 3.0.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*0jMIwzy7uPwhKfyr" /></figure><h3>What was the need of Web 3.0?</h3><p>One may ask, when the current web seemed to be absolutely fine, with a lot of users adding to it daily, what was the need to bring a change? Why did we bring Web 3.0 when Web 2.0 can already fulfill our needs?</p><p>There are a number of severe hazards that exist in the current web. We know it, we see it, yet we ignore it. If you regularly read news, you have frequently heard that the user data of some XYZ company was leaked online, or stolen by cyber-attackers or ‘hackers’. You must have heard about the recent Facebook data leak</p><p><a href="https://www.technologyreview.com/2021/04/07/1021892/facebook-data-leak/">What you need to know about the Facebook data leak</a></p><p>A question arose as to why the incident happened and whether it could be prevented in the future.</p><p>Again, content like posts, videos are often put down from the internet due to the intervention of any third party — be it the government, or any other organization.</p><p>Can this be fixed and the internet be more transparent? All of these answers lie in Web 3.0.</p><h3>What is Web3?</h3><p>Now, after such a long discussion, let me tell you what <strong>Web 3.0</strong> is.</p><blockquote>Web3 is a backend revolution. It’s a set of protocols led by blockchain, that intends to reinvent how the Internet is wired.</blockquote><blockquote>— someone on the internet</blockquote><p>The sentence above may sound a bit tongue-twisting. Let’s follow with an example.</p><p>Suppose you had 30 rupees and you lent your 3 friends — Jack, Rose and Martha, 10 rupees each. So now, each of your friends have 10 rupees. Also you have informed everyone about these lending and everyone knows who owes what amount and to whom. Now, Jack returns you back 10 rupees. So he doesn’t owe you anything. At the same time, you also inform everyone else that Jack has paid back his money and is free from your debt. So, when these transactions happened, everyone else involved in this system got informed.</p><p>The above scenario depicts a blockchain, where the same copy of a single ledger (a record of transactions) is maintained with everyone involved in the system. Every time, a new transaction takes place (like Jack paying back his money), the ledger gets updated for everyone, just like you informed everyone else about the transaction. This is also known as Decentralization, or keeping the same copy of data distributed or spread throughout the network.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/601/0*b325LiHaMsAw0qgq" /></figure><p>Web 3.0 uses this concept of Decentralization to solve a lot of problems. In Web 3.0, the data of the users is not stored in a company-backed database, rather it is distributed throughout the decentralized network. So every time a transaction happens, the data at each of the nodes (term for the users involved in the system) gets updated and that too in an encrypted way. Simple, isn’t it?</p><h3>How does Web 3.0 work?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/0*CbSxBc8NFJvFxV8q" /></figure><p>Web 3.0 is implemented in the frontend section of an application. The web3 package contains a collection of libraries that are used to connect the client to the decentralized blockchain-based backend. Now, if you ask how exactly web3 functions, it is not as complicated as it sounds.</p><p>web3 behaves like a wrapper on the JSON RPC protocol. In JSON RPC protocol, the client makes a request stating the method to implement, the parameters to be passed as inputs, etc. in JSON format, and the server (here the blockchain system) executes the methods in the request.</p><p>The client generally uses a wallet like <a href="https://metamask.io/"><strong>MetaMask</strong></a> that acts as a provider, or a medium of interaction with the backend.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/676/0*1Tzdm2PqRE-71JIP" /></figure><p>Now, let us see how Web 3.0 is implemented. To discuss the hands-on implementation of Web 3.0 and integrating it in a DApp, it may require an entire article; so our discussion will be limited to using the basic functionalities of Web3.0.</p><p>To start with Web 3.0 in JavaScript, we have to install the web3 package using the following command</p><pre>npm i web3</pre><p>Next, we will need to import the web3 package and initialize the Web3 instance using a provider. A <strong><em>Provider</em></strong>, in simple words, is the URL of the blockchain network you want to connect to. Generally, if you are running Ganache, you have a test network running on your device, and the URL will be <a href="https://localhost:7545/">https://localhost:7545</a>.</p><p>Ganache is a tool that runs a blockchain test network on your local device. It provides some free Ethereum accounts that can be used to test your blockchain application. You can learn more about Ganache from here.</p><p><a href="https://www.trufflesuite.com/ganache">Ganache | Truffle Suite</a></p><p>We can import the package using any of the methods</p><pre>const Web3 = require (“web3”)<br>//or ES6<br>import Web3 from “web3”</pre><p>We can now create the instance</p><pre>const web3 = new Web3(Web3.givenProvider || “https://localhost://7545”)</pre><p>Now, we will create a contract instance using the ABI and contract address.</p><p><strong><em>ABI</em></strong> refers to the JSON data that contains the information of the smart contract. It contains the data of all the public methods, public variables, events, etc. within the smart contract.</p><p><strong><em>Contract address</em></strong> is generated when the contract is deployed in the Ethereum network. The address comes from the creator’s address and the number of transactions sent from that address (the “nonce”)</p><pre>const contract = new web3.eth.Contract(abi,address)</pre><p>Now, we have successfully connected to the backend and can access the public variables, methods and events on the smart contract. You may ask how we do that.</p><ul><li><strong>contract.variable().call() </strong>: For every public variable you define inside the smart contract, Web3 creates a method with the same name as the variable, so that you can access it. Although, the .call() needs to be concatenated after the function name to execute it.</li><li><strong>contract.methods</strong> : All the public functions that you have defined inside the smart contracts are accessed using this property.</li></ul><p>Again, there are some other essential functions which are included inside the web3.utils library that help to implement the frontend logic, like</p><ul><li><strong>web3.eth.accounts()</strong> : this method returns all the accounts currently associated with the current user</li><li><strong>web3.utils.toWei()</strong> : this method helps to convert any number to Wei, the smallest unit of Ether</li></ul><blockquote>1 Ether = 1000000000000000000 Wei</blockquote><ul><li><strong>web3.utils.BN()</strong> : Like the above method, this function helps to convert a number to a Big Number.</li></ul><blockquote>BN is a object whose constructor returns a big number primitive — also called a Big Number value, or sometimes just a BN — to represent <strong>whole numbers larger than ²⁵³ — 1</strong> ( Number. MAX_SAFE_INTEGER ), which is the largest number JavaScript can represent with a number primitive (or Number value).</blockquote><p>All the methods, and more information about implementing the web3 library can be found from their official documentation.</p><p><a href="https://github.com/ethereum/web3.js#readme">GitHub - ChainSafe/web3.js: Ethereum JavaScript API</a></p><h3>How does Web 3.0 benefit us?</h3><p>We have discussed the technical side of Web 3.0, but we have hardly seen how it will benefit the users.</p><p>To start with, since data in Web 3.0 is distributed throughout the network in an encrypted way, no company can access your personal data and sell it to advertisers, like they have been doing over the past few years. This makes the user the owner of his/her data.</p><p>Immutability is one of the founding concepts of blockchain, and this strengthens Web 3.0. The content which is once uploaded using Web 3.0 cannot be deleted. So, no third party will be able to take down any content out of their own interest.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*X0pZtmM_foi-8nt5.png" /></figure><p>Since data is distributed throughout the blockchain system, and the system is managed completely, by the users, there is no point of a system failure as in the case of a company, and this can keep Web 3.0 running without any issue. Further, the data is accessible from any point in the world at a much faster rate.</p><p>Again, Web 3.0 also allows the execution of transactions that remain transparent to everyone. There is no middleman involved, This makes Web 3.0 more secure and safe.</p><h3>Is Web 3.0 worth it?</h3><p>Some may argue that Web 3.0 is a very advanced technology and it will be too difficult to shift from the current Web 2.0-based technology to a Web 3.0 architecture. To be specific, the older devices will not be able to adapt to this tech. Further, the concept of Web 3.0 involves a lot of fields and it can get difficult for a beginner to on-board with this technology.</p><p>Still, considering the level of security, safety and speed that Web 3.0 provides, it can definitely be said that Web3 will be worth it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*gMkfqjAz6xmza5Hi" /></figure><p>So, you have now understood what Web 3.0 is, how it works and why it is needed. The multinational companies are adapting these technologies at a great pace, and the concept of Cryptocurrency has further drawn the attention of the common folks.</p><p>Happy Coding! 💻</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1970873089a3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/tech-iiitg/web-3-0-a-new-web-volution-1970873089a3">Web 3.0 — A New Web-volution</a> was originally published in <a href="https://medium.com/tech-iiitg">tech@iiit-gwalior</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Handling Requests on Server-side]]></title>
            <link>https://medium.com/@kailash360/handling-requests-on-server-side-1cef8f59a99a?source=rss-c660f17ebebd------2</link>
            <guid isPermaLink="false">https://medium.com/p/1cef8f59a99a</guid>
            <category><![CDATA[development]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Kailash Kejriwal]]></dc:creator>
            <pubDate>Mon, 25 Oct 2021 12:21:03 GMT</pubDate>
            <atom:updated>2021-10-25T12:21:03.861Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WAjU6RbBrNVCybaocLnfNw.jpeg" /></figure><p>In my <a href="https://medium.com/@kailash360">last few blogs</a>, I have discussed creating a NodeJS-based server, the different types of requests sent to the server and handling the response we get back from it. Now one may ask how will a server handle these requests? How does it process the queries and parameters that are sent with the request? In this article, we will be discussing request handling on the server side.</p><h3><strong>Handling a request</strong></h3><p>For a basic NodeJS-based server, the code that handles any request will somewhat look like this.</p><pre>app.METHOD(“/ROUTE”,MIDDLEWARES,FUNCTION)</pre><p>Well, the format looks pretty confusing. Let us analyze it with an example.</p><p>Consider the following code to get two numbers in request, add them and send the sum as the response.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/58d0a72c85c8505d365063b6717ebc23/href">https://medium.com/media/58d0a72c85c8505d365063b6717ebc23/href</a></iframe><p>Now let us analyze it. First we created an instance of Express server, and added the following parts.</p><ul><li><strong>Method</strong> — In the above example, we have used the <strong><em>get</em></strong> word in place of METHOD. It shows what kind of request (GET, POST, PATCH, PUT or DELETE) is coming from the client.</li><li><strong>Route</strong> — Next we have the “/ROUTE” part. It defines the route or path that is attached to the URL. Each of these endpoints are declared separately inside the server-side code and the server can handle requests at these endpoints only. Here in the example, we declare that the piece of code will handle any incoming GET request with <strong><em>/add</em></strong> as the endpoint. It then passes on the request data to the middleware.</li><li><strong>Middleware</strong> — Middleware is essentially an intermediate function. In simpler words, the request data passes through middleware and gets verified or modified. They help to reduce code complexity and can be used for multiple routes at once. Although, middleware is optional and it is not necessary to always have a middleware in the code. The parameters passed into this function are <strong>req</strong> for request that comes, <strong>res</strong> for response to be sent back, <strong>next</strong> for the function that runs after the current middleware successfully executes. In the example, the <strong>checkInteger</strong> middleware will verify whether the data in the request is integer or not. If it is not an integer then we will send back an error message.</li><li><strong>Method</strong> — After the data passes through the middleware, it goes to the main function that will perform the desired function we wanted it to. The parameters this function receives is only for request and response. In our example request finally goes to the <strong>addNumbers</strong> function where the two numbers will be added and sent back as response to the client.</li></ul><h3><strong>Sending back a response</strong></h3><p>We use the response parameter to send back the response. We have several methods to send the response. Each response contains an object that defines the data and other properties to be sent. We have different methods to send the response.</p><ul><li>send()</li><li>end()</li><li>json()</li></ul><blockquote>In the above methods json() and send() are quite identical. They do the same thing, and json() calls send() in the end. Although in the end() method, we send a response without any data. It can be used for sending an error response like</blockquote><pre>res.status(404).end()</pre><blockquote>The status() method helps to define the status of a response — whether it is a success (200) or an error (400,401,402,etc). This helps in better error handling and understanding the errors of the client side.</blockquote><p>Let’s run our server, and run it on Postman and see the response. Before proceeding, make sure you have the knowledge of sending requests from client. In case you don’t you can read from the blog below.</p><p><a href="https://medium.com/@kailash360/all-about-http-requests-and-response-3230cb0e8bea">All about HTTP Requests and Response</a></p><p>Let us add 2 numbers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dKw8-GNXqfVPRkKOIxBP6g.png" /><figcaption>Getting sum of two numbers</figcaption></figure><p>To verify whether our middleware is working correctly, we will send invalid data</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9WfyAHsdRwy6nexoPHOXUA.png" /><figcaption>Getting error for invalid data</figcaption></figure><p>Hurray! our server is working as expected.</p><h3><strong>Handling requests of different methods</strong></h3><p>Now we may need to handle different types of requests on the same route. We can do it in the following manner.</p><pre>app.get(“/add”,checkInteger,addNumbers)<br>app.post(“/add”,checkIntegers,addNumbers)<br>app.patch(“/add”,checkIntegers,addNumbers)<br>app.put(“/add”,checkIntegers,addNumbers)<br>app.delete(“/add”,checkIntegers,addNumbers)</pre><p>For the other methods like POST, PUT, etc, the data is accessible in the request body. It is of different types like</p><ul><li>JSON (for simple text-based data)</li><li>Formdata (for files and media)</li></ul><p>In every request, the body needs to be parsed separately in the backend to extract the useful data. In the example below, we will add the numbers using a POST request and the numbers will be sent in the request body in JSON format.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/033eb79ae245cab947f47b25126238d6/href">https://medium.com/media/033eb79ae245cab947f47b25126238d6/href</a></iframe><p>Let us test it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W-zwg0ORL5JdvnNw_bMabA.png" /><figcaption>Adding 2 numbers using POST request</figcaption></figure><p>Let us check if our middleware is working properly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TFcQfhVj2wPZ7AGXV4cxNg.png" /><figcaption>Sending invalid data to check middleware</figcaption></figure><p>So we have finally handled the incoming client requests on our server, and learnt to develop a complete client-server system based on NodeJS. In my next article, I will discuss JWT authentication and implementation — a must-know for all the developers.</p><p><em>Happy Coding!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1cef8f59a99a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[All about HTTP Requests and Response]]></title>
            <link>https://medium.com/@kailash360/all-about-http-requests-and-response-3230cb0e8bea?source=rss-c660f17ebebd------2</link>
            <guid isPermaLink="false">https://medium.com/p/3230cb0e8bea</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[web-design]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[https]]></category>
            <dc:creator><![CDATA[Kailash Kejriwal]]></dc:creator>
            <pubDate>Tue, 05 Oct 2021 13:22:13 GMT</pubDate>
            <atom:updated>2021-10-05T13:22:13.442Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/553/0*lkmBDedIN61vkwry" /></figure><p>In my last article, I ended with a note that we will design routes to handle requests from clients and send a response. Before proceeding let me brief you about these terms.</p><h3>What are Request and Response?</h3><p>So what is a ‘Request’? In our daily life, we often make requests to someone. We may request for some resources like books, money or anything else. Sometimes we may make a request for services like validation, or get some task done. Similar to that, we make ‘requests’ to the server for files, data, and other services.</p><p>And corresponding to each request, we get a ‘response’ back from the server which brings us the data we asked for, or tells us the status whether the task was successfully completed or not.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/0*sh5jXDayRfi90CNE.png" /><figcaption>A Request-Response System</figcaption></figure><h3>Making a Request</h3><p>Now, how to make a request? Application Program Interface or API is the intermediary that you use to make a request. Let us take an example. Consider the URL</p><blockquote><a href="https://jsonplaceholder.typicode.com/todos"><em>https://jsonplaceholder.typicode.com/todos</em></a></blockquote><p>This URL brings us random tasks in a todo list. Now lets understand how it is working. The part <a href="https://jsonplaceholder.typicode.com/"><em>https://jsonplaceholder.typicode.com</em></a> is the domain. It is where all the requests will be made. The remaining part /posts is the path or route of API. It generally tells the server what kind of data you want and how you want it. The server then follows the route and prepares the data to be served to you. Finally it is sent back to the client in the form of a response; posts as shown in the example.</p><p>To test our APIs, we generally use a tool called Postman. It helps us test our API endpoints. You can try it from here.</p><p><a href="https://www.postman.com/">Postman: The World&#39;s Leading API Platform | Sign Up for Free</a></p><p>Let’s test the URL in the example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dVJuCBto8FsprSzM" /><figcaption>Example of a Request</figcaption></figure><p>Here you can see that we have our data in JSON format (the general format to exchange data between client and server). In the response, all the objects are clubbed together into an array where each of the objects represent a post. Each post again has 4 properties or ‘fields’ namely userId, id, title and body.</p><h3>Queries and Parameters</h3><p>Now, what if we want to fetch a single post based on the id of the task. Parameters and queries come into the picture here. Queries are set within the route, while parameters are sent as separate variables inside the route. Each query or parameter represents the field based on which the response data will be filtered.</p><p>Suppose we want to bring the post having id of 2.</p><p>Using query,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*aC5ihmxt5W0tLjYt" /><figcaption>Fetching filtered data using query</figcaption></figure><p>Using parameters,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*2IHC6FfmKp_MOlYW" /><figcaption>Fetching filtered data using parameter</figcaption></figure><p>So you can see that the response in both the cases is the same, although the request URL is different. You can apply multiple parameters in a request URL by appending the key-value pair with the ‘&amp;’ character.</p><h3>Request Headers</h3><p>Before moving on, let me brief you about headers. Request Header is an object that stores the information of the request, like the content-type within the request body, any authorization field, etc. Similarly, response headers store information about the response. A response header would look like</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gnDTMUulYD-9X22K" /></figure><h3>Request Methods</h3><p>In all the above examples we observe that the request method is set to GET. You may ask what is a ‘request method’? Well,Request Methods define the primary action that we are asking the server to perform. There are generally 5 types of request methods:</p><ul><li><strong>GET</strong>: As already seen above, this method simply ‘gets’ or brings us the data we want. This is the most simple one of all. If you want to filter the data based on some specific properties, you can add queries or parameters as shown before.</li><li><strong>POST</strong>: Whenever you make a GET request, the parameters get exposed in the request URL. Now, if it is some sensitive data like a password, it may get exposed to someone. So we need to hide the data we are sending. Here, the POST request comes into play. For a post request, we define a body field which contains the data we want to send and the body remains non-exposed throughout the session. We can also send media files within the body, which is not possible for a GET request.</li></ul><p>Let us test a POST request with userId = 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ndAvwi9YsuGnOJK0" /></figure><p>So, a new post is created with an id of 101.</p><ul><li><strong>PUT</strong>: It is used to update the current data in the database, or add new new data into the database. Let us modify the body of the blog with id of 1.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Y6f5JVSYmvCgkFNH" /></figure><p>So, the body now has the modified data that we have inserted.</p><ul><li><strong>PATCH</strong>: This method is similar to put except that it gives the server the instructions on how to update or modify the data. Let us patch the title of the blog with id of 2.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*avHWXcWDU5UqHeh_" /></figure><p>The data ,here too, gets updated.</p><ul><li><strong>DELETE</strong>: As the name suggests, it is used to perform a delete operation, and remove data from the database.</li></ul><p>Let us delete the post with id of 2</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*qtbbD0X_9WXfpmUv" /></figure><p>Now that you know about request and its types, response, queries, parameters, headers, you can easily customize request URLs and fetch data as per your need.</p><p>In my next blog, I will explain about handling of client requests by a server.</p><p>Thank You. Keep Coding !</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3230cb0e8bea" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Getting started with NodeJS]]></title>
            <link>https://medium.com/@kailash360/getting-started-with-nodejs-eb9ca64aa3b0?source=rss-c660f17ebebd------2</link>
            <guid isPermaLink="false">https://medium.com/p/eb9ca64aa3b0</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[expressjs]]></category>
            <dc:creator><![CDATA[Kailash Kejriwal]]></dc:creator>
            <pubDate>Fri, 24 Sep 2021 13:06:51 GMT</pubDate>
            <atom:updated>2021-09-24T18:16:59.089Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2xBArfc6dxlaGNZa_16hXg.jpeg" /></figure><p>When I got into web development, the terms MERN,MEAN were very commonly used. As I dived deeper into this field, I learnt that each of these letters represent tools that are used to develop websites. And the letter N stands for NodeJS.</p><p>Now let’s start developing our first server. First of all you will need NodeJS installed in your system. Download it from here</p><p><a href="https://nodejs.org/en/">Node.js - Run JavaScript Everywhere</a></p><h3>Basic Terminologies</h3><p>Before moving on, let me brief you about few terminologies and commands related to NodeJS.</p><p><strong>npm</strong> — This is the ‘Node Package Manager’. It will help us to install any Node package we want for our projects. The basic syntax is</p><pre>npm install &lt;package_name&gt;</pre><p><strong>node</strong> — This command will help us to execute any server based JavaScript file. The basic syntax is</p><pre>node &lt;filename_with_extension&gt;</pre><h3>Initializing a package</h3><p>The first step towards making a NodeJS project is initializing it. To initialize, create the folder where you want to keep all your files of the Node app, and run the command</p><pre>npm init</pre><p>You will be asked to enter some details about the project. If you don’t want to provide any field, leave it empty.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3UInjmcN_Ri7mWHsDZTLgw.png" /><figcaption>Initializing package</figcaption></figure><p>After confirming, you will see that a file named <em>package.json</em> has been created. This file contains all the information about the Node App.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*31SNHfR002uTJMzDhbrZeA.png" /><figcaption>package.json</figcaption></figure><h3>Installing dependencies</h3><p>Now we will install some important packages required to set up a backend server. We will install the following packages.</p><ul><li><strong>Express</strong>-This is the standard Node framework for developing a server. It helps to handle the requests and responses from clients. Install it by running the command</li></ul><pre>npm i express</pre><p>After installation, a folder named node modules will appear which contains the dependencies that you have installed. Also, the list of the dependencies inside the <em>package.json</em>, at line 11<em>,</em>has been updated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fG29bZ3GzwyRItuRDgtXOg.png" /><figcaption>Modified dependencies</figcaption></figure><h3>Implementing the server</h3><p>Create a file with name as index.js. Copy and paste the following code.</p><pre>const express = require(&#39;express&#39;)<br>const app = express()<br>const port = 80<br><br>app.listen(port, () =&gt; {<br>  console.log(`Server running at port:${port}`)<br>})</pre><p>First we created an instance of the express. Then we started the server using the <em>.listen()</em> method. If everything goes well, the callback message will be displayed in the console.</p><p>To execute the command, run the command below</p><pre>node index.js</pre><p>Finally, you have created your first Node app. You will see this in the console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3zO9usKE_3Nli4BYgP2thA.png" /><figcaption>Running a Node App</figcaption></figure><h3>Modifications</h3><p>Let us make some modifications in our code.</p><ul><li>We will use <em>process.env.PORT</em> as the first preference of the port number where our Node app will run. This will help in easy facilitation of deployment.</li><li>We can also install a package called ‘<em>Nodemon</em>’ to help us in easy development. This package helps to restart the server automatically, every time you make a change in the files. Had we used only the Node package, we would restart the server time and again for reflecting any change.</li></ul><p>Now that we have made some changes lets run our app with the command</p><pre>nodemon index.js</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UNWMSj7eIU9_vBbRTuK9qA.png" /></figure><p>Now that we have created our server, finally we are ready to start making different routes which will handle the requests from client.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eb9ca64aa3b0" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>