<?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 Pavankumarsayannagari on Medium]]></title>
        <description><![CDATA[Stories by Pavankumarsayannagari on Medium]]></description>
        <link>https://medium.com/@pavankumarsayannagari13?source=rss-3e3c7fa9c4bd------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Stories by Pavankumarsayannagari on Medium</title>
            <link>https://medium.com/@pavankumarsayannagari13?source=rss-3e3c7fa9c4bd------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 11:41:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pavankumarsayannagari13/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[Building a Private RAG Search for Your Own Files with Python, ChromaDB and Groq]]></title>
            <link>https://medium.com/@pavankumarsayannagari13/building-a-private-rag-search-for-your-own-files-with-python-chromadb-and-groq-a0d23a46f7b7?source=rss-3e3c7fa9c4bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/a0d23a46f7b7</guid>
            <category><![CDATA[generative-ai-tools]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[vector-database]]></category>
            <category><![CDATA[rags]]></category>
            <category><![CDATA[llm]]></category>
            <dc:creator><![CDATA[Pavankumarsayannagari]]></dc:creator>
            <pubDate>Wed, 28 Oct 2026 11:00:06 GMT</pubDate>
            <atom:updated>2026-10-28T11:00:06.191Z</atom:updated>
            <content:encoded><![CDATA[<p><em>By pavan sayannagari</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m-eD7oLCs11T6EfVs_l9hw.png" /></figure><p>Most of us have folders full of PDFs, Word documents and Excel sheets that we can never find anything in. File search matches names and exact words, but what we usually remember is the meaning: “the document where we agreed the notice period” or “the sheet with last quarter’s South region numbers”. Retrieval-Augmented Generation (RAG) fixes this. In this article I walk through a small, working RAG system that indexes local files, finds the relevant passages, and lets an LLM answer questions with citations pointing back to the original file.</p><p>The whole project is about 250 lines of Python and runs on a normal laptop.</p><h3>What is RAG, in one paragraph</h3><p>An LLM on its own knows nothing about your files. RAG solves this in two steps. First, <strong>retrieve</strong>: find the few passages in your documents that are most relevant to the question. Second, <strong>generate</strong>: hand those passages to the LLM along with the question and tell it to answer only from them. Because the model sees the actual text, answers are grounded in your data, and because we know which passages were used, we can show the sources.</p><h3>The architecture</h3><p>The system has two phases.</p><p><strong>Phase 1, indexing (run whenever files change):</strong> files are read, split into chunks, converted to vectors, and stored in a vector database.</p><p><strong>Phase 2, asking (every question):</strong> the question is searched against the index using both semantic and keyword matching, the best chunks are sent to the LLM, and the app displays the answer next to its sources.</p><p>The design goal was to keep everything local except the final LLM call. Documents are never uploaded; only the handful of retrieved chunks are sent to the model.</p><h3>The stack</h3><ul><li><strong>pypdf, python-docx, openpyxl</strong> to extract text from PDF, Word and Excel files.</li><li><strong>sentence-transformers</strong> to create embeddings locally with the all-MiniLM-L6-v2 model.</li><li><strong>ChromaDB</strong> as a simple on-disk vector database, with no server to run.</li><li><strong>rank-bm25</strong> for classic keyword scoring.</li><li><strong>Groq Cloud</strong> to run an open-weight OpenAI model (gpt-oss-120b) through an OpenAI-compatible API, so the standard openai Python client works unchanged.</li><li><strong>Streamlit</strong> for a web interface in a few dozen lines.</li><li><strong>python-dotenv</strong> to keep the API key and folder paths in a .env file.</li></ul><h3>Stage 1: Extracting text</h3><p>Each file type needs its own reader. PDFs are read page by page so we can cite page numbers. Word files are read paragraph by paragraph, including tables. Plain text and code files are read directly.</p><p>Excel needs special care. If you dump cells in order, you get a stream of numbers with no meaning. Instead, the first row of each sheet is treated as the header, and every following row is rewritten as a self-describing line:</p><pre>[Sales] Name: Asha | Region: South | Amount: 1200</pre><p>Now each row carries its column names and sheet name, so a chunk makes sense on its own and a question like “Asha’s amount in the South region” can match it.</p><h3>Stage 2: Chunking</h3><p>Whole documents are too large to retrieve usefully, so each one is split into chunks of roughly 900 characters with about 150 characters of overlap. The splitter prefers to break at a newline or space rather than mid-word, and the overlap makes sure a sentence sitting on a boundary is not lost. Chunk size is the most important tuning knob: smaller chunks give more precise matches, larger ones give the model more context.</p><h3>Stage 3: Embeddings and storage</h3><p>An embedding model turns each chunk into a vector, a list of numbers that captures meaning, so that texts with similar meaning end up close together. Each vector is stored in ChromaDB together with metadata: file path, file name, extension, page number and modified time.</p><p>To keep re-indexing fast, a small manifest.json records each file&#39;s modified time and size. On the next run, unchanged files are skipped, changed files are re-indexed, and deleted files are removed from the database. One important rule: the same embedding model must be used for indexing and for querying, otherwise the vectors cannot be compared.</p><h3>Stage 4: Hybrid search</h3><p>Embeddings are excellent at meaning (“salary” matches “compensation”) but weak at exact strings such as invoice numbers, names and codes. Keyword search has the opposite strengths. So the system runs both:</p><ol><li>The question is embedded and ChromaDB returns the 20 nearest chunks.</li><li>BM25 scores every chunk by keyword overlap and returns its own top 20.</li><li>The two rankings are merged with <strong>reciprocal rank fusion</strong>: each chunk earns 1 / (60 + rank) from each list, and the scores are added. A chunk that ranks well in either list rises to the top.</li></ol><p>The top six chunks go forward. This simple fusion step noticeably improves results compared with vector search alone, and it needs no extra model.</p><h3>Stage 5: Generating the answer</h3><p>The retrieved chunks are numbered and placed in the prompt along with the question. The system prompt is strict: answer only from the numbered excerpts, cite them as [1], [2], and say so if the answer is not there. This instruction is what keeps the model honest, and the low temperature (0.2) keeps answers consistent.</p><p>Because Groq exposes an OpenAI-compatible endpoint, the call is just the normal OpenAI client pointed at https://api.groq.com/openai/v1. Swapping providers later means changing the base URL, the key and the model name.</p><h3>Stage 6: The interface</h3><p>A Streamlit page provides a search box, a sidebar for choosing folders and file types, an “Index / refresh now” button, and expandable source passages showing the file path and page for every answer. Showing sources matters as much as the answer itself: it lets you verify the result and open the original file.</p><h3>Lessons learned</h3><ul><li><strong>Use a virtual environment, and activate it every time.</strong> On a machine with an old Python 2.7 first on the PATH, installs failed with confusing errors until we used py -3.12 -m venv venv and worked inside it.</li><li><strong>Excel formulas may appear empty.</strong> Files not saved by Excel itself may not store calculated values, so formula cells can read as blank.</li><li><strong>Scanned PDFs have no text layer.</strong> They need OCR before they can be indexed.</li><li><strong>Changing the embedding model means rebuilding the index.</strong> Old vectors are not compatible with a new model.</li></ul><h3>Limitations</h3><p>RAG retrieves a few relevant passages; it does not read everything. Questions that need a calculation across a whole spreadsheet, such as “what were total sales this year”, are unreliable, because the relevant rows may not all be retrieved. For those, a better approach is to let the LLM write and run a pandas query over the data.</p><h3>Where to go next</h3><ul><li>Add a <strong>re-ranker</strong> (a cross-encoder) to reorder the top results for higher accuracy.</li><li>Add <strong>OCR</strong> for scanned documents.</li><li>Add a <strong>watch-folder mode</strong> that indexes new files automatically.</li><li>Support more formats such as PowerPoint and email.</li><li>Stream the answer token by token for a more responsive feel.</li></ul><h3>Conclusion</h3><p>A useful private search over your own files does not need a large framework or a server. A handful of focused libraries, a local vector store, a hybrid retrieval step and one API call to an LLM are enough. Once the pipeline is in place, each improvement, such as better chunking, a re-ranker or a different model, is a small change to one file.</p><h3>Step-by-step setup guide (Windows)</h3><p>This section takes you from an empty folder to a working app. Mac and Linux users can follow the same steps; the differences are noted.</p><p><strong>The nine steps at a glance:</strong></p><ol><li>Install Python 3.12</li><li>Get a Groq API key</li><li>Create the project folder and virtual environment</li><li>Create requirements.txt and install the packages</li><li>Create the .env settings file</li><li>Create the three Python files</li><li>Index your files</li><li>Start the app and ask questions</li><li>Keep the index up to date</li></ol><h3>Step 1: Install Python 3.12</h3><ol><li>Go to python.org/downloads and download the <strong>Python 3.12</strong> Windows installer (64-bit).</li><li>Run it, tick <strong>Add python.exe to PATH</strong> on the first screen, then click <strong>Install Now</strong>.</li><li>Open a new terminal window and check the install with py -3.12 --version. It should print Python 3.12.x.</li></ol><p>If an old Python 2.7 is also installed, plain python may still open it. Use py -3.12 to create the virtual environment, as shown below. After activation, python inside that window means the new version.</p><h3>Step 2: Get a Groq API key</h3><ol><li>Sign in at console.groq.com and open the API Keys page (console.groq.com/keys).</li><li>Click <strong>Create API Key</strong>, give it a name, and copy the key. It is shown only once.</li><li>Keep it private. You will paste it into the .env file in Step 5.</li><li>Also note the full path of the folder that holds the files you want to search, because Step 5 needs it.</li></ol><h3>Step 3: Create the project folder and virtual environment</h3><pre>mkdir file_rag<br>cd file_rag<br>py -3.12 -m venv venv<br>venv\Scripts\activate<br>python --version</pre><p>The prompt should now start with (venv) and the last command should print Python 3.12. On Mac or Linux use python3 -m venv venv and source venv/bin/activate. You must activate the environment in every new terminal window.</p><h3>Step 4: Create requirements.txt and install the packages</h3><p>Save the file below in the file_rag folder (see the source code section for its contents), then install:</p><pre>python -m pip install --upgrade pip<br>pip install -r requirements.txt</pre><p>This takes several minutes because PyTorch, which sentence-transformers depends on, is a large download. Yellow warnings are normal; only a red ERROR matters.</p><h3>Step 5: Create the .env settings file</h3><p>Create a file named exactly .env in the same folder (in Notepad, set Save as type to All Files so it is not saved as .env.txt). Put your own key and folder path in it.</p><h3>Step 6: Create the three Python files</h3><p>Save ingest.py, rag.py and app.py in the same folder, next to .env. The code for each is in the next section. They must sit side by side because app.py imports the other two.</p><p>Your folder should look like this:</p><pre>file_rag/<br>├── venv/<br>├── .env<br>├── requirements.txt<br>├── ingest.py<br>├── rag.py<br>└── app.py</pre><h3>Step 7: Index your files</h3><p>Make sure you are inside file_rag (not inside venv\Scripts) with (venv) active, then run:</p><pre>python ingest.py</pre><p>The first run downloads the embedding model and pauses for a minute. You will then see one indexed ... line per file and a final summary. Re-run this command whenever your files change; only new, changed or deleted files are processed.</p><h3>Step 8: Start the app and ask questions</h3><pre>streamlit run app.py</pre><p>The browser opens at <a href="http://localhost:8501.">http://localhost:8501.</a> Type a question and you get an answer with sources. You can also ask from the terminal:</p><pre>python rag.py &quot;what is the notice period in the contract?&quot;</pre><h3>Step 9: Keep the index up to date</h3><ol><li>Add, edit or delete files in your folder as you normally would.</li><li>Run python ingest.py again, or click <strong>Index / refresh now</strong> in the app sidebar. Only new, changed and deleted files are processed.</li><li>To rebuild everything from scratch, close the app, delete the rag_db folder, and run python ingest.py again.</li></ol><h3>Full source code</h3><h3><strong>requirements.txt</strong></h3><pre>chromadb&gt;=0.5<br>sentence-transformers&gt;=3.0<br>rank-bm25&gt;=0.2.2<br>pypdf&gt;=4.0<br>python-docx&gt;=1.1<br>openpyxl&gt;=3.1<br>openai&gt;=1.40<br>python-dotenv&gt;=1.0<br>streamlit&gt;=1.38</pre><h3><strong>.env</strong></h3><pre>GROQ_API_KEY=pastep_your_groq_key_here<br>GROQ_MODEL=openai/gpt-oss-120b<br>DOCS_DIRS=C:\Users\YourName\Documents<br>EMBED_MODEL=sentence-transformers/all-MiniLM-L6-v2<br>DB_DIR=./rag_db</pre><p>Separate several folders in DOCS_DIRS with ; on Windows or : on Mac and Linux. For faster, cheaper answers use GROQ_MODEL=openai/gpt-oss-20b.</p><h3><strong>ingest.py</strong></h3><p>This script reads the files, chunks them, embeds the chunks and stores them in ChromaDB.</p><pre>&quot;&quot;&quot;Index your files into a local ChromaDB. Re-run any time: only new/changed files are processed.<br><br>Usage:<br>    python ingest.py &quot;D:/my files&quot; &quot;D:/work docs&quot;<br>    python ingest.py            # uses DOCS_DIRS from .env<br>&quot;&quot;&quot;<br>import os, sys, json, hashlib<br>from pathlib import Path<br>from dotenv import load_dotenv<br><br>load_dotenv()<br><br>DB_DIR = os.getenv(&quot;DB_DIR&quot;, &quot;./rag_db&quot;)<br>EMBED_MODEL = os.getenv(&quot;EMBED_MODEL&quot;, &quot;sentence-transformers/all-MiniLM-L6-v2&quot;)<br>CHUNK_SIZE, CHUNK_OVERLAP = 900, 150<br><br>TEXT_EXT = {&quot;.txt&quot;, &quot;.md&quot;, &quot;.rst&quot;, &quot;.csv&quot;, &quot;.json&quot;, &quot;.yaml&quot;, &quot;.yml&quot;, &quot;.log&quot;, &quot;.html&quot;, &quot;.xml&quot;,<br>            &quot;.py&quot;, &quot;.js&quot;, &quot;.ts&quot;, &quot;.java&quot;, &quot;.c&quot;, &quot;.cpp&quot;, &quot;.go&quot;, &quot;.rs&quot;, &quot;.sql&quot;, &quot;.sh&quot;, &quot;.ini&quot;, &quot;.toml&quot;}<br>SUPPORTED = TEXT_EXT | {&quot;.pdf&quot;, &quot;.docx&quot;, &quot;.xlsx&quot;}<br>SKIP_DIRS = {&quot;.git&quot;, &quot;node_modules&quot;, &quot;__pycache__&quot;, &quot;.venv&quot;, &quot;venv&quot;, &quot;rag_db&quot;}<br>MAX_FILE_MB = 50<br><br><br>def extract(path: Path):<br>    &quot;&quot;&quot;Return a list of (page_number, text).&quot;&quot;&quot;<br>    ext = path.suffix.lower()<br>    if ext == &quot;.pdf&quot;:<br>        from pypdf import PdfReader<br>        reader = PdfReader(str(path))<br>        return [(i + 1, (p.extract_text() or &quot;&quot;)) for i, p in enumerate(reader.pages)]<br>    if ext == &quot;.docx&quot;:<br>        import docx<br>        d = docx.Document(str(path))<br>        text = &quot;\n&quot;.join(p.text for p in d.paragraphs)<br>        for t in d.tables:<br>            for row in t.rows:<br>                text += &quot;\n&quot; + &quot; | &quot;.join(c.text for c in row.cells)<br>        return [(1, text)]<br>    if ext == &quot;.xlsx&quot;:<br>        from openpyxl import load_workbook<br>        wb = load_workbook(str(path), read_only=True, data_only=True)<br>        out = []<br>        for n, ws in enumerate(wb.worksheets, 1):<br>            header, lines = None, []<br>            for row in ws.iter_rows(values_only=True):<br>                cells = [&quot;&quot; if c is None else str(c).strip() for c in row]<br>                if not any(cells):<br>                    continue<br>                if header is None:  # first non-empty row = column names<br>                    header = [c or &quot;col%d&quot; % (i + 1) for i, c in enumerate(cells)]<br>                    continue<br>                parts = []<br>                for i, c in enumerate(cells):<br>                    if c:<br>                        name = header[i] if i &lt; len(header) else &quot;col%d&quot; % (i + 1)<br>                        parts.append(&quot;%s: %s&quot; % (name, c))<br>                lines.append(&quot;[%s] &quot; % ws.title + &quot; | &quot;.join(parts))<br>            out.append((n, &quot;\n&quot;.join(lines)))<br>        wb.close()<br>        return out<br>    return [(1, path.read_text(encoding=&quot;utf-8&quot;, errors=&quot;ignore&quot;))]<br><br><br>def chunk_text(text, size=CHUNK_SIZE, overlap=CHUNK_OVERLAP):<br>    text = text.strip()<br>    chunks, start, n = [], 0, len(text)<br>    while start &lt; n:<br>        end = min(start + size, n)<br>        if end &lt; n:  # prefer to break at a newline or space<br>            brk = text.rfind(&quot;\n&quot;, start + size // 2, end)<br>            if brk == -1:<br>                brk = text.rfind(&quot; &quot;, start + size // 2, end)<br>            if brk != -1:<br>                end = brk<br>        piece = text[start:end].strip()<br>        if piece:<br>            chunks.append(piece)<br>        if end &gt;= n:<br>            break<br>        start = max(end - overlap, start + 1)<br>    return chunks<br><br><br>def find_files(dirs):<br>    for d in dirs:<br>        for root, subdirs, files in os.walk(d):<br>            subdirs[:] = [s for s in subdirs if s not in SKIP_DIRS]<br>            for f in files:<br>                p = Path(root) / f<br>                if p.suffix.lower() in SUPPORTED:<br>                    try:<br>                        if p.stat().st_size &lt;= MAX_FILE_MB * 1024 * 1024:<br>                            yield p<br>                    except OSError:<br>                        pass<br><br><br>def signature(p: Path):<br>    s = p.stat()<br>    return f&quot;{int(s.st_mtime)}-{s.st_size}&quot;<br><br><br>def get_collection():<br>    import chromadb<br>    client = chromadb.PersistentClient(path=DB_DIR)<br>    return client.get_or_create_collection(&quot;files&quot;, metadata={&quot;hnsw:space&quot;: &quot;cosine&quot;})<br><br><br>def run(dirs, log=print):<br>    from sentence_transformers import SentenceTransformer<br><br>    dirs = [d for d in dirs if d and Path(d).exists()]<br>    if not dirs:<br>        log(&quot;No valid folders given.&quot;)<br>        return<br>    Path(DB_DIR).mkdir(parents=True, exist_ok=True)<br>    manifest_path = Path(DB_DIR) / &quot;manifest.json&quot;<br>    manifest = json.loads(manifest_path.read_text()) if manifest_path.exists() else {}<br><br>    col = get_collection()<br>    model = SentenceTransformer(EMBED_MODEL)<br><br>    current = {str(p): p for p in find_files(dirs)}<br><br>    # remove files that no longer exist<br>    for gone in set(manifest) - set(current):<br>        col.delete(where={&quot;path&quot;: gone})<br>        manifest.pop(gone)<br>        log(f&quot;removed  {gone}&quot;)<br><br>    added = 0<br>    for path_str, p in current.items():<br>        sig = signature(p)<br>        if manifest.get(path_str) == sig:<br>            continue<br>        try:<br>            pages = extract(p)<br>        except Exception as e:<br>            log(f&quot;skipped  {path_str} ({e})&quot;)<br>            continue<br>        col.delete(where={&quot;path&quot;: path_str})  # drop old version<br>        ids, docs, metas = [], [], []<br>        h = hashlib.sha1(path_str.encode()).hexdigest()[:12]<br>        for page_no, text in pages:<br>            for i, ch in enumerate(chunk_text(text)):<br>                ids.append(f&quot;{h}:{page_no}:{i}&quot;)<br>                docs.append(ch)<br>                metas.append({&quot;path&quot;: path_str, &quot;filename&quot;: p.name, &quot;ext&quot;: p.suffix.lower(),<br>                              &quot;page&quot;: page_no, &quot;modified&quot;: int(p.stat().st_mtime)})<br>        for b in range(0, len(docs), 256):<br>            embs = model.encode(docs[b:b + 256], normalize_embeddings=True).tolist()<br>            col.add(ids=ids[b:b + 256], documents=docs[b:b + 256],<br>                    embeddings=embs, metadatas=metas[b:b + 256])<br>        manifest[path_str] = sig<br>        manifest_path.write_text(json.dumps(manifest))<br>        added += 1<br>        log(f&quot;indexed  {path_str} ({len(docs)} chunks)&quot;)<br><br>    manifest_path.write_text(json.dumps(manifest))<br>    log(f&quot;Done. {added} file(s) updated, {len(current)} total tracked, {col.count()} chunks in index.&quot;)<br><br><br>if __name__ == &quot;__main__&quot;:<br>    args = sys.argv[1:] or [d for d in os.getenv(&quot;DOCS_DIRS&quot;, &quot;&quot;).split(os.pathsep) if d]<br>    run(args)</pre><h3>rag.py</h3><p>This module does the hybrid search (vector plus BM25, merged with reciprocal rank fusion) and calls Groq to write the answer.</p><pre>&quot;&quot;&quot;Hybrid retrieval (vector + BM25) and answer generation through Groq.&quot;&quot;&quot;<br>import os, re<br>from dotenv import load_dotenv<br>from openai import OpenAI<br><br>load_dotenv()<br><br>DB_DIR = os.getenv(&quot;DB_DIR&quot;, &quot;./rag_db&quot;)<br>EMBED_MODEL = os.getenv(&quot;EMBED_MODEL&quot;, &quot;sentence-transformers/all-MiniLM-L6-v2&quot;)<br>GROQ_MODEL = os.getenv(&quot;GROQ_MODEL&quot;, &quot;openai/gpt-oss-120b&quot;)<br><br>SYSTEM_PROMPT = (<br>    &quot;You answer questions using ONLY the numbered context excerpts from the user&#39;s own files. &quot;<br>    &quot;Cite sources inline like [1], [2]. If the answer is not in the excerpts, say you could not &quot;<br>    &quot;find it in the files. Be concise.&quot;<br>)<br><br><br>def tokenize(s):<br>    return re.findall(r&quot;\w+&quot;, s.lower())<br><br><br>class Searcher:<br>    def __init__(self):<br>        import chromadb<br>        from sentence_transformers import SentenceTransformer<br>        from rank_bm25 import BM25Okapi<br><br>        self.model = SentenceTransformer(EMBED_MODEL)<br>        self.col = chromadb.PersistentClient(path=DB_DIR).get_or_create_collection(<br>            &quot;files&quot;, metadata={&quot;hnsw:space&quot;: &quot;cosine&quot;})<br>        data = self.col.get(include=[&quot;documents&quot;, &quot;metadatas&quot;])<br>        self.ids, self.docs, self.metas = data[&quot;ids&quot;], data[&quot;documents&quot;], data[&quot;metadatas&quot;]<br>        self.bm25 = BM25Okapi([tokenize(d) for d in self.docs]) if self.docs else None<br><br>    def search(self, query, k=6, exts=None, pool=20):<br>        if not self.docs:<br>            return []<br>        where = {&quot;ext&quot;: {&quot;$in&quot;: exts}} if exts else None<br><br>        # semantic ranking<br>        q = self.model.encode([query], normalize_embeddings=True).tolist()<br>        res = self.col.query(query_embeddings=q, n_results=min(pool, len(self.docs)), where=where)<br>        vec_ids = res[&quot;ids&quot;][0]<br><br>        # keyword ranking<br>        scores = self.bm25.get_scores(tokenize(query))<br>        order = sorted(range(len(scores)), key=lambda i: scores[i], reverse=True)<br>        kw_ids = []<br>        for i in order:<br>            if scores[i] &lt;= 0 or len(kw_ids) &gt;= pool:<br>                break<br>            if exts and self.metas[i][&quot;ext&quot;] not in exts:<br>                continue<br>            kw_ids.append(self.ids[i])<br><br>        # reciprocal rank fusion<br>        fused = {}<br>        for ranking in (vec_ids, kw_ids):<br>            for rank, cid in enumerate(ranking):<br>                fused[cid] = fused.get(cid, 0) + 1 / (60 + rank)<br>        top = sorted(fused, key=fused.get, reverse=True)[:k]<br>        idx = {cid: i for i, cid in enumerate(self.ids)}<br>        return [{&quot;id&quot;: c, &quot;text&quot;: self.docs[idx[c]], **self.metas[idx[c]]} for c in top]<br><br><br>def answer(query, hits):<br>    key = os.getenv(&quot;GROQ_API_KEY&quot;)<br>    if not key:<br>        raise RuntimeError(&quot;GROQ_API_KEY is missing. Put it in your .env file.&quot;)<br>    client = OpenAI(api_key=key, base_url=&quot;https://api.groq.com/openai/v1&quot;)<br>    context = &quot;\n\n&quot;.join(f&quot;[{i}] ({h[&#39;filename&#39;]}, page {h[&#39;page&#39;]})\n{h[&#39;text&#39;]}&quot;<br>                          for i, h in enumerate(hits, 1))<br>    resp = client.chat.completions.create(<br>        model=GROQ_MODEL,<br>        temperature=0.2,<br>        messages=[{&quot;role&quot;: &quot;system&quot;, &quot;content&quot;: SYSTEM_PROMPT},<br>                  {&quot;role&quot;: &quot;user&quot;, &quot;content&quot;: f&quot;Context:\n{context}\n\nQuestion: {query}&quot;}],<br>    )<br>    return resp.choices[0].message.content<br><br><br>if __name__ == &quot;__main__&quot;:<br>    import sys<br>    q = &quot; &quot;.join(sys.argv[1:]) or input(&quot;Question: &quot;)<br>    s = Searcher()<br>    hits = s.search(q)<br>    print(answer(q, hits) if hits else &quot;Nothing indexed yet. Run ingest.py first.&quot;)<br>    print(&quot;\nSources:&quot;)<br>    for i, h in enumerate(hits, 1):<br>        print(f&quot;[{i}] {h[&#39;path&#39;]} (page {h[&#39;page&#39;]})&quot;)</pre><h3>app.py</h3><p>This is the Streamlit web page. It only handles the screen and calls ingest.py and rag.py for the real work.</p><pre>import os<br>import streamlit as st<br>from dotenv import load_dotenv<br>import ingest<br>from rag import Searcher, answer<br><br>load_dotenv()<br>st.set_page_config(page_title=&quot;Ask my files&quot;, page_icon=&quot;🔎&quot;, layout=&quot;wide&quot;)<br><br><br>@st.cache_resource<br>def get_searcher():<br>    return Searcher()<br><br><br>st.title(&quot;🔎 Ask my files&quot;)<br><br>with st.sidebar:<br>    st.header(&quot;Index&quot;)<br>    default_dirs = os.getenv(&quot;DOCS_DIRS&quot;, &quot;&quot;)<br>    dirs_text = st.text_area(&quot;Folders to index (one per line)&quot;, default_dirs.replace(os.pathsep, &quot;\n&quot;))<br>    if st.button(&quot;Index / refresh now&quot;):<br>        box = st.empty()<br>        lines = []<br><br>        def log(m):<br>            lines.append(m)<br>            box.code(&quot;\n&quot;.join(lines[-12:]))<br><br>        ingest.run([d.strip() for d in dirs_text.splitlines() if d.strip()], log=log)<br>        st.cache_resource.clear()<br>        st.success(&quot;Index updated&quot;)<br>    st.header(&quot;Search options&quot;)<br>    k = st.slider(&quot;Chunks to retrieve&quot;, 3, 12, 6)<br>    exts = st.multiselect(&quot;File types&quot;, [&quot;.xlsx&quot;, &quot;.pdf&quot;, &quot;.docx&quot;, &quot;.txt&quot;, &quot;.md&quot;, &quot;.py&quot;, &quot;.csv&quot;, &quot;.json&quot;])<br>    show_answer = st.checkbox(&quot;Generate answer with LLM&quot;, value=True)<br><br>query = st.text_input(&quot;What are you looking for?&quot;, placeholder=&quot;e.g. what was the rent amount in the lease agreement?&quot;)<br><br>if query:<br>    searcher = get_searcher()<br>    hits = searcher.search(query, k=k, exts=exts or None)<br>    if not hits:<br>        st.warning(&quot;No results. Have you indexed your folders yet?&quot;)<br>    else:<br>        if show_answer:<br>            with st.spinner(&quot;Thinking...&quot;):<br>                try:<br>                    st.markdown(answer(query, hits))<br>                except Exception as e:<br>                    st.error(f&quot;LLM call failed: {e}&quot;)<br>        st.subheader(&quot;Sources&quot;)<br>        for i, h in enumerate(hits, 1):<br>            with st.expander(f&quot;[{i}] {h[&#39;filename&#39;]} - page {h[&#39;page&#39;]}&quot;):<br>                st.caption(h[&quot;path&quot;])<br>                st.write(h[&quot;text&quot;])</pre><h3>How the files connect</h3><ul><li>.env supplies the settings. ingest.py and rag.py both read the same DB_DIR and EMBED_MODEL, which is what makes them use the same database and the same embedding model.</li><li>ingest.py writes chunks and vectors into ChromaDB. The sidebar button in app.py also calls its run() function.</li><li>rag.py reads from ChromaDB, runs the hybrid search, and calls Groq using GROQ_API_KEY.</li><li>app.py is only the interface. It imports the other two and wires the search box and sidebar controls to them.</li></ul><h3>Troubleshooting</h3><ul><li><strong>pip says no matching distribution, or the pip version is 9.x:</strong> you are using an old Python. Create the virtual environment with py -3.12 -m venv venv and activate it.</li><li><strong>SyntaxError on </strong><strong>def extract(path: Path)::</strong> python is running 2.7. Activate the environment with venv\Scripts\activate so the prompt starts with (venv).</li><li><strong>can&#39;t open file ingest.py:</strong> you are in the wrong folder. Change into file_rag itself, not venv\Scripts.</li><li><strong>No valid folders given:</strong> DOCS_DIRS in .env is wrong, or the file is named .env.txt.</li><li><strong>0 total tracked:</strong> the folder contains no supported file types. Check the path and the file extensions.</li><li><strong>GROQ_API_KEY is missing or a 401 error:</strong> the key is not in .env, or it is invalid. Create a new one at console.groq.com/keys.</li><li><strong>Model not found:</strong> try GROQ_MODEL=openai/gpt-oss-20b.</li><li><strong>Changed </strong><strong>EMBED_MODEL:</strong> delete the rag_db folder and run python ingest.py again, because old vectors do not match a new model.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a0d23a46f7b7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Load Testing for Beginners: How I Used Claude to Test an API with JMeter]]></title>
            <link>https://medium.com/@pavankumarsayannagari13/load-testing-for-beginners-how-i-used-claude-to-test-an-api-with-jmeter-e5fd92094de2?source=rss-3e3c7fa9c4bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/e5fd92094de2</guid>
            <category><![CDATA[claude]]></category>
            <category><![CDATA[load-testing]]></category>
            <category><![CDATA[jmeter]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[performance-testing]]></category>
            <dc:creator><![CDATA[Pavankumarsayannagari]]></dc:creator>
            <pubDate>Sat, 24 Oct 2026 05:05:59 GMT</pubDate>
            <atom:updated>2026-10-24T05:05:59.455Z</atom:updated>
            <content:encoded><![CDATA[<p>A friendly, step-by-step guide for people who have never done load testing, using a free tool called Apache JMeter and an AI assistant to speed things up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dfwu8Xwhoa5-f04mp6umtQ.png" /></figure><p>If you have ever wondered how companies make sure their websites don’t crash when thousands of people show up at once, this article is for you. You don’t need any testing experience. I will explain every term as we go, and show a real test with real numbers.</p><h3>Why Websites Slow Down: Load Testing Explained</h3><p>Imagine a small café with one barista. With one customer, your coffee arrives in two minutes. With fifty customers at the same time, the line grows, people wait twenty minutes, and some give up and leave.</p><p>Websites and apps work the same way. An API (the part of an app that answers requests from other programs) may respond quickly to one person, but slow down or fail when hundreds use it together. <strong>Load testing means simulating many users at the same time</strong>, so you can find the slowdown before your real users do.</p><h3>Meet JMeter: The Free Tool That Simulates Your Users</h3><p>Apache JMeter is a free, open-source tool for load testing. You describe what a user does (for example, “request this web address”) and how many users should do it. JMeter then sends the requests, measures how long each one takes, and saves the results to a file.</p><h3>The Load Testing Vocabulary, Explained Simply</h3><p>These words come up everywhere in performance testing, so it is worth learning them first.</p><ul><li><strong>Virtual user:</strong> a simulated person. JMeter calls them “threads”. Ten users means ten simulated people working at the same time.</li><li><strong>Ramp-up:</strong> the time JMeter takes to start all the users. With 10 users and a 10 second ramp-up, a new user starts about every second, instead of everyone arriving at once.</li><li><strong>Duration:</strong> how long the test runs.</li><li><strong>Think time:</strong> a pause between actions, like a real person reading a page before clicking again.</li><li><strong>Response time:</strong> how long one request takes, from sending it to getting the answer. It is measured in milliseconds (ms), where 1000 ms is 1 second.</li><li><strong>Throughput:</strong> how many requests are handled per second.</li><li><strong>Error rate:</strong> the percentage of requests that failed.</li><li><strong>Percentile (p95):</strong> sort all response times from fastest to slowest. The p95 is the time that 95% of the requests were faster than. If the p95 is 310 ms, then 95 out of every 100 requests finished in 310 ms or less. It is more honest than the average, because an average can hide slow experiences.</li><li><strong>SLA:</strong> the performance promise you set for yourself. Mine was “p95 must be under 800 ms”.</li></ul><h3>What I tested</h3><p>I used DummyJSON, a free public API built for practice. One rule for beginners: <strong>only test systems you own or have permission to test.</strong> Heavy traffic on someone else’s website can get you blocked and may break their terms of service.</p><p>The settings were:</p><ul><li>10 virtual users</li><li>10 second ramp-up</li><li>2 minutes of duration</li><li>SLA: p95 under 800 ms</li></ul><p>Each user repeated three requests:</p><ul><li>GET /test, a simple health check</li><li>GET /products/search?q=phone, a product search</li><li>GET /products/search?q=laptop, another product search</li></ul><p>For every request, the test also checked that the response status was 200 (which means success) and that the response contained the text I expected.</p><h3>Where Claude comes in</h3><p>Writing a JMeter test plan by hand is fiddly. So I used Claude, an AI assistant, and I taught it my process by creating a <strong>skill</strong>.</p><p>A skill is just a folder with a text file named SKILL.md inside. The file has a short name, a description of when to use it, and your instructions. When you ask for something that matches the description, Claude follows those instructions. Mine tells Claude to ask for the target and settings, create a JMeter test plan, give me the run command, and analyze my results in a standard report.</p><p>Here is my complete skill. It is only two files:</p><pre>jmeter-performance-testing/<br>├── SKILL.md<br>└── scripts/<br>    └── analyze_jtl.py</pre><h4>The SKILL.md file</h4><p>The part between the two lines of dashes at the top is the header. The name is what the skill is called, and the description is what Claude reads to decide whether the skill matches your request, so write it with the words you would naturally use. Everything below the header is the instructions, written in plain English.</p><pre>---<br>name: jmeter-performance-testing<br>description: Use when the user wants to plan, create, or analyze Apache JMeter performance tests (load, stress, spike, soak), generate .jmx test plans, write JMeter CLI commands, or interpret .jtl/.csv result files (response time, throughput, error rate, percentiles).<br>---<br><br># JMeter Performance Testing<br><br>## When creating a test plan<br>1. Ask for anything missing: target URL/API endpoints, HTTP methods,<br>   request bodies, auth type, number of users, ramp-up time, duration,<br>   and SLAs (for example p95 &lt; 800 ms, error rate &lt; 1%).<br>2. Generate a valid .jmx file containing:<br>   - Test Plan with user-defined variables<br>   - Thread Group using ${__P(threads,10)}, ${__P(rampup,30)},<br>     ${__P(duration,300)} so values can be changed from the command line<br>   - HTTP Request Defaults, HTTP Header Manager, Cookie Manager<br>   - One HTTP Sampler per endpoint, with Response Assertions<br>   - Constant Timer or think time between requests<br>   - Listeners: Simple Data Writer only (no GUI listeners)<br>3. Save the file to /mnt/user-data/outputs/ and present it.<br><br>## Run command (always give this to the user)<br>jmeter -n -t test.jmx -Jthreads=50 -Jrampup=60 -Jduration=600 \<br>  -l results.jtl -e -o report/<br><br>Remind the user: never run real load tests in GUI mode, and only test<br>systems they are authorized to test (prefer a staging environment).<br><br>## When analyzing results<br>1. Run scripts/analyze_jtl.py on the uploaded .jtl/.csv file.<br>2. Report these metrics per sampler label: sample count, average,<br>   median, p90, p95, p99, max, error %, throughput (req/sec).<br>3. Compare against the SLAs the user gave and mark each PASS or FAIL.<br><br>## Report format<br>Summary -&gt; Test configuration -&gt; Metrics table -&gt; Bottlenecks<br>-&gt; Recommendations -&gt; Next test to run.<br></pre><h4>The scripts/analyze_jtl.py file</h4><p>This small Python script reads the results file that JMeter saves and calculates the numbers for each request: how many there were, the average, the p90, p95 and p99 percentiles, the slowest time, the error percentage and the requests per second. Claude runs it when you upload your results, so the numbers are calculated by code instead of guessed.</p><p>python</p><pre>import sys<br>import pandas as pd<br><br>df = pd.read_csv(sys.argv[1])<br>duration = (df[&quot;timeStamp&quot;].max() - df[&quot;timeStamp&quot;].min()) / 1000 or 1<br><br>rows = []<br>for label, g in df.groupby(&quot;label&quot;):<br>    e = g[&quot;elapsed&quot;]<br>    rows.append({<br>        &quot;label&quot;: label,<br>        &quot;samples&quot;: len(g),<br>        &quot;avg_ms&quot;: round(e.mean()),<br>        &quot;p90_ms&quot;: round(e.quantile(0.90)),<br>        &quot;p95_ms&quot;: round(e.quantile(0.95)),<br>        &quot;p99_ms&quot;: round(e.quantile(0.99)),<br>        &quot;max_ms&quot;: int(e.max()),<br>        &quot;error_%&quot;: round((g[&quot;success&quot;].astype(str).str.lower() != &quot;true&quot;).mean() * 100, 2),<br>        &quot;req_per_sec&quot;: round(len(g) / duration, 2),<br>    })<br>print(pd.DataFrame(rows).to_string(index=False))</pre><p>You can also run it yourself, without Claude, with python analyze_jtl.py results.jtl. You need Python and the pandas library installed.</p><p>To install it:</p><ol><li>Zip the jmeter-performance-testing folder, making sure the folder itself is at the top level of the zip.</li><li>In Claude, open Settings, then Capabilities, and turn on code execution and file creation.</li><li>Open Customize, then Skills, add your zip, and switch the skill on.</li></ol><p>Anthropic’s help page currently lists skills as available on the free plan too, but this changed recently, so check your own account.</p><p>After that I simply typed: <em>“</em>Create a JMeter test plan for my <a href="https://dummyjson.com/test">https://dummyjson.com/test</a> search. 10 users, 10 sec ramp-up, 2 minutes. p95 must be under 800 ms.”</p><p>Claude generates the .jmx and the run command.</p><p>One important thing: <strong>Claude does not run the test for you.</strong> It writes the plan, you run it on your own computer, and then you upload the results file so Claude can analyze it.</p><h3>Running the test, step by step</h3><ol><li>Install Java, then download JMeter from the official Apache JMeter website and unzip it.</li><li>Save the test plan file (it ends in .jmx) in a folder.</li><li>Open a terminal in that folder and run this command:</li></ol><pre>jmeter -n -t dummyjson_search_test.jmx -Jthreads=10 -Jrampup=10 -Jduration=120 -l results.jtl -e -o report/</pre><p>Here is what each part does:</p><ul><li>-n runs JMeter without its visual window. Always do this for real tests.</li><li>-t is the test plan to run.</li><li>-J options set the users, ramp-up and duration, so you can change them without editing the file.</li><li>-l results.jtl saves the raw results to a file.</li><li>-e -o report/ creates an HTML report in a new folder. The folder must not exist yet, so delete it before running again.</li></ul><h3>Reading the results</h3><p>I uploaded results.jtl to Claude and asked it to check the results against my SLA.</p><p>“Analyze these JMeter results against my SLAs.”</p><p>Claude produces the metrics table and recommendations.</p><p>Here is what came back:</p><ul><li><strong>Requests:</strong> 349 in about 117 seconds, and every one returned HTTP 200.</li><li><strong>Error rate:</strong> 0%. Always check this first. Failed requests are often very fast, so a high error rate can make response times look better than they really are.</li><li><strong>Overall p95:</strong> about 310 ms, against my 800 ms limit. <strong>The SLA passed</strong>, with plenty of room to spare.</li><li><strong>Average:</strong> 277 ms.</li><li><strong>p95 for each request:</strong> 311 ms for the health check, 309 ms for the phone search and 284 ms for the laptop search.</li><li><strong>Stability:</strong> the p95 stayed between 304 and 318 ms in every 30 second window, so the system did not slow down as the test went on.</li><li><strong>Slowest request:</strong> 1698 ms, and a p99 of about 964 ms (99 out of 100 requests were faster than this).</li></ul><p>Six requests (1.7%) took longer than 800 ms. The first few happened right at the start, when new users open their first connection, which is normal. The others came in two short bursts, about 32 and 92 seconds into the test, when several users were slow at the same moment. That pattern points to a brief server or network hiccup rather than a problem with the test, but one run is not enough to be sure. The right next step is to run it again and see whether it repeats.</p><h3>The mistake that taught me the most</h3><p>The SLA passed, but one number bothered me: the throughput was only about 3 requests per second. With 10 users, each request taking about 0.3 seconds, and 1 second of think time, I expected closer to 8.</p><p>The cause was a JMeter rule I did not know. <strong>A timer applies to every request in its scope.</strong> I had added a 1 second pause after each of my three requests, but all three timers sat directly inside the thread group, so every request waited 3 seconds instead of 1. My test was running at only about 40% of the load I intended.</p><p>The response times were still real, but they were measured under lighter load than I planned. The fix is to keep a single timer at the thread group level, which I did in the corrected test plan for the next run.</p><p>The lesson for beginners: don’t only look at pass or fail. Ask whether the numbers match what your settings should produce. That one check exposed a bug that a passing result had hidden.</p><h3>What to try next</h3><p>Since the p95 had a lot of room, the next step is to increase the load slowly, to 20 users and then 30, and watch for the point where the p95 or the error rate starts to climb. That point is your real capacity limit. Because DummyJSON is a shared public service, keep the load modest.</p><h3>Quick recap</h3><ul><li>Load testing simulates many users at once, to find slowdowns before real users do.</li><li>JMeter is a free tool that does this, and the p95 is the most useful number to watch.</li><li>A Claude skill is a folder with a SKILL.md file that saves you from repeating your process.</li><li>Always check the error rate before trusting response times.</li><li>Only test systems you own or have permission to test.</li><li>In JMeter, a timer applies to every request in its scope.</li><li>Compare the throughput with what you expected. It can reveal mistakes in your test.</li></ul><h3>Conclusion</h3><p>Load testing sounds technical, but the idea is simple: ask many users to use your system at the same time, and measure what happens. In this article I used free tools to run a two minute test with 10 virtual users. The API met my SLA, with a p95 of about 310 ms against a limit of 800 ms, and no errors at all.</p><p>Claude helped in two ways. The skill saved me from explaining my process every time, and it created the test plan and analyzed the results. But the most valuable lesson was not the passing result. It was noticing that the throughput was lower than expected, which led me to a timer mistake in my own test plan. Tools can write plans and calculate numbers, but you still need to ask whether the results make sense.</p><p>If you are just starting out, begin small. Pick a system you are allowed to test, set one clear SLA, run a short test, and check the error rate before anything else. Then increase the load step by step and see where it starts to struggle.</p><p>Try the skill from this article, adapt it to your own project, and see what you find.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e5fd92094de2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Monitor CPU and Memory of a Windows Application During Performance Tests]]></title>
            <link>https://medium.com/@pavankumarsayannagari13/how-to-monitor-cpu-and-memory-of-a-windows-application-during-performance-tests-8aeec529037e?source=rss-3e3c7fa9c4bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/8aeec529037e</guid>
            <category><![CDATA[jmeter]]></category>
            <category><![CDATA[quality-assurance]]></category>
            <category><![CDATA[monitoring]]></category>
            <category><![CDATA[performance-testing]]></category>
            <category><![CDATA[load-testing]]></category>
            <dc:creator><![CDATA[Pavankumarsayannagari]]></dc:creator>
            <pubDate>Wed, 21 Oct 2026 10:47:11 GMT</pubDate>
            <atom:updated>2026-10-21T10:47:11.398Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jr8QFRy5vHYYrR9ErZJKew.png" /></figure><p>If you run performance tests on a Windows application, you probably know this routine: start the test, open Task Manager, and keep an eye on CPU and memory while the run goes on. It works for a quick look, but it has a big weakness. Task Manager only shows what is happening right now. Once a 5 or 30 minute run ends, the history is gone, and you have nothing to put in your report.</p><p>In this article I will show two ways to record CPU and memory for the full duration of a test, for the whole machine and for a single application or Windows service:</p><ol><li><strong>Performance Monitor (Perfmon)</strong>, built into Windows, with nothing to install.</li><li><strong>Prometheus, Grafana and windows_exporter</strong>, which gives you live dashboards and stored history.</li></ol><p>I will also cover the mistakes I made along the way, because most of the confusion in this topic comes from a few counters that look similar but measure different things.</p><h3>Why Task Manager is not enough</h3><ul><li>It shows live values only, with no saved history of your 5 or 30 minute run.</li><li>You cannot export the data to Excel for a report.</li><li>You cannot compare two runs side by side.</li><li>You cannot easily line up resource usage with response times and throughput.</li></ul><p>A good performance test report needs the average, the peak and the trend of CPU and memory during the test window. That means you need to log the data.</p><h3>Method 1: Performance Monitor (Perfmon)</h3><p>Perfmon is already on every Windows machine. You create a <strong>Data Collector Set</strong> once, and reuse it for every run.</p><h3>Step 1: Start your application</h3><p>The process name only appears in the counter list while the application is running, so start it before you open Perfmon.</p><h3>Step 2: Create the Data Collector Set</h3><ol><li>Press Win + R, type perfmon, and press Enter (run it as Administrator if you can).</li><li>Expand <strong>Data Collector Sets</strong>, then <strong>User Defined</strong>.</li><li>Right-click <strong>User Defined</strong> and choose <strong>New, then Data Collector Set</strong>.</li><li>Give it a name such as AppPerfTest.</li><li>Choose <strong>Create manually (Advanced)</strong>, then tick <strong>Performance counter</strong> only.</li></ol><h3>Step 3: Add the counters</h3><p>Click <strong>Add</strong> and pick the counters below. Here is the part that trips people up: the object called <strong>Process</strong> (singular) gives you per-application counters, while <strong>Processes</strong> only counts how many processes are running. Choose <strong>Process</strong>.</p><p>For the whole machine:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/338/1*fU8mQ6Vb9VmO-Xz5OAhx9w.png" /></figure><p>For a single application or service (for example MyService, written without .exe):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/356/1*KCo7NNun1fJ69DmNUn8AOw.png" /></figure><p>Use <strong>Processor, % Processor Time, _Total</strong> for machine CPU. Do not use <strong>Process, % Processor Time, _Total</strong>. That one adds up the CPU of every process across every core, so on a multi-core machine it can read 400% or more and also includes the Idle process.</p><h3>Step 4: Set the sample interval and save location</h3><p>Use <strong>5 seconds</strong> for a 30 minute run. For a 5 minute run, 1 or 2 seconds gives finer detail. Choose a folder such as C:\PerfLogs\AppTest, make sure it exists, and finish the wizard.</p><h3>Step 5: Save as CSV</h3><p>By default Perfmon writes a binary .blg file. To get a CSV that opens straight in Excel, right-click <strong>DataCollector01</strong> in your set, open <strong>Properties</strong>, and change <strong>Log format</strong> to <strong>Comma Separated</strong>.</p><p>If you already have a .blg file, convert it from the command line:</p><pre>relog &quot;C:\PerfLogs\AppTest\DataCollector01.blg&quot; -f csv -o &quot;C:\PerfLogs\AppTest\result.csv&quot;</pre><h3>Step 6: Make it stop automatically</h3><p>Right-click your set, choose <strong>Properties</strong>, open the <strong>Stop Condition</strong> tab, tick <strong>Overall duration</strong>, and enter 5 Minutes or 30 Minutes. Change this value for each type of run.</p><h3>Step 7: Run it with your test</h3><p>Start your performance test, then right-click the set and choose <strong>Start</strong>. Starting it a few seconds early also captures a baseline. When the duration ends, it stops by itself and saves a new folder for that run.</p><h3>Understanding the numbers</h3><p>This is where most people get confused, so let me go through the common surprises.</p><p>CPU above 100% for a single process</p><p>Process, % Processor Time is measured against one core. On an 8 core machine, a process using everything it can may show 800%. To get the share of the whole machine, divide by the number of logical processors:</p><pre>(Get-CimInstance Win32_ComputerSystem).NumberOfLogicalProcessors</pre><p>Machine level Processor, % Processor Time, _Total is already on a 0 to 100% scale, so no division is needed.</p><h3>Why Perfmon memory does not match Task Manager</h3><p>This one confused me at first. For my service, Task Manager showed about 25 MB, while Perfmon’s Working Set showed about 71 MB. Both were correct. They measure different things:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/903/1*rvoh65RbKLIci9YK08qmOA.png" /></figure><p>Task Manager’s default column excludes shared memory, so it is the smallest number. Working Set includes shared libraries, so it is the largest. If you want a number that matches Task Manager, add <strong>Working Set — Private</strong>. For memory leak checks, use <strong>Private Bytes</strong>: if it keeps climbing across a 30 minute run, the application is probably leaking memory.</p><p>Also remember the units. Perfmon reports bytes, so divide by 1,048,576 for MB or 1,073,741,824 for GB. Task Manager’s “K” is kilobytes, so divide by 1,024 for MB.</p><h3>Perfmon gives free memory, not used memory</h3><p>There is no counter for used RAM. Calculate it from available memory:</p><pre>Memory used (MB) = Total RAM (MB) - Available MBytes</pre><p>Get the total with (Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory / 1MB, then add a column in Excel with a formula like =16384 - C2, where 16384 is your total RAM in MB and C2 is the available memory cell.</p><h3>Too many decimal places</h3><p>Perfmon logs full precision values such as 6.5784772871850468. It has no setting to shorten them, so format the column in Excel (Format Cells, Number, 2 decimals) or use =ROUND(B2,2). Formatting keeps the exact values underneath, which is better for averages and peaks.</p><h3>Method 2: Prometheus, Grafana and windows_exporter</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6GrhdLMFKlAYlTXBXHs_GA.png" /></figure><p>Perfmon is great for simple logging. If you want live dashboards, stored history and the ability to compare runs, the Prometheus and Grafana stack is a better fit. It has three parts:</p><ul><li><strong>windows_exporter</strong> runs on the machine you want to monitor and publishes metrics on port 9182.</li><li><strong>Prometheus</strong> scrapes those metrics every few seconds and stores them.</li><li><strong>Grafana</strong> draws dashboards from what Prometheus has stored.</li></ul><h3>Step 1: Install windows_exporter</h3><p>Download the latest .msi from the project&#39;s GitHub releases page and install it from an Administrator PowerShell, listing the collectors you need:</p><pre>msiexec /i &quot;$env:USERPROFILE\Downloads\windows_exporter-0.31.9-amd64.msi&quot; ENABLED_COLLECTORS=&quot;cpu,memory,process,os,system,logical_disk,net&quot; LISTEN_PORT=9182</pre><p>Two notes from experience. First, use the real path of your downloaded file. Pointing to a folder that does not exist gives the error “This installation package could not be opened”. Second, do not include the old cs collector in version 0.31 or later. It was removed, and listing a collector that does not exist can stop the service from starting.</p><p>Verify it by opening http://localhost:9182/metrics. Search for windows_process to confirm per-process metrics are present.</p><h3>Step 2: Install and configure Prometheus</h3><p>Download the Windows zip from the Prometheus site and extract it. Edit prometheus.yml and add a job for the exporter:</p><pre>global:<br>  scrape_interval: 15s<br>  evaluation_interval: 15s</pre><pre>scrape_configs:<br>  - job_name: &quot;prometheus&quot;<br>    static_configs:<br>      - targets: [&quot;localhost:9090&quot;]</pre><pre>  - job_name: &quot;windows&quot;<br>    scrape_interval: 5s<br>    static_configs:<br>      - targets: [&quot;localhost:9182&quot;]</pre><p>Then start prometheus.exe and open http://localhost:9090/targets. The windows job should show <strong>UP</strong>.</p><p>A YAML tip that saved me time: each job needs its own - job_name: line, and static_configs must not appear twice in one job. If you see the error &quot;field static_configs already set&quot; or &quot;did not find expected key&quot;, check your indentation. Use spaces only, never tabs, and keep targets: and labels: lined up in the same column. You can also validate the file before starting with promtool.exe check config prometheus.yml.</p><h3>Step 3: Install Grafana and connect it</h3><p>Install Grafana, open http://localhost:3000, and sign in (the default is admin / admin). Go to <strong>Connections, Data sources, Add data source, Prometheus</strong>, set the URL to http://localhost:9090, and click <strong>Save and test</strong>.</p><h3>Step 4: Build the panels</h3><p>Create a new dashboard and add one panel per query. In the examples below, replace MyService with your process name, without .exe.</p><p><strong>Machine CPU %</strong> (unit: Percent 0 to 100):</p><pre>100 - avg(rate(windows_cpu_time_total{job=&quot;windows&quot;,mode=&quot;idle&quot;}[1m])) * 100</pre><p><strong>Machine memory used, in GB</strong> (unit: gigabytes):</p><pre>(windows_memory_physical_total_bytes{job=&quot;windows&quot;} - windows_memory_physical_free_bytes{job=&quot;windows&quot;}) / 1073741824</pre><p><strong>Application CPU, as a share of the whole machine</strong> (unit: Percent 0 to 100):</p><pre>sum(rate(windows_process_cpu_time_total{job=&quot;windows&quot;,process=&quot;MyService&quot;}[1m])) / count(windows_cpu_time_total{job=&quot;windows&quot;,mode=&quot;idle&quot;}) * 100</pre><p><strong>Application memory, in MB</strong> (unit: megabytes):</p><pre>sum(windows_process_working_set_private_bytes{job=&quot;windows&quot;,process=&quot;MyService&quot;}) / 1048576</pre><p><strong>Disk space for C: and D:, used and free in one panel, in GB:</strong></p><pre>label_replace(<br>  (windows_logical_disk_size_bytes{job=&quot;windows&quot;,volume=&quot;C:&quot;} - windows_logical_disk_free_bytes{job=&quot;windows&quot;,volume=&quot;C:&quot;}) / 1073741824,<br>  &quot;type&quot;, &quot;C used&quot;, &quot;&quot;, &quot;&quot;<br>)<br>or<br>label_replace(<br>  windows_logical_disk_free_bytes{job=&quot;windows&quot;,volume=&quot;C:&quot;} / 1073741824,<br>  &quot;type&quot;, &quot;C free&quot;, &quot;&quot;, &quot;&quot;<br>)</pre><p>Set the legend to {{type}} and the unit to gigabytes. Repeat with volume=&quot;D:&quot; for the second drive.</p><p><strong>Number of CPUs:</strong></p><pre>count(windows_cpu_time_total{job=&quot;windows&quot;,mode=&quot;idle&quot;})</pre><h3>Step 5: Use it during a test</h3><p>Set the Grafana time range to <strong>Last 5 minutes</strong> or <strong>Last 30 minutes</strong> (or an exact range) after the run. To export the data for your report, use a panel’s <strong>Inspect, Data, Download CSV</strong>.</p><h3>Mistakes to avoid</h3><p>These cost me the most time, so I hope they save you some:</p><ol><li><strong>Choosing </strong><strong>Processes instead of </strong><strong>Process in Perfmon.</strong> Only Process has the per-application counters.</li><li><strong>Using </strong><strong>Process(_Total) for machine CPU.</strong> Use Processor(_Total) instead, which stays within 0 to 100%.</li><li><strong>Using old metric names with a new exporter.</strong> In windows_exporter 0.31 the cs collector was removed. Metrics such as windows_cs_physical_memory_bytes no longer exist. Memory totals now come from the memory collector (windows_memory_physical_total_bytes and windows_memory_physical_free_bytes). When a panel shows &quot;No data&quot;, search the /metrics page for the real metric names on your version.</li><li><strong>Comparing Working Set with Task Manager.</strong> They are different measures. Use Working Set — Private to match Task Manager.</li><li><strong>Forgetting to enable the </strong><strong>process collector.</strong> Without it, you will get machine metrics but nothing per application.</li><li><strong>Starting the application after creating the counters.</strong> The process will not be in the instance list.</li></ol><h3>Which method should you use?</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/885/1*IsAk_M1bAOh5uuDIhepTyQ.png" /></figure><p>If you need results today with no installation, use Perfmon. If you test regularly and want dashboards you can share, invest the time in Grafana. Many testers keep both: Perfmon as a simple backup record and Grafana for the live view.</p><h3>What to put in your report</h3><p>Whichever tool you use, record these for each run:</p><ul><li><strong>Test duration and start and end time</strong></li><li><strong>Average and peak CPU</strong>, for the machine and for the application</li><li><strong>Lowest available memory</strong> (or peak memory used) during the run</li><li><strong>Memory trend</strong> for the application, using Private Bytes. A steady rise over a 30 minute run is a warning sign for a leak</li><li><strong>Which counter you used</strong>, for example “Working Set — Private”, so anyone comparing against Task Manager sees why the numbers match</li></ul><p>A simple rule of thumb: sustained machine CPU above about 80% suggests the CPU is a bottleneck, and steadily falling available memory suggests a leak or memory pressure.</p><h3>Conclusion</h3><p>Task Manager is fine for a quick look, but a proper performance test needs recorded data. Perfmon gives you a quick, no-install way to log CPU and memory for any run. Prometheus and Grafana take a little more setup, but reward you with dashboards, history and easier comparisons between runs. Whichever you pick, take care to choose the right counters, understand what each one measures, and note which one you used in the report. That alone will save you a lot of confusion when someone asks why your number does not match Task Manager.</p><p>If this guide helped you, feel free to share it with other testers, and let me know in the comments which additional metrics (disk, network, threads, handles) you would like me to cover next.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8aeec529037e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting Up Apache JMeter, InfluxDB 2.7, and Grafana Using Docker: A Complete Beginner’s Guide]]></title>
            <link>https://medium.com/@pavankumarsayannagari13/setting-up-apache-jmeter-influxdb-2-7-and-grafana-using-docker-a-complete-beginners-guide-b66a09b0a5e6?source=rss-3e3c7fa9c4bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/b66a09b0a5e6</guid>
            <category><![CDATA[influxdb]]></category>
            <category><![CDATA[jmeter]]></category>
            <category><![CDATA[grafana]]></category>
            <category><![CDATA[load-testing]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Pavankumarsayannagari]]></dc:creator>
            <pubDate>Fri, 17 Jul 2026 16:37:09 GMT</pubDate>
            <atom:updated>2026-07-18T05:48:35.290Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong><em>Build a portable performance testing environment in minutes without installing multiple tools locally.</em></strong></blockquote><h3>Introduction</h3><p>Performance testing is a critical step in ensuring applications remain stable, scalable, and responsive under load. While <strong>Apache JMeter</strong> is one of the most popular open-source tools for load testing, setting up JMeter along with <strong>InfluxDB</strong> and <strong>Grafana</strong> on a local machine can be time-consuming and difficult to maintain.</p><p>Docker simplifies this process by packaging each tool into its own container, allowing you to build a consistent and reusable performance testing environment that works across Windows, macOS, and Linux.</p><p>In this guide, you’ll learn how to build a complete performance testing stack using Docker and visualize JMeter metrics in Grafana through InfluxDB.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R6qW_QyAuJ3S98hkjYeyCA.png" /></figure><h3><strong>What is Docker?</strong></h3><p>Imagine installing JMeter, Java, Grafana, and InfluxDB separately on every laptop or server. Different versions and dependencies can quickly become difficult to manage.</p><p>Docker packages an application together with everything it needs into a <strong>container</strong>, allowing it to run consistently on any machine.</p><p><strong>Without Docker:</strong></p><p>Windows<br> ↓<br>Install Java<br> ↓<br>Install JMeter<br> ↓<br>Install Grafana<br> ↓<br>Install InfluxDB<br> ↓<br>Configure Everything</p><p><strong>With Docker:</strong></p><p>Install Docker<br> ↓<br>Run Containers<br> ↓<br>Everything Works</p><h3>Why Docker?</h3><p>Docker offers several advantages:</p><ul><li>No manual installation of Java</li><li>No dependency conflicts</li><li>Same setup on Windows, Linux, and macOS</li><li>Easy to share with your team</li><li>Quick to recreate environments</li><li>Great fit for CI/CD pipelines</li></ul><h3>📚 What You’ll Learn</h3><p>By the end of this tutorial, you’ll be able to:</p><ul><li>Install and verify Docker</li><li>Create a shared Docker network</li><li>Run InfluxDB 2.7 inside Docker</li><li>Run Grafana inside Docker</li><li>Execute Apache JMeter inside Docker</li><li>Generate HTML reports</li><li>Stream JMeter metrics into InfluxDB</li><li>Visualize real-time performance metrics in Grafana</li></ul><h3>🏗 Architecture</h3><pre>Docker Networ</pre><pre>               Docker Network</pre><pre>        +-----------------------------+<br>        |        Apache JMeter        |<br>        |      (Load Generator)       |<br>        +-------------+---------------+<br>                      |<br>                      |<br>                      ▼<br>        +-----------------------------+<br>        |         InfluxDB 2.7        |<br>        |      (Time-Series DB)       |<br>        +-------------+---------------+<br>                      |<br>                      ▼<br>        +-----------------------------+<br>        |          Grafana            |<br>        |     (Visualization UI)      |<br>        +-----------------------------+</pre><h3>✅ Prerequisites</h3><p>Before starting, install the following:</p><ul><li>Docker Desktop</li><li>Apache JMeter Test Plan (.jmx)</li></ul><h3>🐳 Installing Docker Desktop</h3><p>Before setting up Apache JMeter, InfluxDB, and Grafana, you need Docker installed on your machine.</p><p>Docker Desktop is available for <strong>Windows</strong>, <strong>macOS</strong>, and <strong>Linux</strong>, making it easy to create a consistent performance testing environment across different operating systems.</p><h3>Step 1 — Download Docker Desktop</h3><p>Download Docker Desktop from the official Docker website:</p><p><a href="https://www.docker.com/products/docker-desktop/"><strong>https://www.docker.com/products/docker-desktop/</strong></a></p><p>Choose the installer that matches your operating system.</p><h3>Step 2 — Install Docker</h3><h3>Windows</h3><ol><li>Run the downloaded installer.</li><li>Enable <strong>WSL 2</strong> if prompted.</li><li>Complete the installation.</li><li>Restart your computer if required.</li></ol><blockquote><strong><em>Note:</em></strong><em> Windows 10/11 users should have WSL 2 enabled for the best Docker experience.</em></blockquote><h3>macOS</h3><ol><li>Download the installer for either <strong>Apple Silicon (M1/M2/M3)</strong> or <strong>Intel</strong> processors.</li><li>Open the .dmg file.</li><li>Drag <strong>Docker</strong> into the <strong>Applications</strong> folder.</li><li>Launch Docker Desktop.</li><li>Wait until Docker finishes starting.</li></ol><h3>Linux (Ubuntu)</h3><p>Update your package index:</p><pre>sudo apt update</pre><p>Install Docker:</p><pre>sudo apt install docker.io -y</pre><p>Start the Docker service:</p><pre>sudo systemctl start docker<br>sudo systemctl enable docker</pre><p>(Optional) Run Docker without using sudo:</p><pre>sudo usermod -aG docker $USER</pre><p>Log out and log back in for the changes to take effect.</p><h3>Step 3 — Verify the Installation</h3><p>Open a terminal (or Command Prompt/PowerShell on Windows) and run:</p><pre>docker --version</pre><p>Example output:</p><pre>Docker version 28.3.2, build 578ccf6</pre><p>Verify that Docker is running:</p><pre>docker info</pre><p>If Docker is running correctly, you’ll see information about your Docker Engine, containers, images, and system resources.</p><p>You can also test Docker by running the official Hello World container:</p><pre>docker run hello-world</pre><p>If everything is working correctly, you’ll see a welcome message similar to:</p><pre>Hello from Docker!<br>This message shows that your installation appears to be working correctly.</pre><p>Congratulations! 🎉 Docker is now installed and ready to use.</p><p>In the next section, we’ll create a Docker network and start our InfluxDB and Grafana containers.</p><h3>Step 1 — Create a Docker Network</h3><p>Create a shared Docker network so all containers can communicate with each other.</p><pre>docker network create performancelab</pre><p>Verify:</p><pre>docker network ls</pre><p>You should see:</p><pre>performancelab</pre><h3>Step 2 — Run InfluxDB 2.7</h3><p>Start InfluxDB:</p><pre>docker run -d \<br>  --name influxdb \<br>  --network performancelab \<br>  -p 8086:8086 \<br>  -v influxdb-data:/var/lib/influxdb2 \<br>  influxdb:2.7</pre><p>Open your browser:</p><pre>http://localhost:8086</pre><p>Complete the initial setup.</p><p>Example configuration:</p><p>Setting : Value</p><p>Organization : mq</p><p>Bucket : jmeter</p><p>Generate an <strong>All Access API Token</strong> and save it — you’ll need it later.</p><h3>Step 3 — Run Grafana</h3><p>Start Grafana:</p><pre>docker run -d \<br>  --name grafana \<br>  --network performancelab \<br>  -p 3000:3000 \<br>  grafana/grafana</pre><p>Open:</p><pre>http://localhost:3000</pre><p>Default credentials:</p><pre>Username: admin<br>Password: admin</pre><p>Grafana will ask you to change the password after your first login.</p><h3>Step 4 — Organize Your Project</h3><p>Create the following folder structure:</p><pre>PerformanceLab/</pre><pre>├── jmeter<br>│   ├── TestPlan.jmx<br>│   └── results</pre><p>This keeps your test plans and reports organized.</p><h3>Step 5 — Run Apache JMeter in Docker</h3><p>Execute your JMeter test plan:</p><pre>docker run --rm \<br>  --network performancelab \<br>  -v &quot;$(pwd)/jmeter:/test&quot; \<br>  justb4/jmeter:latest \<br>  -n \<br>  -t /test/TestPlan.jmx \<br>  -l /test/results/results.jtl</pre><p>This command:</p><ul><li>Runs JMeter in Non-GUI mode</li><li>Executes your test plan</li><li>Stores results in a .jtl file</li><li>Automatically removes the container after completion</li></ul><h3>Step 6 — Generate an HTML Report</h3><p>Generate a detailed HTML report:</p><pre>docker run --rm \<br>-v &quot;$(pwd)/jmeter:/test&quot; \<br>justb4/jmeter:latest \<br>-g /test/results/results.jtl \<br>-o /test/results/html-report</pre><p>Open:</p><pre>results/html-report/index.html</pre><p>The report includes:</p><ul><li>Response Time</li><li>Throughput</li><li>Latency</li><li>Error Percentage</li><li>Active Threads</li><li>Transactions Per Second</li><li>Graphs and Charts</li></ul><h3>Step 7 — Configure the Backend Listener</h3><p>To stream metrics into InfluxDB, add a <strong>Backend Listener</strong> to your JMeter Test Plan.</p><p>Implementation Class:</p><pre>org.apache.jmeter.visualizers.backend.influxdb.InfluxdbBackendListenerClient</pre><p>Configuration:</p><p>Property : Value</p><p>URL : <a href="http://influxdb:8086/write?db=jmeter">http://influxdb:8086/write?db=jmeter</a></p><p>Application : jmeterTest</p><p>Measurement : jmeter</p><h3>⚠️ Important Note for InfluxDB 2.x Users</h3><p>The JMeter Backend Listener was originally designed for <strong>InfluxDB 1.x</strong>.</p><p>To use it with InfluxDB 2.x, you must create a <strong>DBRP (Database and Retention Policy) Mapping</strong>.</p><p>List your buckets:</p><pre>docker exec -it influxdb influx bucket list \<br>  --org mq \<br>  --token YOUR_TOKEN</pre><p>Create the mapping:</p><pre>docker exec -it influxdb influx v1 dbrp create \<br>  --org mq \<br>  --token YOUR_TOKEN \<br>  --bucket-id YOUR_BUCKET_ID \<br>  --db jmeter \<br>  --rp autogen \<br>  --default</pre><p>Verify the mapping:</p><pre>docker exec -it influxdb influx v1 dbrp list \<br>  --org mq \<br>  --token YOUR_TOKEN</pre><p>Without this mapping, JMeter won’t be able to write metrics to InfluxDB 2.x.</p><h3>Step 8 — Configure Grafana</h3><p>Add a new <strong>InfluxDB</strong> data source.</p><p>Use the following settings:</p><p>Property : Value</p><p>Query Language : Flux</p><p>URL : <a href="http://influxdb:8086/">http://influxdb:8086</a></p><p>Organization : mq</p><p>Bucket : jmeter</p><p>Token : YOUR_TOKEN</p><p>Click <strong>Save &amp; Test</strong>.</p><p>If everything is configured correctly, Grafana will display a successful connection message.</p><h3>Useful Flux Queries</h3><h3>Total Requests</h3><pre>from(bucket: &quot;jmeter&quot;)<br>  |&gt; range(start: v.timeRangeStart)<br>  |&gt; filter(fn: (r)=&gt; r._measurement==&quot;jmeter&quot;)<br>  |&gt; filter(fn: (r)=&gt; r._field==&quot;count&quot;)<br>  |&gt; group()<br>  |&gt; sum()</pre><h3>Average Response Time</h3><pre>from(bucket: &quot;jmeter&quot;)<br>  |&gt; range(start: v.timeRangeStart)<br>  |&gt; filter(fn: (r)=&gt; r._measurement==&quot;jmeter&quot;)<br>  |&gt; filter(fn: (r)=&gt; r._field==&quot;avg&quot;)</pre><h3>Error Count</h3><pre>from(bucket: &quot;jmeter&quot;)<br>  |&gt; range(start: v.timeRangeStart)<br>  |&gt; filter(fn: (r)=&gt; r._measurement==&quot;jmeter&quot;)<br>  |&gt; filter(fn: (r)=&gt; r._field==&quot;countError&quot;)<br>  |&gt; group()<br>  |&gt; sum()</pre><h3>90th Percentile Response Time</h3><pre>from(bucket: &quot;jmeter&quot;)<br>  |&gt; range(start: v.timeRangeStart)<br>  |&gt; filter(fn: (r)=&gt; r._measurement==&quot;jmeter&quot;)<br>  |&gt; filter(fn: (r)=&gt; r._field==&quot;pct90.0&quot;)</pre><h3>Recommended Grafana Dashboard</h3><p>Create panels for:</p><ul><li>Total Requests</li><li>Error Count</li><li>Average Response Time</li><li>Minimum Response Time</li><li>Maximum Response Time</li><li>90th Percentile</li><li>Active Threads</li><li>Throughput</li><li>Hits Per Second</li><li>Transactions by Label</li><li>Error Count by Label</li><li>Response Time Trend</li></ul><p>These panels provide a complete view of your application’s performance during load testing.</p><h3>Why Use Docker?</h3><p>Docker offers several advantages for performance testing:</p><ul><li>No local installation of JMeter, Grafana, or InfluxDB</li><li>Consistent environment across Windows, macOS, and Linux</li><li>Easy setup for new team members</li><li>Isolated dependencies</li><li>Portable and reusable infrastructure</li><li>Simple CI/CD integration</li><li>Faster environment provisioning</li></ul><h3>Troubleshooting</h3><h3>Error: must specify org ID or org name</h3><p>Always specify the organization when running InfluxDB CLI commands:</p><pre>--org mq</pre><h3>Error: unauthorized access</h3><p>Verify that you’re using a valid API token.</p><h3>No Metrics in Grafana</h3><p>Check:</p><ul><li>Backend Listener configuration</li><li>API Token</li><li>Bucket name</li><li>DBRP mapping</li><li>Grafana Data Source settings</li></ul><h3>Conclusion</h3><p>By combining <strong>Apache JMeter</strong>, <strong>InfluxDB 2.7</strong>, <strong>Grafana</strong>, and <strong>Docker</strong>, you can build a clean, portable, and scalable performance testing environment in just a few minutes. Docker removes the complexity of installing and maintaining multiple tools, while InfluxDB and Grafana provide powerful real-time monitoring and visualization capabilities.</p><p>Whether you’re learning performance testing, building a reusable lab, or integrating load tests into a CI/CD pipeline, this setup gives you a reliable foundation for generating load, collecting metrics, and analyzing application performance with ease.</p><p>If you found this guide helpful, feel free to share it with your team and follow me on Medium for more articles on <strong>Performance Testing</strong>, <strong>Apache JMeter</strong>, <strong>k6</strong>, <strong>Grafana</strong>, <strong>InfluxDB</strong>, and performance engineering.</p><h3>👏 Thanks for Reading!</h3><p>If this article helped you, consider giving it a clap, highlighting useful sections, and sharing it with others in the performance testing community. Happy testing! 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b66a09b0a5e6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Automating Apache JMeter Performance Testing with GitHub Actions — A Beginner’s Guide]]></title>
            <link>https://medium.com/@pavankumarsayannagari13/automating-apache-jmeter-performance-testing-with-github-actions-a-beginners-guide-8ce68f9f519c?source=rss-3e3c7fa9c4bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/8ce68f9f519c</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[load-testing]]></category>
            <category><![CDATA[jmeter]]></category>
            <category><![CDATA[performance-testing]]></category>
            <dc:creator><![CDATA[Pavankumarsayannagari]]></dc:creator>
            <pubDate>Sun, 12 Jul 2026 06:50:57 GMT</pubDate>
            <atom:updated>2026-07-12T07:00:24.043Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>Performance testing is an important part of software development. Instead of manually running Apache JMeter every time you make changes, GitHub Actions can automatically execute your JMeter test plan whenever you push code to GitHub.</p><p>In this tutorial, you’ll learn how to:</p><ul><li>Create a GitHub repository</li><li>Add a JMeter test plan</li><li>Create a GitHub Actions workflow</li><li>Commit and push the code</li><li>Automatically execute the JMeter test</li><li>Download the HTML performance report</li></ul><p>No prior GitHub Actions experience is required.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_hDgw6NnyJd72J9ON9YIgw.png" /></figure><h3>Prerequisites</h3><p>Before starting, make sure you have:</p><ul><li>Git installed</li><li>A GitHub account</li><li>Apache JMeter installed (used to create the test plan)</li><li>Visual Studio Code (recommended)</li><li>A JMeter test plan (test-plan.jmx)</li></ul><h3>Project Structure</h3><p>Create a project with the following structure:</p><pre>JMeter-GitHub-Actions/<br>│<br>├── .github/<br>│   └── workflows/<br>│       └── performance-test.yml<br>│<br>├── test-plan.jmx<br>│<br>└── README.md</pre><p>Your uploaded file is named <strong>test-plan.jmx</strong>, so place it in the project root as shown above.</p><h3>Step 1: Create a GitHub Repository</h3><ol><li>Log in to GitHub.</li><li>Click <strong>New Repository</strong>.</li><li>Enter a repository name.</li><li>Choose <strong>Public</strong> or <strong>Private</strong>.</li><li>Click <strong>Create Repository</strong>.</li></ol><p>Example:</p><pre>Repository Name:<br>jmeter-github-actions</pre><h3>Step 2: Clone the Repository</h3><p>Copy the repository URL and run:</p><pre>git clone https://github.com/your-username/jmeter-github-actions.git</pre><pre>cd jmeter-github-actions</pre><h3>Step 3: Copy the JMeter Test Plan</h3><p>Copy your JMeter file into the repository:</p><pre>test-plan.jmx</pre><pre>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;<br>&lt;jmeterTestPlan version=&quot;1.2&quot; properties=&quot;5.0&quot; jmeter=&quot;5.6.3&quot;&gt;<br>  &lt;hashTree&gt;<br>    &lt;TestPlan guiclass=&quot;TestPlanGui&quot; testclass=&quot;TestPlan&quot; testname=&quot;Test Plan&quot;&gt;<br>      &lt;stringProp name=&quot;TestPlan.comments&quot;&gt;This test runs strictly for 2 minutes (120 seconds)&lt;/stringProp&gt;<br>      &lt;elementProp name=&quot;TestPlan.user_defined_variables&quot; elementType=&quot;Arguments&quot; guiclass=&quot;ArgumentsPanel&quot; testclass=&quot;Arguments&quot;&gt;<br>        &lt;collectionProp name=&quot;Arguments.arguments&quot;/&gt;<br>      &lt;/elementProp&gt;<br>      &lt;boolProp name=&quot;TestPlan.functional_mode&quot;&gt;false&lt;/boolProp&gt;<br>      &lt;boolProp name=&quot;TestPlan.serialize_threadgroups&quot;&gt;false&lt;/boolProp&gt;<br>    &lt;/TestPlan&gt;<br>    &lt;hashTree&gt;<br>      &lt;ThreadGroup guiclass=&quot;ThreadGroupGui&quot; testclass=&quot;ThreadGroup&quot; testname=&quot;Thread Group - 5 Minutes&quot;&gt;<br>        &lt;intProp name=&quot;ThreadGroup.num_threads&quot;&gt;10&lt;/intProp&gt;<br>        &lt;intProp name=&quot;ThreadGroup.ramp_time&quot;&gt;0&lt;/intProp&gt;<br>        &lt;longProp name=&quot;ThreadGroup.duration&quot;&gt;60&lt;/longProp&gt;<br>        &lt;longProp name=&quot;ThreadGroup.delay&quot;&gt;0&lt;/longProp&gt;<br>        &lt;boolProp name=&quot;ThreadGroup.same_user_on_next_iteration&quot;&gt;false&lt;/boolProp&gt;<br>        &lt;boolProp name=&quot;ThreadGroup.scheduler&quot;&gt;true&lt;/boolProp&gt;<br>        &lt;stringProp name=&quot;ThreadGroup.on_sample_error&quot;&gt;continue&lt;/stringProp&gt;<br>        &lt;elementProp name=&quot;ThreadGroup.main_controller&quot; elementType=&quot;LoopController&quot; guiclass=&quot;LoopControlPanel&quot; testclass=&quot;LoopController&quot;&gt;<br>          &lt;intProp name=&quot;LoopController.loops&quot;&gt;-1&lt;/intProp&gt;<br>          &lt;boolProp name=&quot;LoopController.continue_forever&quot;&gt;false&lt;/boolProp&gt;<br>        &lt;/elementProp&gt;<br>      &lt;/ThreadGroup&gt;<br>      &lt;hashTree&gt;<br>        &lt;CacheManager guiclass=&quot;CacheManagerGui&quot; testclass=&quot;CacheManager&quot; testname=&quot;HTTP Cache Manager&quot; enabled=&quot;true&quot;&gt;<br>          &lt;boolProp name=&quot;clearEachIteration&quot;&gt;false&lt;/boolProp&gt;<br>          &lt;boolProp name=&quot;useExpires&quot;&gt;true&lt;/boolProp&gt;<br>          &lt;boolProp name=&quot;CacheManager.controlledByThread&quot;&gt;false&lt;/boolProp&gt;<br>        &lt;/CacheManager&gt;<br>        &lt;hashTree/&gt;<br>        &lt;CacheManager guiclass=&quot;CacheManagerGui&quot; testclass=&quot;CacheManager&quot; testname=&quot;HTTP Cache Manager&quot; enabled=&quot;true&quot;&gt;<br>          &lt;boolProp name=&quot;clearEachIteration&quot;&gt;false&lt;/boolProp&gt;<br>          &lt;boolProp name=&quot;useExpires&quot;&gt;true&lt;/boolProp&gt;<br>          &lt;boolProp name=&quot;CacheManager.controlledByThread&quot;&gt;false&lt;/boolProp&gt;<br>        &lt;/CacheManager&gt;<br>        &lt;hashTree/&gt;<br>        &lt;HTTPSamplerProxy guiclass=&quot;HttpTestSampleGui&quot; testclass=&quot;HTTPSamplerProxy&quot; testname=&quot;HTTP GET Request&quot; enabled=&quot;true&quot;&gt;<br>          &lt;stringProp name=&quot;HTTPSampler.domain&quot;&gt;test.k6.io&lt;/stringProp&gt;<br>          &lt;stringProp name=&quot;HTTPSampler.protocol&quot;&gt;https&lt;/stringProp&gt;<br>          &lt;stringProp name=&quot;HTTPSampler.path&quot;&gt;/&lt;/stringProp&gt;<br>          &lt;boolProp name=&quot;HTTPSampler.follow_redirects&quot;&gt;true&lt;/boolProp&gt;<br>          &lt;stringProp name=&quot;HTTPSampler.method&quot;&gt;GET&lt;/stringProp&gt;<br>          &lt;boolProp name=&quot;HTTPSampler.use_keepalive&quot;&gt;true&lt;/boolProp&gt;<br>          &lt;boolProp name=&quot;HTTPSampler.postBodyRaw&quot;&gt;false&lt;/boolProp&gt;<br>          &lt;elementProp name=&quot;HTTPsampler.Arguments&quot; elementType=&quot;Arguments&quot; guiclass=&quot;HTTPArgumentsPanel&quot; testclass=&quot;Arguments&quot; testname=&quot;User Defined Variables&quot;&gt;<br>            &lt;collectionProp name=&quot;Arguments.arguments&quot;/&gt;<br>          &lt;/elementProp&gt;<br>        &lt;/HTTPSamplerProxy&gt;<br>        &lt;hashTree&gt;<br>          &lt;ResponseAssertion guiclass=&quot;AssertionGui&quot; testclass=&quot;ResponseAssertion&quot; testname=&quot;Response Assertion&quot; enabled=&quot;true&quot;&gt;<br>            &lt;collectionProp name=&quot;Asserion.test_strings&quot;&gt;<br>              &lt;stringProp name=&quot;49586&quot;&gt;200&lt;/stringProp&gt;<br>            &lt;/collectionProp&gt;<br>            &lt;stringProp name=&quot;Assertion.custom_message&quot;&gt;&lt;/stringProp&gt;<br>            &lt;stringProp name=&quot;Assertion.test_field&quot;&gt;Assertion.response_code&lt;/stringProp&gt;<br>            &lt;boolProp name=&quot;Assertion.assume_success&quot;&gt;false&lt;/boolProp&gt;<br>            &lt;intProp name=&quot;Assertion.test_type&quot;&gt;1&lt;/intProp&gt;<br>          &lt;/ResponseAssertion&gt;<br>          &lt;hashTree/&gt;<br>          &lt;DurationAssertion guiclass=&quot;DurationAssertionGui&quot; testclass=&quot;DurationAssertion&quot; testname=&quot;Duration Assertion&quot; enabled=&quot;true&quot;&gt;<br>            &lt;stringProp name=&quot;DurationAssertion.duration&quot;&gt;10000&lt;/stringProp&gt;<br>          &lt;/DurationAssertion&gt;<br>          &lt;hashTree/&gt;<br>        &lt;/hashTree&gt;<br>        &lt;ResultCollector guiclass=&quot;ViewResultsFullVisualizer&quot; testclass=&quot;ResultCollector&quot; testname=&quot;View Results Tree&quot; enabled=&quot;false&quot;&gt;<br>          &lt;boolProp name=&quot;ResultCollector.error_logging&quot;&gt;false&lt;/boolProp&gt;<br>          &lt;objProp&gt;<br>            &lt;name&gt;saveConfig&lt;/name&gt;<br>            &lt;value class=&quot;SampleSaveConfiguration&quot;&gt;<br>              &lt;time&gt;true&lt;/time&gt;<br>              &lt;latency&gt;true&lt;/latency&gt;<br>              &lt;timestamp&gt;true&lt;/timestamp&gt;<br>              &lt;success&gt;true&lt;/success&gt;<br>              &lt;label&gt;true&lt;/label&gt;<br>              &lt;code&gt;true&lt;/code&gt;<br>              &lt;message&gt;true&lt;/message&gt;<br>              &lt;threadName&gt;true&lt;/threadName&gt;<br>              &lt;dataType&gt;true&lt;/dataType&gt;<br>              &lt;encoding&gt;false&lt;/encoding&gt;<br>              &lt;assertions&gt;true&lt;/assertions&gt;<br>              &lt;subresults&gt;true&lt;/subresults&gt;<br>              &lt;responseData&gt;false&lt;/responseData&gt;<br>              &lt;samplerData&gt;false&lt;/samplerData&gt;<br>              &lt;xml&gt;false&lt;/xml&gt;<br>              &lt;fieldNames&gt;true&lt;/fieldNames&gt;<br>              &lt;responseHeaders&gt;false&lt;/responseHeaders&gt;<br>              &lt;requestHeaders&gt;false&lt;/requestHeaders&gt;<br>              &lt;responseDataOnError&gt;false&lt;/responseDataOnError&gt;<br>              &lt;saveAssertionResultsFailureMessage&gt;true&lt;/saveAssertionResultsFailureMessage&gt;<br>              &lt;assertionsResultsToSave&gt;0&lt;/assertionsResultsToSave&gt;<br>              &lt;bytes&gt;true&lt;/bytes&gt;<br>              &lt;sentBytes&gt;true&lt;/sentBytes&gt;<br>              &lt;url&gt;true&lt;/url&gt;<br>              &lt;threadCounts&gt;true&lt;/threadCounts&gt;<br>              &lt;idleTime&gt;true&lt;/idleTime&gt;<br>              &lt;connectTime&gt;true&lt;/connectTime&gt;<br>            &lt;/value&gt;<br>          &lt;/objProp&gt;<br>          &lt;stringProp name=&quot;filename&quot;&gt;&lt;/stringProp&gt;<br>        &lt;/ResultCollector&gt;<br>        &lt;hashTree/&gt;<br>        &lt;ResultCollector guiclass=&quot;StatVisualizer&quot; testclass=&quot;ResultCollector&quot; testname=&quot;Aggregate Report&quot; enabled=&quot;false&quot;&gt;<br>          &lt;boolProp name=&quot;ResultCollector.error_logging&quot;&gt;false&lt;/boolProp&gt;<br>          &lt;objProp&gt;<br>            &lt;name&gt;saveConfig&lt;/name&gt;<br>            &lt;value class=&quot;SampleSaveConfiguration&quot;&gt;<br>              &lt;time&gt;true&lt;/time&gt;<br>              &lt;latency&gt;true&lt;/latency&gt;<br>              &lt;timestamp&gt;true&lt;/timestamp&gt;<br>              &lt;success&gt;true&lt;/success&gt;<br>              &lt;label&gt;true&lt;/label&gt;<br>              &lt;code&gt;true&lt;/code&gt;<br>              &lt;message&gt;true&lt;/message&gt;<br>              &lt;threadName&gt;true&lt;/threadName&gt;<br>              &lt;dataType&gt;true&lt;/dataType&gt;<br>              &lt;encoding&gt;false&lt;/encoding&gt;<br>              &lt;assertions&gt;true&lt;/assertions&gt;<br>              &lt;subresults&gt;true&lt;/subresults&gt;<br>              &lt;responseData&gt;false&lt;/responseData&gt;<br>              &lt;samplerData&gt;false&lt;/samplerData&gt;<br>              &lt;xml&gt;false&lt;/xml&gt;<br>              &lt;fieldNames&gt;true&lt;/fieldNames&gt;<br>              &lt;responseHeaders&gt;false&lt;/responseHeaders&gt;<br>              &lt;requestHeaders&gt;false&lt;/requestHeaders&gt;<br>              &lt;responseDataOnError&gt;false&lt;/responseDataOnError&gt;<br>              &lt;saveAssertionResultsFailureMessage&gt;true&lt;/saveAssertionResultsFailureMessage&gt;<br>              &lt;assertionsResultsToSave&gt;0&lt;/assertionsResultsToSave&gt;<br>              &lt;bytes&gt;true&lt;/bytes&gt;<br>              &lt;sentBytes&gt;true&lt;/sentBytes&gt;<br>              &lt;url&gt;true&lt;/url&gt;<br>              &lt;threadCounts&gt;true&lt;/threadCounts&gt;<br>              &lt;idleTime&gt;true&lt;/idleTime&gt;<br>              &lt;connectTime&gt;true&lt;/connectTime&gt;<br>            &lt;/value&gt;<br>          &lt;/objProp&gt;<br>          &lt;stringProp name=&quot;filename&quot;&gt;&lt;/stringProp&gt;<br>        &lt;/ResultCollector&gt;<br>        &lt;hashTree/&gt;<br>      &lt;/hashTree&gt;<br>    &lt;/hashTree&gt;<br>  &lt;/hashTree&gt;<br>&lt;/jmeterTestPlan&gt;</pre><p>Your project should now look like:</p><pre>jmeter-github-actions<br>│<br>├── test-plan.jmx</pre><h3>Step 4: Create the GitHub Actions Workflow</h3><p>Create the following folders:</p><pre>.github/</pre><p>Inside it:</p><pre>workflows/</pre><p>Inside <strong>workflows</strong>, create:</p><pre>performance-test.yml</pre><pre>name: JMeter Performance Test<br><br>on:<br>  workflow_dispatch:<br>  push:<br>    branches:<br>      - main<br><br>permissions:<br>  contents: read<br><br>concurrency:<br>  group: jmeter-performance<br>  cancel-in-progress: true<br><br>env:<br>  JMETER_VERSION: &quot;5.6.3&quot;<br>  MAX_ERROR_RATE: &quot;20&quot;<br>  MAX_AVG_RESPONSE: &quot;100&quot;<br><br>jobs:<br>  performance-test:<br>    runs-on: ubuntu-latest<br>    timeout-minutes: 20<br><br>    steps:<br>      - name: Checkout Repository<br>        uses: actions/checkout@v4<br><br>      - name: Setup Java 17<br>        uses: actions/setup-java@v4<br>        with:<br>          distribution: temurin<br>          java-version: 17<br><br>      ##############################################################<br>      # Cache JMeter<br>      ##############################################################<br>      - name: Cache JMeter<br>        id: cache-jmeter<br>        uses: actions/cache@v4<br>        with:<br>          path: apache-jmeter-${{ env.JMETER_VERSION }}<br>          key: jmeter-${{ env.JMETER_VERSION }}<br><br>      ##############################################################<br>      # Download only if cache misses<br>      ##############################################################<br>      - name: Install JMeter<br>        if: steps.cache-jmeter.outputs.cache-hit != &#39;true&#39;<br>        run: |<br>          wget https://archive.apache.org/dist/jmeter/binaries/apache-jmeter-${JMETER_VERSION}.tgz<br>          tar -xzf apache-jmeter-${JMETER_VERSION}.tgz<br><br>      ##############################################################<br>      # Verify installation<br>      ##############################################################<br>      - name: Verify JMeter<br>        run: |<br>          ./apache-jmeter-${JMETER_VERSION}/bin/jmeter --version<br><br>      ##############################################################<br>      # Execute Test Plan<br>      ##############################################################<br>      - name: Run Performance Test<br>        run: |<br>          rm -rf report<br><br>          ./apache-jmeter-${JMETER_VERSION}/bin/jmeter \<br>          -n \<br>          -t test-plan.jmx \<br>          -l results.jtl \<br>          -e \<br>          -o report<br><br>      ##############################################################<br>      # Performance Quality Gate<br>      ##############################################################<br>      - name: Validate Performance Thresholds<br>        run: |<br><br>          set -euo pipefail<br><br>          TOTAL=$(awk &#39;NR&gt;1{count++} END{print count+0}&#39; results.jtl)<br><br>          ERRORS=$(awk -F&#39;,&#39; &#39;<br>          NR&gt;1 &amp;&amp; $8==&quot;false&quot; {count++}<br>          END {print count+0}<br>          &#39; results.jtl)<br><br>          AVG_TIME=$(awk -F&#39;,&#39; &#39;<br>          NR&gt;1 {<br>              sum += $2<br>              count++<br>          }<br>          END {<br>              if(count&gt;0)<br>                  print int(sum/count)<br>              else<br>                  print 0<br>          }<br>          &#39; results.jtl)<br><br>          if [ &quot;$TOTAL&quot; -eq 0 ]; then<br>            echo &quot;No samples found.&quot;<br>            exit 1<br>          fi<br><br>          ERROR_PERCENT=$((ERRORS * 100 / TOTAL))<br><br>          echo &quot;--------------------------------&quot;<br>          echo &quot;Performance Summary&quot;<br>          echo &quot;--------------------------------&quot;<br>          echo &quot;Total Requests : $TOTAL&quot;<br>          echo &quot;Failed Requests: $ERRORS&quot;<br>          echo &quot;Error Rate     : ${ERROR_PERCENT}%&quot;<br>          echo &quot;Average Time   : ${AVG_TIME} ms&quot;<br>          echo &quot;--------------------------------&quot;<br><br>          {<br>            echo &quot;## Performance Test Summary&quot;<br>            echo &quot;&quot;<br>            echo &quot;| Metric | Value |&quot;<br>            echo &quot;|--------|------:|&quot;<br>            echo &quot;| Total Requests | $TOTAL |&quot;<br>            echo &quot;| Failed Requests | $ERRORS |&quot;<br>            echo &quot;| Error Rate | ${ERROR_PERCENT}% |&quot;<br>            echo &quot;| Average Response Time | ${AVG_TIME} ms |&quot;<br>          } &gt;&gt; &quot;$GITHUB_STEP_SUMMARY&quot;<br><br>          if [ &quot;$ERROR_PERCENT&quot; -gt &quot;$MAX_ERROR_RATE&quot; ]; then<br>            echo &quot;Performance Quality Gate Failed&quot;<br>            echo &quot;Error Rate exceeded ${MAX_ERROR_RATE}%&quot;<br>            exit 1<br>          fi<br><br>          if [ &quot;$AVG_TIME&quot; -gt &quot;$MAX_AVG_RESPONSE&quot; ]; then<br>            echo &quot;Performance Quality Gate Failed&quot;<br>            echo &quot;Average Response Time exceeded ${MAX_AVG_RESPONSE} ms&quot;<br>            exit 1<br>          fi<br><br>          echo &quot;Performance Quality Gate Passed&quot;<br><br>      ##############################################################<br>      # Upload HTML Report<br>      ##############################################################<br>      - name: Upload HTML Report<br>        if: always()<br>        uses: actions/upload-artifact@v4<br>        with:<br>          name: jmeter-html-report<br>          path: report/<br>          retention-days: 14<br><br>      ##############################################################<br>      # Upload JTL File<br>      ##############################################################<br>      - name: Upload Results<br>        if: always()<br>        uses: actions/upload-artifact@v4<br>        with:<br>          name: jmeter-results<br>          path: results.jtl<br>          retention-days: 14</pre><p>Final structure:</p><pre>.github/<br>└── workflows/<br>    └── performance-test.yml</pre><p>Paste the GitHub Actions YAML workflow into performance-test.yml.</p><p>GitHub automatically detects any YAML files placed inside:</p><pre>.github/workflows/</pre><h3>Step 5: Verify Your Project Structure</h3><pre>jmeter-github-actions/</pre><pre>.github/<br>└── workflows/<br>    └── performance-test.yml</pre><pre>test-plan.jmx</pre><pre>README.md</pre><p>This is all GitHub needs to start running your workflow.</p><h3>Step 6: Check Git Status</h3><p>Open a terminal and run:</p><pre>git status</pre><p>Example output:</p><pre>On branch main</pre><pre>Untracked files:</pre><pre>.github/<br>test-plan.jmx<br>README.md</pre><h3>Step 7: Add the Files</h3><pre>git add .</pre><h3>Step 8: Commit the Changes</h3><pre>git commit -m &quot;Add JMeter performance test workflow&quot;</pre><p>Example output:</p><pre>3 files changed</pre><h3>Step 9: Push to GitHub</h3><pre>git push origin main</pre><p>Once the push completes, GitHub detects the new workflow.</p><h3>Step 10: Workflow Starts Automatically</h3><p>Go to your repository.</p><p>Click:</p><pre>Actions</pre><p>You’ll see something similar to:</p><pre>JMeter Performance Test</pre><pre>Running...</pre><p>GitHub launches a fresh Ubuntu virtual machine, installs Java, downloads JMeter (or restores it from cache), runs test-plan.jmx, generates a performance report, evaluates the quality gates, and uploads the results as artifacts.</p><h3>Step 11: Monitor the Workflow</h3><p>Select the workflow run to see each step:</p><ul><li>Checkout Repository</li><li>Setup Java</li><li>Cache JMeter</li><li>Install JMeter</li><li>Verify JMeter</li><li>Run Performance Test</li><li>Validate Thresholds</li><li>Upload HTML Report</li><li>Upload Results</li></ul><p>Green check marks indicate success.</p><h3>Step 12: View the Performance Summary</h3><p>When the workflow completes, GitHub displays a summary similar to:</p><pre>Performance Test Summary</pre><pre>Total Requests: 600<br>Failed Requests: 0<br>Error Rate: 0%<br>Average Response Time: 75 ms</pre><p>If your configured thresholds are exceeded, the workflow fails and clearly reports why.</p><h3>Step 13: Download the HTML Report</h3><p>At the bottom of the workflow page, open the <strong>Artifacts</strong> section.</p><p>You’ll find:</p><pre>jmeter-html-report</pre><pre>jmeter-results</pre><p>Download <strong>jmeter-html-report</strong>, extract it, and open:</p><pre>index.html</pre><p>in your browser to explore detailed performance metrics, response times, throughput, and error analysis.</p><h3>How the Workflow Works</h3><pre>  <br>Developer  <br>      │</pre><pre>      ▼</pre><pre>Git Commit</pre><pre>      │</pre><pre>      ▼</pre><pre>Git Push</pre><pre>      │</pre><pre>      ▼</pre><pre>GitHub Repository</pre><pre>      │</pre><pre>      ▼</pre><pre>GitHub Actions Trigger</pre><pre>      │</pre><pre>      ▼</pre><pre>Ubuntu Runner</pre><pre>      │</pre><pre>      ▼</pre><pre>Install Java</pre><pre>      │</pre><pre>      ▼</pre><pre>Install/Restore JMeter</pre><pre>      │</pre><pre>      ▼</pre><pre>Run test-plan.jmx</pre><pre>      │</pre><pre>      ▼</pre><pre>Generate HTML Report</pre><pre>      │</pre><pre>      ▼</pre><pre>Validate Performance Thresholds</pre><pre>      │</pre><pre>      ▼</pre><pre>Upload Artifacts</pre><h3>Advantages of GitHub Actions for Performance Testing</h3><ul><li>Automatic execution on every push.</li><li>No need to run JMeter manually.</li><li>Performance regressions are detected early.</li><li>HTML reports are archived with each run.</li><li>Consistent execution environment using GitHub-hosted runners.</li><li>Easy collaboration within development teams.</li><li>Supports CI/CD pipelines.</li></ul><h3>Source Code</h3><p>To make it easier to follow along, I’ve created a complete demo project that includes the Apache JMeter test plan and the GitHub Actions workflow used in this tutorial.</p><p>You can clone the repository and try it yourself:</p><p><strong>GitHub Repository:</strong><br><a href="https://github.com/pavanKumar043/performance-testing-demo">https://github.com/pavanKumar043/performance-testing-demo</a></p><p>Clone the project using:</p><pre>git clone https://github.com/pavanKumar043/performance-testing-demo.git</pre><pre>cd performance-testing-demo</pre><p>After cloning, explore the project files, make any small change, commit your changes, and push them to GitHub. The GitHub Actions workflow will trigger automatically, execute the JMeter performance test, generate the HTML report, validate the configured performance thresholds, and upload the test results as workflow artifacts.</p><h3>Conclusion</h3><p>By combining Apache JMeter with GitHub Actions, you can build a simple yet powerful continuous performance testing pipeline. Every code push automatically runs your JMeter test plan, validates key performance thresholds, and generates downloadable reports. This helps teams identify performance issues early and maintain application quality without manual effort.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8ce68f9f519c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Apache JMeter for Beginners: Installation, Setup, and Running Your First Performance Test]]></title>
            <link>https://medium.com/@pavankumarsayannagari13/apache-jmeter-for-beginners-installation-setup-and-running-your-first-performance-test-d30453f9d9d9?source=rss-3e3c7fa9c4bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/d30453f9d9d9</guid>
            <category><![CDATA[jmeter]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[performance-testing]]></category>
            <category><![CDATA[qa-testing]]></category>
            <category><![CDATA[load-testing]]></category>
            <dc:creator><![CDATA[Pavankumarsayannagari]]></dc:creator>
            <pubDate>Sun, 28 Jun 2026 14:22:54 GMT</pubDate>
            <atom:updated>2026-06-28T14:22:54.652Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>Performance testing plays a critical role in ensuring that applications remain stable and responsive under different levels of user traffic. Whether you’re testing a web application or a REST API, understanding how your application behaves under load helps identify bottlenecks before they affect end users.</p><p>One of the most widely used open-source tools for performance testing is <strong>Apache JMeter</strong>. It is easy to learn, supports multiple protocols, and is trusted by QA engineers and performance testers around the world.</p><p>In this tutorial, I’ll walk through the complete process of installing Apache JMeter, configuring it, creating a simple test plan, running the test, and analyzing the results.</p><p>By the end of this guide, you’ll have a fully functional JMeter environment and your first performance test running successfully.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nyqtHo5uOksoHLzgzKP3Iw.png" /></figure><h3>What You’ll Learn</h3><p>✔ Install Java (JDK)</p><p>✔ Download and configure Apache JMeter</p><p>✔ Verify the installation</p><p>✔ Create your first Test Plan</p><p>✔ Execute a simple HTTP Request</p><p>✔ Analyze the results using JMeter Listeners</p><p>✔ Generate an HTML Performance Report</p><h3>Prerequisites</h3><p>Before starting, make sure you have:</p><ul><li>Windows 10 or Windows 11</li><li>Java JDK 17 or later</li><li>Apache JMeter (latest stable release)</li></ul><h3>Step 1 — Install Java</h3><p>Apache JMeter is a Java-based application, so the first requirement is installing the Java Development Kit (JDK).</p><p>Download and install the latest JDK from Oracle or Eclipse Adoptium.</p><p>After installation, verify Java by opening <strong>Command Prompt</strong> and running:</p><pre>java -version</pre><p>If Java is installed correctly, you’ll see output similar to:</p><pre>java version &quot;17.0.x&quot;</pre><p>You can also verify the compiler by running:</p><pre>javac -version</pre><h3>Step 2 — Download Apache JMeter</h3><p>Visit the Apache JMeter website and download the latest Binary ZIP package.</p><p>After downloading:</p><ol><li>Extract the ZIP file.</li><li>Move it to a convenient location.</li></ol><p>For example:</p><pre>C:\Tools\apache-jmeter-5.6.3</pre><p>Your folder structure should look similar to this:</p><pre>apache-jmeter<br>│<br>├── bin<br>├── docs<br>├── extras<br>├── lib<br>└── licenses</pre><h3>Step 3 — Launch Apache JMeter</h3><p>Open the extracted folder and navigate to:</p><pre>bin</pre><p>Double-click:</p><pre>jmeter.bat</pre><p>Within a few seconds, the Apache JMeter GUI should appear.</p><p>If you can see <strong>Test Plan</strong> in the left navigation panel, congratulations — your installation was successful!</p><h3>Creating Your First Test Plan</h3><p>For this example, we’ll send a simple GET request to:</p><pre>https://test.k6.io</pre><p>This website is commonly used for learning performance testing.</p><h3>Step 4 — Add a Thread Group</h3><p>Every JMeter test begins with a <strong>Thread Group</strong>.</p><p>Navigate to:</p><pre>Test Plan<br>→ Add <br>→ Threads (Users) <br>→ Thread Group</pre><p>Configure the following values:</p><p>Setting : Value</p><p>Number of Threads : 5</p><p>Ramp-Up Period : 5 Seconds</p><p>Loop Count : 2</p><h3>What do these settings mean?</h3><ul><li><strong>5 Threads</strong> represent five virtual users.</li><li><strong>Ramp-Up 5 Seconds</strong> starts one user every second.</li><li><strong>Loop Count 2</strong> means each user executes the request twice.</li></ul><p>Total Requests:</p><pre>5 Users × 2 Loops = 10 Requests</pre><h3>Step 5 — Add an HTTP Request</h3><p>Right-click the Thread Group and select:</p><pre>→ Add<br>→ Sampler<br>→ HTTP Request</pre><p>Configure the request as follows:</p><p>Field : Value</p><p>Protocol : HTTPS</p><p>Server Name : test.k6.io</p><p>Method : GET</p><p>Path : /</p><p>This configuration instructs JMeter to send a GET request to the website’s homepage.</p><h3>Step 6 — Add Listeners</h3><p>Listeners display the execution results of your performance test.</p><p>Add the following listeners:</p><ul><li>View Results Tree</li><li>Summary Report</li><li>Aggregate Report</li></ul><p>These listeners help you inspect requests, responses, and performance metrics.</p><h3>Step 7 — Run the Test</h3><p>Click the <strong>green Start button</strong> in the toolbar.</p><p>JMeter begins executing the configured requests.</p><p>Once the test finishes, open the listeners to analyze the results.</p><h3>Understanding the Results</h3><p><strong>View Results Tree</strong></p><p>The View Results Tree listener allows you to inspect each individual request.</p><p>You can view:</p><ul><li>Request Details</li><li>Response Headers</li><li>Response Body</li><li>HTTP Status Code</li><li>Response Time</li></ul><p>If the response code is <strong>200</strong>, the request was executed successfully.</p><h3>Aggregate Report</h3><p>The Aggregate Report summarizes your entire test execution.</p><p>Key metrics include:</p><p>Metric : Meaning</p><p>Samples : Total Requests</p><p>Average : Average Response Time</p><p>Minimum : Fastest Response</p><p>Maximum : Slowest Response</p><p>Error % : Failed Requests</p><p>Throughput : Requests per Second</p><p>Received KB/sec : Download Speed</p><p>Sent KB/sec : Upload Speed</p><p>This report provides a quick overview of your application’s performance.</p><h3>Summary Report</h3><p>The Summary Report provides another high-level view of your test execution, including:</p><ul><li>Average Response Time</li><li>Throughput</li><li>Standard Deviation</li><li>Error Percentage</li></ul><p>It is especially useful for comparing multiple test executions.</p><h3>Running JMeter in Non-GUI Mode</h3><p>While the GUI is useful for creating and debugging test plans, it is <strong>not recommended</strong> for executing large load tests.</p><p>Instead, use the command line:</p><pre>jmeter -n -t FirstTest.jmx -l result.jtl -e -o report</pre><p>This command:</p><ul><li>Executes the test in Non-GUI mode</li><li>Stores the results</li><li>Automatically generates an HTML Performance Report</li></ul><p>Once execution completes, open:</p><pre>report/index.html</pre><p>You’ll find detailed charts and metrics, including:</p><ul><li>Response Time Trends</li><li>Throughput</li><li>Active Threads</li><li>Percentiles</li><li>Error Summary</li></ul><h3>Best Practices</h3><p>As you begin using JMeter, keep these recommendations in mind:</p><ul><li>Build and debug test plans in the GUI.</li><li>Execute real load tests in Non-GUI mode.</li><li>Add Think Time using Timers to simulate real user behavior.</li><li>Validate responses using Assertions.</li><li>Use CSV Data Set Config for parameterized testing.</li><li>Monitor server CPU, Memory, Disk, and Network during load tests.</li><li>Analyze the HTML dashboard after every execution.</li></ul><h3>Conclusion</h3><p>Apache JMeter is one of the most powerful tools available for performance testing, yet it’s remarkably easy to get started with.</p><p>In this guide, we successfully:</p><ul><li>Installed Java</li><li>Installed Apache JMeter</li><li>Created our first Test Plan</li><li>Executed a simple HTTP request</li><li>Viewed performance metrics</li><li>Generated an HTML Performance Report</li></ul><p>This is just the beginning. As you become more comfortable with JMeter, you can explore advanced features such as API testing, authentication, parameterization, assertions, distributed testing, database performance testing, and real-time monitoring with Grafana and InfluxDB.</p><p>If you found this article helpful, consider leaving a 👏 and following me for more tutorials on Performance Testing, JMeter, k6, Grafana, and InfluxDB.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d30453f9d9d9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Setting Up Real-Time Performance Monitoring with k6, InfluxDB 2.7, and Grafana.]]></title>
            <link>https://medium.com/@pavankumarsayannagari13/setting-up-real-time-performance-monitoring-with-k6-influxdb-2-7-and-grafana-7d0bfb7945e5?source=rss-3e3c7fa9c4bd------2</link>
            <guid isPermaLink="false">https://medium.com/p/7d0bfb7945e5</guid>
            <category><![CDATA[performance-testing]]></category>
            <category><![CDATA[influxdb]]></category>
            <category><![CDATA[performance]]></category>
            <category><![CDATA[grafana]]></category>
            <category><![CDATA[k6-load-testing]]></category>
            <dc:creator><![CDATA[Pavankumarsayannagari]]></dc:creator>
            <pubDate>Sat, 27 Jun 2026 12:45:08 GMT</pubDate>
            <atom:updated>2026-06-27T12:45:08.314Z</atom:updated>
            <content:encoded><![CDATA[<h3>🚀 Setting Up Real-Time Performance Monitoring with k6, InfluxDB 2.7, and Grafana</h3><h3><strong>Introduction :</strong></h3><p>Performance testing becomes much more valuable when you can monitor your test execution in real time instead of waiting for it to finish.</p><p>In this guide, I’ll walk through how I configured <strong>k6</strong>, <strong>InfluxDB 2.7</strong>, and <strong>Grafana</strong> to build a real-time performance monitoring dashboard. Along the way, I’ll also cover the common issues I encountered and how I resolved them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZDy84Ocn1uusYqFi4bVUtg.png" /></figure><h3>Prerequisites</h3><p>Before setting up the real-time monitoring stack, install the following tools.</p><h3><strong>I. Install Go</strong></h3><p>Go is required to build a custom k6 binary using xk6.</p><p><strong>Download</strong></p><ul><li>Windows / Linux / macOS:</li><li><a href="https://go.dev/dl/">https://go.dev/dl/</a></li></ul><p><strong>Installation</strong></p><ol><li>Download the installer for your operating system.</li><li>Install Go using the default settings.</li><li>Restart your terminal.</li></ol><p><strong>Verify Installation</strong></p><pre>go version</pre><p>Example output:</p><pre>go version go1.24.x windows/amd64</pre><h3><strong>II. Install Git</strong></h3><p>Git is required because xk6 downloads the required extensions from GitHub.</p><p><strong>Download</strong></p><p><a href="https://git-scm.com/downloads">https://git-scm.com/downloads</a></p><p><strong>Installation</strong></p><p>During installation, select:</p><pre>Git from the command line and also from 3rd-party software</pre><p>This automatically adds Git to your PATH.</p><p><strong>Verify Installation</strong></p><pre>git --version</pre><p>Example:</p><pre>git version 2.50.x.windows.1</pre><h3><strong>III. Install k6</strong></h3><p>Download the latest k6 release.</p><p><strong>Download</strong></p><p><a href="https://github.com/grafana/k6/releases">https://github.com/grafana/k6/releases</a></p><p>Choose the installer for your operating system.</p><p><strong>Verify Installation</strong></p><pre>k6 version</pre><p>Example:</p><pre>k6 v1.x.x</pre><h3>IV. Install InfluxDB 2.7</h3><p><strong>Download</strong></p><p><a href="https://portal.influxdata.com/downloads/">https://portal.influxdata.com/downloads/</a></p><p>Select:</p><pre>InfluxDB OSS 2.7</pre><p><strong>Install</strong></p><p>Install using the default settings.</p><p>Start InfluxDB.</p><p>Open:</p><pre>http://localhost:8086</pre><p><strong>Initial Setup</strong></p><p>When opening InfluxDB for the first time:</p><p>Create:</p><p>Field : Value</p><p>Username : admin</p><p>Password : ********</p><p>Organization : test</p><p>Bucket : k6</p><p>InfluxDB automatically generates an API Token.</p><p>Copy and save this token because it is required by k6.</p><h3>V. Install Grafana</h3><p><strong>Download</strong></p><p><a href="https://grafana.com/grafana/download">https://grafana.com/grafana/download</a></p><p>Choose:</p><pre>Grafana OSS</pre><p>Install using the default settings.</p><p>Open:</p><pre>http://localhost:3000</pre><p>Default credentials:</p><pre>Username : admin<br>Password : admin</pre><p>Grafana will prompt you to change the password after the first login.</p><h3><strong>Step 1 — Build k6 with InfluxDB Support :</strong></h3><p>InfluxDB 2.x requires the xk6-output-influxdb extension.</p><p>Install xk6:</p><pre>go install go.k6.io/xk6/cmd/xk6@latest</pre><p>Build a new k6 binary:</p><pre>xk6 build --with github.com/grafana/xk6-output-influxdb</pre><p>Output:</p><pre>Build complete<br>Successful build</pre><h3><strong>Step 2 — Configure InfluxDB :</strong></h3><p>My InfluxDB configuration:</p><ul><li>Version: 2.7</li><li>Organization: test</li><li>Bucket: k6</li></ul><p>Set the required environment variables:</p><p>PowerShell:</p><pre>$env:K6_INFLUXDB_ORGANIZATION=&quot;test&quot;<br>$env:K6_INFLUXDB_BUCKET=&quot;k6&quot;<br>$env:K6_INFLUXDB_TOKEN=&quot;&lt;YOUR_TOKEN&gt;&quot;<br>$env:K6_INFLUXDB_ADDR=&quot;http://localhost:8086&quot;</pre><p>Verify InfluxDB is running:</p><pre>curl http://localhost:8086/health</pre><p>Expected response:</p><pre>{<br>  &quot;status&quot;:&quot;pass&quot;<br>}</pre><h3><strong>Step 3 — Create the k6 Test Script :</strong></h3><p>Example API test: File name GetPlans.js</p><pre>import http from &#39;k6/http&#39;;<br>import { check, sleep } from &#39;k6&#39;;<br><br>export const options = {<br>    vus: 10,<br>    duration: &#39;5m&#39;<br>};<br>export default function () {<br>    const res = http.post(<br>        &quot;https://example.com/api&quot;,<br>        JSON.stringify({<br>            id:1<br>        }),<br>        {<br>            headers:{<br>                &quot;Content-Type&quot;:&quot;application/json&quot;<br>            }<br>        }<br>    );<br>    check(res,{<br>        &quot;status is 200&quot;:(r)=&gt;r.status===200<br>    });<br>    sleep(1);<br>}</pre><h3><strong>Step 4 — Execute the Test :</strong></h3><p>Run:</p><pre>k6.exe run -o xk6-influxdb GetPlans.js</pre><p>During execution, k6 continuously pushes metrics to InfluxDB.</p><p>Metrics include:</p><ul><li>http_req_duration</li><li>http_reqs</li><li>http_req_failed</li><li>iterations</li><li>checks</li><li>data_received</li><li>data_sent</li><li>vus</li></ul><p><strong>Step 5 — Verify Metrics in InfluxDB :</strong></p><p>Open:</p><pre>http://localhost:8086</pre><p>Navigate to <strong>Data Explorer</strong>.</p><p>Run:</p><pre>from(bucket:&quot;jmeter&quot;)<br>  |&gt; range(start:-1h)</pre><p>You should see metrics streaming into the bucket.</p><h3><strong>Step 6 — Connect Grafana :</strong></h3><p><strong>Add an InfluxDB datasource:</strong></p><ul><li>URL</li></ul><pre>http://localhost:8086</pre><ul><li>Query Language</li></ul><pre>Flux</pre><ul><li>Organization</li></ul><pre>test</pre><ul><li>Bucket</li></ul><pre>k6</pre><p>Click <strong>Save &amp; Test</strong>.</p><h3><strong>Step 7 — Build the Dashboard :</strong></h3><h3>1. Average Response Time</h3><p><strong>Panel:</strong> Stat</p><pre>from(bucket: &quot;k6&quot;)<br>  |&gt; range(start: v.timeRangeStart, stop: v.timeRangeStop)<br>  |&gt; filter(fn: (r) =&gt; r._measurement == &quot;http_req_duration&quot;)<br>  |&gt; filter(fn: (r) =&gt; r._field == &quot;value&quot;)<br>  |&gt; mean()</pre><h3>2. Maximum Response Time</h3><p><strong>Panel:</strong> Stat</p><pre>from(bucket: &quot;k6&quot;)<br>  |&gt; range(start: v.timeRangeStart, stop: v.timeRangeStop)<br>  |&gt; filter(fn: (r) =&gt; r._measurement == &quot;http_req_duration&quot;)<br>  |&gt; filter(fn: (r) =&gt; r._field == &quot;value&quot;)<br>  |&gt; max()</pre><h3>3. Minimum Response Time</h3><p><strong>Panel:</strong> Stat</p><pre>from(bucket: &quot;k6&quot;)<br>  |&gt; range(start: v.timeRangeStart, stop: v.timeRangeStop)<br>  |&gt; filter(fn: (r) =&gt; r._measurement == &quot;http_req_duration&quot;)<br>  |&gt; filter(fn: (r) =&gt; r._field == &quot;value&quot;)<br>  |&gt; min()</pre><h3>4. Total Requests</h3><p><strong>Panel:</strong> Stat</p><pre>from(bucket: &quot;k6&quot;)<br>  |&gt; range(start: v.timeRangeStart, stop: v.timeRangeStop)<br>  |&gt; filter(fn: (r) =&gt; r._measurement == &quot;http_reqs&quot;)<br>  |&gt; filter(fn: (r) =&gt; r._field == &quot;value&quot;)<br>  |&gt; sum()</pre><h3>5. Requests Per Second (RPS)</h3><p><strong>Panel:</strong> Time Series</p><pre>from(bucket: &quot;k6&quot;)<br>  |&gt; range(start: v.timeRangeStart, stop: v.timeRangeStop)<br>  |&gt; filter(fn: (r) =&gt; r._measurement == &quot;http_reqs&quot;)<br>  |&gt; filter(fn: (r) =&gt; r._field == &quot;value&quot;)<br>  |&gt; aggregateWindow(every: 1s, fn: sum)</pre><h3>6. Requests Per Minute (RPM)</h3><p><strong>Panel:</strong> Time Series</p><pre>from(bucket: &quot;k6&quot;)<br>  |&gt; range(start: v.timeRangeStart, stop: v.timeRangeStop)<br>  |&gt; filter(fn: (r) =&gt; r._measurement == &quot;http_reqs&quot;)<br>  |&gt; filter(fn: (r) =&gt; r._field == &quot;value&quot;)<br>  |&gt; aggregateWindow(every: 1m, fn: sum)</pre><h3>7. Error Rate (%)</h3><p><strong>Panel:</strong> Stat</p><pre>from(bucket: &quot;k6&quot;)<br>  |&gt; range(start: v.timeRangeStart, stop: v.timeRangeStop)<br>  |&gt; filter(fn: (r) =&gt; r._measurement == &quot;http_req_failed&quot;)<br>  |&gt; filter(fn: (r) =&gt; r._field == &quot;value&quot;)<br>  |&gt; mean()<br>  |&gt; map(fn: (r) =&gt; ({ r with _value: r._value * 100.0 }))</pre><p>Set Grafana Unit:</p><pre>Percent (0-100)</pre><h3>8. Active Virtual Users</h3><p><strong>Panel:</strong> Stat</p><pre>from(bucket: &quot;k6&quot;)<br>  |&gt; range(start: v.timeRangeStart, stop: v.timeRangeStop)<br>  |&gt; filter(fn: (r) =&gt; r._measurement == &quot;vus&quot;)<br>  |&gt; filter(fn: (r) =&gt; r._field == &quot;value&quot;)<br>  |&gt; last()</pre><h3>9. Iterations</h3><p><strong>Panel:</strong> Stat</p><pre>from(bucket: &quot;k6&quot;)<br>  |&gt; range(start: v.timeRangeStart, stop: v.timeRangeStop)<br>  |&gt; filter(fn: (r) =&gt; r._measurement == &quot;iterations&quot;)<br>  |&gt; filter(fn: (r) =&gt; r._field == &quot;value&quot;)<br>  |&gt; sum()</pre><h3>10. Data Received</h3><p><strong>Panel:</strong> Stat</p><pre>from(bucket: &quot;k6&quot;)<br>  |&gt; range(start: v.timeRangeStart, stop: v.timeRangeStop)<br>  |&gt; filter(fn: (r) =&gt; r._measurement == &quot;data_received&quot;)<br>  |&gt; filter(fn: (r) =&gt; r._field == &quot;value&quot;)<br>  |&gt; sum()</pre><p>Recommended Unit:</p><pre>bytes (IEC)</pre><h3>11. Data Sent</h3><p><strong>Panel:</strong> Stat</p><pre>from(bucket: &quot;k6&quot;)<br>  |&gt; range(start: v.timeRangeStart, stop: v.timeRangeStop)<br>  |&gt; filter(fn: (r) =&gt; r._measurement == &quot;data_sent&quot;)<br>  |&gt; filter(fn: (r) =&gt; r._field == &quot;value&quot;)<br>  |&gt; sum()</pre><p>Recommended Unit:</p><pre>bytes (IEC)</pre><h3>Bonus Panels</h3><h3>P90 Response Time</h3><pre>from(bucket: &quot;k6&quot;)<br>  |&gt; range(start: v.timeRangeStart, stop: v.timeRangeStop)<br>  |&gt; filter(fn: (r) =&gt; r._measurement == &quot;http_req_duration&quot;)<br>  |&gt; filter(fn: (r) =&gt; r._field == &quot;value&quot;)<br>  |&gt; quantile(q: 0.90)</pre><h3>P95 Response Time</h3><pre>from(bucket: &quot;k6&quot;)<br>  |&gt; range(start: v.timeRangeStart, stop: v.timeRangeStop)<br>  |&gt; filter(fn: (r) =&gt; r._measurement == &quot;http_req_duration&quot;)<br>  |&gt; filter(fn: (r) =&gt; r._field == &quot;value&quot;)<br>  |&gt; quantile(q: 0.95)</pre><h3>P99 Response Time</h3><pre>from(bucket: &quot;k6&quot;)<br>  |&gt; range(start: v.timeRangeStart, stop: v.timeRangeStop)<br>  |&gt; filter(fn: (r) =&gt; r._measurement == &quot;http_req_duration&quot;)<br>  |&gt; filter(fn: (r) =&gt; r._field == &quot;value&quot;)<br>  |&gt; quantile(q: 0.99)</pre><h3>Dashboard Layout</h3><h3>Row 1</h3><ul><li>Active VUs</li><li>Total Requests</li><li>Average Response Time</li><li>Error Rate</li></ul><h3>Row 2</h3><ul><li>Response Time Trend</li><li>Requests Per Second</li></ul><h3>Row 3</h3><ul><li>P90</li><li>P95</li><li>P99</li><li>Iterations</li></ul><h3>Row 4</h3><ul><li>Data Sent</li><li>Data Received</li><li>Requests Per Minute</li></ul><h3><strong>Challenges I Faced :</strong></h3><h3>1. InfluxDB 2.x Doesn’t Work with Standard k6 Output</h3><p>The command:</p><pre>k6 run --out influxdb=http://localhost:8086/k6 script.js</pre><p>works only with InfluxDB 1.x.</p><p>The solution was to build a custom k6 binary using the xk6-output-influxdb extension.</p><h3>2. Git Not Found</h3><p>While building xk6, I encountered:</p><pre>ERR git notfound</pre><p>Installing Git and adding it to the system PATH resolved the issue.</p><h3>3. Missing Bucket Configuration</h3><p>Initially, I received:</p><pre>Bucket option is required</pre><p>This happened because the required InfluxDB environment variables were not set in the active PowerShell session.</p><h3>4. Imported Grafana Dashboard Showed “No Data”</h3><p>The imported dashboard was built for InfluxDB 1.x using InfluxQL, while my setup used InfluxDB 2.7 with Flux.</p><p>Creating panels with Flux queries solved the problem.</p><h3>Conclusion :</h3><p>Integrating k6 with InfluxDB 2.7 and Grafana creates a powerful real-time performance monitoring solution.</p><p>Instead of waiting for test completion, you can observe request rates, response times, failures, and virtual users live as the test executes. Although InfluxDB 2.x requires a custom k6 build with the xk6-output-influxdb extension, the additional setup is straightforward and results in a flexible, production-ready monitoring stack.</p><p>If you’re using k6 for API performance testing, this combination is an excellent way to gain deeper visibility into your load tests.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7d0bfb7945e5" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>