<?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 Rohit Gupta on Medium]]></title>
        <description><![CDATA[Stories by Rohit Gupta on Medium]]></description>
        <link>https://medium.com/@rohit42?source=rss-c1e03e5dbcd0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Gnw_HWxflBEMXGEyTZPiuQ.jpeg</url>
            <title>Stories by Rohit Gupta on Medium</title>
            <link>https://medium.com/@rohit42?source=rss-c1e03e5dbcd0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 15:15:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@rohit42/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[Guide to Secure Authorization with OAuth 2.0]]></title>
            <link>https://rohit42.medium.com/guide-to-secure-authorization-with-oauth-2-0-16bab7be888a?source=rss-c1e03e5dbcd0------2</link>
            <guid isPermaLink="false">https://medium.com/p/16bab7be888a</guid>
            <category><![CDATA[authorization]]></category>
            <category><![CDATA[jwt]]></category>
            <category><![CDATA[api-security]]></category>
            <category><![CDATA[oauth2]]></category>
            <category><![CDATA[guides-and-tutorials]]></category>
            <dc:creator><![CDATA[Rohit Gupta]]></dc:creator>
            <pubDate>Mon, 17 Mar 2025 01:42:33 GMT</pubDate>
            <atom:updated>2025-03-17T01:42:33.677Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Oauth2.0" src="https://cdn-images-1.medium.com/max/1024/0*Kq9azy2qtjT3WnkB.jpeg" /><figcaption>OAuth Authorization Framework</figcaption></figure><h3>What is OAuth?</h3><p>OAuth is an <strong>open standard for access delegation</strong>. It allows a user to grant a third-party application limited access to their resources (e.g., Google Photos, GitHub repositories) without sharing their credentials (username and password). Instead, OAuth uses <strong>tokens</strong> to securely manage access.</p><ul><li><strong>OAuth 1.0</strong>: Launched in 2007, it used a signature-based system. It’s now largely obsolete.</li><li><strong>OAuth 2.0</strong>: Introduced in 2012 via <a href="https://tools.ietf.org/html/rfc6749">RFC 6749</a>, it’s a simpler, more flexible redesign and the focus of this guide.</li></ul><h4>Why Use OAuth?</h4><p>Imagine you want a photo-editing app to access your Google Photos. Without OAuth, you’d share your Google password — risky! OAuth lets you authorize the app to access only your photos, for a limited time, without exposing your credentials.</p><h3>Key Concepts in OAuth 2.0</h3><p>Here are the core components:</p><ol><li><strong>Resource Owner</strong>: The user who owns the data (e.g., you with your Google Photos).</li><li><strong>Client</strong>: The third-party app requesting access. It may include:<br>- <strong>Frontend</strong>: The user interface (e.g., browser, mobile app).<br>- <strong>Backend</strong>: The server handling secure operations.</li><li><strong>Authorization Server</strong>: Authenticates the user and issues tokens (e.g., Google’s OAuth server).</li><li><strong>Resource Server</strong>: Hosts the protected data (e.g., Google Photos API).</li><li><strong>Access Token</strong>: A credential the client uses to access resources.</li><li><strong>Refresh Token</strong>: A long-lived credential to renew access tokens.</li><li><strong>Scope</strong>: Permissions requested (e.g., “read photos”).</li></ol><p>These components interact differently in each OAuth flow, with distinct roles for the frontend and backend.</p><h3>OAuth 2.0 Flows (Grant Types)</h3><p>OAuth 2.0 provides multiple flows for different use cases. Below, we’ll detail each one, explicitly calling out the <strong>frontend</strong> and <strong>backend</strong> roles.</p><h4>1. Authorization Code Flow</h4><p>The <strong>most secure and common flow</strong>, ideal for web apps with both a <strong>frontend</strong> (browser) and a <strong>backend</strong> (server). The backend securely stores a client_secret.</p><p><strong>How It Works:</strong></p><ol><li>The user clicks “Login with Google” on the <strong>frontend</strong>.</li><li>The <strong>frontend</strong> redirects the user to the authorization server with client_id, redirect_uri, and scope.</li><li>The user authenticates and approves the request.</li><li>The server redirects back to the <strong>frontend</strong> with an <strong>authorization code</strong>.</li><li>The <strong>frontend</strong> forwards the code to the <strong>backend</strong>.</li><li>The <strong>backend</strong> exchanges the code and client_secret with the authorization server for an <strong>access token</strong> (and often a <strong>refresh token</strong>).</li><li>The <strong>backend</strong> uses the access token to access the resource server.</li></ol><p><strong>Diagram:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cqHuLruTOpSADJb2.png" /><figcaption>Authorization Code Flow</figcaption></figure><p><strong>When to Use: </strong>Web apps with a server (e.g., Node.js, Django).</p><p><strong>Security Note: </strong>The client_secret ensures only the trusted <strong>backend</strong> can exchange the code for a token.</p><h4>2. Implicit Flow</h4><p>Designed for clients without a <strong>backend</strong>, like single-page apps (SPAs) or mobile apps. The <strong>frontend</strong> handles everything, but it’s less secure.</p><p><strong>How It Works:</strong></p><ol><li>The user clicks “Login with Google” on the <strong>frontend</strong>.</li><li>The <strong>frontend</strong> redirects to the authorization server with client_id, redirect_uri, and scope.</li><li>The user logs in and approves.</li><li>The server redirects back to the <strong>frontend</strong> with an <strong>access token</strong> in the URL fragment (e.g., #access_token=xyz).</li><li>The <strong>frontend</strong> extracts and uses the token to access the resource server.</li></ol><p><strong>Diagram:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*DWf36wrbwj2A3EPA.png" /><figcaption>Implicit Flow</figcaption></figure><p><strong>When to Use: </strong>SPAs (e.g., React) or mobile apps without a backend.</p><p><strong>Security Note: </strong>The token in the URL is vulnerable (e.g., browser history). Use <strong>Authorization Code Flow with PKCE</strong> instead (<a href="https://rohitgupta.xyz/blog/guide-to-secure-authorization-with-oauth2/#pkce-proof-key-for-code-exchange">see below</a>).</p><h4>3. Resource Owner Password Credentials Flow</h4><p>The <strong>frontend</strong> collects the user’s credentials directly. It’s for trusted first-party apps, with no <strong>backend</strong> typically involved.</p><p><strong>How It Works:</strong></p><ol><li>The user enters their username and password in the <strong>frontend</strong>.</li><li>The <strong>frontend</strong> sends these to the authorization server.</li><li>The server returns an <strong>access token</strong> (and possibly a <strong>refresh token</strong>) to the <strong>frontend</strong>.</li><li>The <strong>frontend</strong> uses the token to access the resource server.</li></ol><p><strong>Diagram:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*y2-lBh6xQ2c6Er67.png" /><figcaption>Resource Owner Password Credentials Flow</figcaption></figure><p><strong>When to Use: </strong>Trusted first-party apps (e.g., a company’s mobile app).</p><p><strong>Security Note: </strong>Avoid this flow unless necessary — it exposes credentials to the <strong>frontend</strong>.</p><h4>4. Client Credentials Flow</h4><p>For <strong>server-to-server</strong> communication, where only the <strong>backend</strong> is involved — no <strong>frontend</strong> or user interaction.</p><p><strong>How It Works:</strong></p><ol><li>The <strong>backend</strong> sends its client_id and client_secret to the authorization server.</li><li>The server issues an <strong>access token</strong> to the <strong>backend</strong>.</li><li>The <strong>backend</strong> uses the token to access the resource server.</li></ol><p><strong>Diagram:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CMYsQ3lXe2-cY9tI.png" /><figcaption>Client Credentials Flow</figcaption></figure><p><strong>When to Use: </strong>Machine-to-machine tasks (e.g., a cron job accessing an API).</p><h3>Understanding Tokens</h3><p>Tokens are the heart of OAuth 2.0:</p><p><strong>Access Token</strong></p><ul><li><strong>Purpose:</strong> Accesses resources.</li><li><strong>Lifetime:</strong> Short (e.g., 1 hour).</li><li><strong>Format:</strong> Opaque string or <strong>JWT</strong> (see <a href="https://rohitgupta.xyz/blog/guide-to-secure-authorization-with-oauth2/#jwt-json-web-tokens">JWT section</a>).</li></ul><p><strong>Refresh Token</strong></p><ul><li><strong>Purpose:</strong> Renews access tokens without re-authentication.</li><li><strong>Lifetime:</strong> Long (e.g., months).</li><li><strong>Usage:</strong> Sent by the <strong>backend</strong> (or <strong>frontend</strong> in some flows) to the authorization server.</li></ul><p><strong>Example Refresh Request:</strong></p><pre>POST /token HTTP/1.1<br>Host: authorization-server.com<br>Content-Type: application/x-www-form-urlencoded</pre><pre>grant_type=refresh_token&amp;refresh_token=&lt;refresh_token&gt;&amp;client_id=&lt;client_id&gt;&amp;client_secret=&lt;client_secret&gt;</pre><p><strong>Response:</strong></p><pre>{<br>  &quot;access_token&quot;: &quot;new-access-token&quot;,<br>  &quot;expires_in&quot;: 3600,<br>  &quot;refresh_token&quot;: &quot;new-refresh-token&quot; // Optional<br>}</pre><h3>Token Revocation</h3><p>Revoke tokens when they’re no longer needed (e.g., logout, security breach).</p><h4>How It Works:</h4><ol><li>The <strong>backend</strong> (or <strong>frontend</strong> in frontend-only flows) sends a revocation request to the authorization server.</li><li>The server invalidates the token.</li></ol><p><strong>Example:</strong></p><pre>POST /revoke HTTP/1.1<br>Host: authorization-server.com<br>Content-Type: application/x-www-form-urlencoded</pre><pre>token=&lt;access_token&gt;&amp;token_type_hint=access_token&amp;client_id=&lt;client_id&gt;&amp;client_secret=&lt;client_secret&gt;</pre><p><strong>When to Use: </strong>Logout or token compromise.</p><h3>Logging Out a Client</h3><p>OAuth 2.0 doesn’t natively support logout since tokens are stateless. Here’s how to handle it:</p><ol><li><strong>Revoke Tokens: </strong>The <strong>backend</strong> (or <strong>frontend</strong>) revokes access and refresh tokens.</li><li><strong>Short-lived Tokens: </strong>Use brief access token lifetimes (e.g., 5 minutes).</li><li><strong>Session Management: </strong>Use <strong>OpenID Connect</strong> (see <a href="https://rohitgupta.xyz/blog/guide-to-secure-authorization-with-oauth2/#additional-nearby-concepts">below</a>) for session-based logout.</li></ol><h4>Example:</h4><ul><li>User clicks “Logout” on the <strong>frontend</strong>.</li><li>The <strong>frontend</strong> notifies the <strong>backend</strong>.</li><li>The <strong>backend</strong> revokes tokens via the revocation endpoint.</li></ul><h3>Advanced Concepts</h3><h4>PKCE (Proof Key for Code Exchange)</h4><p>Enhances security for public clients (e.g., SPAs, mobile apps) in the Authorization Code Flow. Only the <strong>frontend</strong> is involved.</p><p><strong>How It Works:</strong></p><ol><li>The <strong>frontend</strong> generates a code_verifier and hashes it into a code_challenge.</li><li>The <strong>frontend</strong> sends the code_challenge with the authorization request.</li><li>After receiving the code, the <strong>frontend</strong> sends the code_verifier to get a token.</li><li>The server verifies the match.</li></ol><p><strong>Diagram:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*eZvG-Rv5Nw20X26e.png" /><figcaption>Proof Key for Code Exchange Flow</figcaption></figure><p><strong>When to Use: </strong>Public clients instead of Implicit Flow (<a href="https://tools.ietf.org/html/rfc7636">RFC 7636</a>).</p><h4>JWT (JSON Web Tokens)</h4><p>Access tokens can be JWTs, with three parts: <strong>Header</strong>, <strong>Payload</strong>, <strong>Signature</strong>.</p><p><strong>Example:</strong></p><pre>eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiZXhwIjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c</pre><p><strong>Benefits: </strong>Self-contained and verifiable (<a href="https://tools.ietf.org/html/rfc7519">RFC 7519</a>).</p><h3>Best Practices</h3><ol><li><strong>Use HTTPS:</strong> Encrypt all requests.</li><li><strong>Minimal Scopes:</strong> Request only necessary permissions.</li><li><strong>Short-lived Tokens:</strong> Limit exposure.</li><li><strong>Secure Storage:</strong> Store tokens securely (e.g., backend database, not browser storage).</li><li><strong>PKCE for Public Clients:</strong> Always use it.</li></ol><h3>Common Pitfalls</h3><ol><li><strong>OAuth as Authentication:</strong> Use OpenID Connect for identity.</li><li><strong>Insecure Storage:</strong> Avoid URL parameters or local storage.</li><li><strong>Ignoring Expiration:</strong> Handle it gracefully.</li></ol><h3>Putting It All Together</h3><p><strong>Example (Authorization Code Flow):</strong></p><ol><li>User clicks “Login” on the <strong>frontend</strong>.</li><li><strong>Frontend</strong> redirects to Google’s auth endpoint.</li><li>User approves, gets a code.</li><li><strong>Backend</strong> exchanges code for tokens.</li><li><strong>Backend</strong> fetches resources.</li></ol><h3>Additional Nearby Concepts</h3><p>Here are more concepts to enrich our understanding:</p><ol><li><strong>OpenID Connect (OIDC): </strong>Extends OAuth 2.0 for authentication with an <strong>ID token</strong>. <a href="https://openid.net/specs/openid-connect-core-1_0.html">Specification</a>.</li><li><strong>Token Introspection: </strong>Validates tokens via the authorization server (<a href="https://tools.ietf.org/html/rfc7662">RFC 7662</a>).</li><li><strong>Bearer Tokens: </strong>Sent in headers (e.g., Authorization: Bearer &lt;token&gt;) (<a href="https://tools.ietf.org/html/rfc6750">RFC 6750</a>).</li><li><strong>State Parameter: </strong>Prevents CSRF by tying requests to sessions (<a href="https://tools.ietf.org/html/draft-ietf-oauth-security-topics-16">Security Best Practices</a>).</li><li><strong>Client Registration: </strong>How clients get credentials (<a href="https://tools.ietf.org/html/rfc7591">RFC 7591</a>).</li><li><strong>OAuth 2.1: </strong>An upcoming update consolidating best practices (e.g., deprecating Implicit Flow) (<a href="https://datatracker.ietf.org/doc/html/draft-ietf-oauth-v2-1-01">Draft RFC</a>).</li><li><strong>SAML vs. OAuth: </strong>SAML is for authentication; OAuth is for authorization.</li><li><strong>Federated Identity: </strong>Using OAuth/OIDC across providers (e.g. “Login with Google”).</li></ol><h3>Conclusion</h3><p>OAuth 2.0 is a versatile authorization framework. We’ve explored:</p><ul><li>Core concepts and flows, with explicit frontend/backend roles.</li><li>Token management and security.</li><li>Advanced features like PKCE and JWTs.</li><li>Nearby topics like OIDC and introspection.</li></ul><p>For most apps, start with the <strong>Authorization Code Flow</strong> (with PKCE for public clients), to secure tokens, and explore <a href="https://openid.net/connect/">OpenID Connect</a> for authentication.</p><blockquote><em>If you liked this story, click the👏 below so that more people will see it here on Medium.</em></blockquote><blockquote><em>Stay in touch,<br></em><a href="http://x.com/_guptarohit"><em>x.com/_guptarohit</em></a><em><br></em><a href="https://www.linkedin.com/in/rohitgupta111/"><em>linkedin.com/in/rohitgupta111</em></a><em><br></em><a href="https://blog.rohitgupta.xyz/"><em>blog.rohitgupta.xyz</em></a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=16bab7be888a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Demystifying PGP Signing: A Practical Guide to Keys, Signatures, and Encryption]]></title>
            <link>https://rohit42.medium.com/demystifying-pgp-signing-a-practical-guide-to-keys-signatures-and-encryption-1b558e9135b7?source=rss-c1e03e5dbcd0------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b558e9135b7</guid>
            <category><![CDATA[pgp]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[privacy]]></category>
            <category><![CDATA[gpg]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Rohit Gupta]]></dc:creator>
            <pubDate>Sat, 22 Feb 2025 13:52:51 GMT</pubDate>
            <atom:updated>2025-02-22T13:52:51.610Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GHGfHFa2uLMZJK7zRqm-Uw.png" /></figure><h3>Introduction: Why Digital Signatures Matter</h3><p>Imagine a world where anyone could impersonate you in emails, tamper with your code, or access sensitive files — all because your digital identity lacked verification. This isn’t a dystopian fantasy; it’s the reality we navigate daily. GPG/PGP isn’t just a relic of the 1990s — it’s your shield in an era of phishing, supply chain attacks, and data breaches.</p><p>Whether you’re a developer safeguarding Git commits, a privacy-conscious user encrypting emails, or a sysadmin hardening SSH access, this guide will help you in utilizing gpg in practice. Let’s dive in. GPG enables you to:</p><ul><li><strong>Sign Git commits/tags</strong> to prove authorship.</li><li><strong>Encrypt sensitive files</strong> for secure sharing.</li><li><strong>Authenticate SSH connections</strong> without passwords.</li><li><strong>Verify email integrity</strong> to combat spoofing.</li></ul><p>Without these safeguards, you risk impersonation, unauthorised code changes, and data breaches.</p><h3>Core Concepts: PGP vs. GPG</h3><ul><li><strong>PGP (Pretty Good Privacy):</strong> The original encryption software (1991), now a proprietary tool.</li><li><strong>OpenPGP:</strong> The open standard (RFC 4880) defining encryption protocols.</li><li><strong>GPG (GNU Privacy Guard):</strong> A free, open-source implementation of OpenPGP.</li></ul><p><strong>Key Takeaway:</strong><br>GPG is the tool you’ll use today; OpenPGP is the standard it follows.</p><h3>Key Anatomy: Master Keys and Subkeys</h3><h4><strong>Master Key</strong></h4><ul><li>Purpose: Signs off on your subkeys (like a root certificate authority). It’s the root of trust for your entire PGP setup.</li><li>Storage: Stash it offline for Fort Knox-level security. Ideally, on a USB drive in a safe. Seriously.</li></ul><h4><strong>Subkeys</strong></h4><ul><li><strong>Signing (S):</strong> Stamps Git commits/files as legit. This subkey is used to prove authorship.</li><li><strong>Encryption (E):</strong> Locks down your data. Use this subkey for encrypting emails and files.</li><li><strong>Authentication (A):</strong> Kicks passwords to the curb for SSH. This subkey is used for SSH authentication.</li></ul><p><em>Real-World Analogy:</em> Your master key is like a building’s master key — losing it means rekeying every lock. Subkeys are individual office keys that can be changed without disrupting the whole system. Subkeys allow you to compartmentalize your security. If a subkey is compromised, you can revoke it without affecting your master key.</p><p><strong>Example Key Listing:</strong> If you run gpg --list-keys, you’ll see something like this:</p><pre>pub   rsa4096 2022-02-09 [SC] [expires: 2026-02-06]<br>      CDD387F08A49C8DF...<br>uid           [ultimate] Rohit Gupta &lt;rohit@rohitgupta.xyz&gt;<br>sub   rsa4096 2022-02-09 [E] [expires: 2026-02-06]<br>sub   rsa4096 2022-02-14 [S] [expires: 2026-02-06]</pre><p>BTW, my PGP key (fingerprint 5DBF 0FBE A729 F335) is available on the <a href="https://keyserver.ubuntu.com/pks/lookup?search=5dbf0fbea729f335&amp;fingerprint=on&amp;op=index">Ubuntu Keyserver</a> and can be directly downloaded from <a href="https://rohitgupta.xyz/pgpkey.asc">here</a>.</p><h3>Setup Guide: Installation and Key Creation</h3><h4>Install GPG</h4><p><strong>macOS:</strong></p><pre>brew install gnupg pinentry-mac  <br>mkdir -p ~/.gnupg  <br>echo &quot;pinentry-program $(which pinentry-mac)&quot; &gt;&gt; ~/.gnupg/gpg-agent.conf</pre><p><em>Why the </em><em>pinentry-mac?</em> This provides a graphical interface for entering your passphrase, which is much more user-friendly than the default terminal prompt.</p><p><strong>Linux:</strong></p><pre>sudo apt install gnupg2 pinentry-curses  # Debian/Ubuntu</pre><p><strong>Windows:</strong> Use <a href="https://www.gpg4win.org/">Gpg4win</a>.</p><h4>Generate Keys</h4><pre>gpg --full-generate-key<br># Follow prompts for RSA 4096, 2-year expiration, and a strong passphrase</pre><ul><li><em>RSA vs. ECC?</em> RSA is the older, more established algorithm. ECC (Elliptic Curve Cryptography) is newer and generally considered more secure for the same key size, but compatibility might be an issue with older systems. Sticking with RSA 4096 is generally a safe bet.</li><li><em>Expiration Date:</em> Set a reasonable expiration date (e.g., 2 years). You can always extend it later. This forces you to review your keys periodically.</li><li><em>Passphrase:</em> <strong>USE A STRONG PASSPHRASE!</strong> This is the key to your entire PGP setup. Use a password manager to generate and store a strong, unique passphrase.</li></ul><h4>Add Subkeys</h4><pre>gpg --edit-key YOUR_KEY_ID  <br>gpg&gt; addkey  # Repeat for Signing (S), Encryption (E), Authentication (A)<br>gpg&gt; save</pre><h3>Practical Use Cases</h3><h4>Case 1: Git Commit Signing</h4><p><strong>Configure Git</strong>:</p><pre>git config --global user.signingkey YOUR_SIGNING_SUBKEY_ID  <br>git config --global commit.gpgsign true</pre><p><em>Make sure </em><em>user.signingkey is set to your signing subkey ID, not your master key ID.</em></p><p><strong>Sign a Commit</strong>:</p><pre>git commit -S -m &quot;Add secure login feature&quot;</pre><p><strong>Verify Signatures:</strong></p><pre>git log --show-signature</pre><p>GitHub will show verified badge on the signed commits.</p><h4>Case 2: Encrypted File Sharing</h4><p><strong>Encrypt for a recipient:</strong></p><pre>gpg --encrypt --recipient bob@example.com secret-document.pdf</pre><p><em>You’ll need Bob’s public key for this to work.</em></p><p><strong>Decrypt</strong>:</p><pre>gpg --output secret-document.pdf --decrypt secret-document.pdf.gpg</pre><h4>Case 3: Passwordless SSH Authentication</h4><p><strong>Link GPG to SSH:</strong></p><pre>echo &quot;enable-ssh-support&quot; &gt;&gt; ~/.gnupg/gpg-agent.conf<br>gpg --export-ssh-key YOUR_AUTH_SUBKEY_ID &gt;&gt; ~/.ssh/authorized_keys</pre><p><strong>Connect securely:</strong></p><pre>ssh user@server</pre><h3>Key Management Strategies</h3><h4>Publish Public Keys</h4><p>Upload to a keyserver:</p><pre>gpg --keyserver keys.openpgp.org --send-keys YOUR_KEY_ID</pre><p><em>Keyservers are public databases of PGP keys. Uploading your key makes it easier for others to find and use it.</em></p><p>Export for direct sharing:</p><pre>gpg --export -a YOUR_KEY_ID &gt; public-key.asc</pre><p><em>This exports your public key to a file that you can share directly with others.</em></p><h4>Backup</h4><p>Export subkeys (exclude master key):</p><pre>gpg --export-secret-subkeys -a YOUR_KEY_ID &gt; subkeys.asc</pre><h4>Revocation</h4><p>Generate revocation cert upfront:</p><pre>gpg --gen-revoke YOUR_KEY_ID &gt; revocation.cert</pre><p><em>A revocation certificate allows you to invalidate your key if it’s compromised. Store this certificate securely.</em></p><p>If laptop stolen:</p><pre>gpg --import revocation.cert  # Instantly invalidates key</pre><h4>Key Rotation</h4><p>Update expiration dates proactively:</p><pre>gpg --quick-set-expire YOUR_KEY_ID 2y</pre><p>Note: After any changes to keys make sure you pulish it keys to the keyserver</p><h3>Troubleshooting Common Issues</h3><h4>“No Pinentry” Error (macOS/Linux)</h4><p>Reset the GPG agent:</p><pre>gpgconf --kill gpg-agent  <br>export GPG_TTY=$(tty)</pre><h4>Expired Key</h4><p>Extend the expiration date:</p><pre>gpg --edit-key YOUR_KEY_ID  <br>gpg&gt; expire<br># Set new date  <br>gpg&gt; save</pre><h4>Git Signing Failures</h4><p>Ensure your Git email matches your GPG UID:</p><pre>git config user.email &quot;alice@example.com&quot;</pre><h3>Conclusion: Take Control of Your Digital Identity</h3><p>PGP/GPG isn’t just for the security nerds — it’s a must-have for anyone who touches code, handles sensitive data, or logs into remote systems. Go sign your next Git commit, encrypt a file for a colleague, or set up SSH authentication. It’s time to get secure!</p><blockquote>If you liked this story, click the👏 below so that more people will see it here on Medium.</blockquote><blockquote>Stay in touch,<br><a href="http://x.com/_guptarohit">x.com/_guptarohit</a><br><a href="https://www.linkedin.com/in/rohitgupta111/">linkedin.com/in/rohitgupta111</a><br><a href="https://blog.rohitgupta.xyz/">blog.rohitgupta.xyz</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b558e9135b7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Keeping python code clean with pre-commit hooks: black, flake8 and isort]]></title>
            <link>https://medium.com/staqu-dev-logs/keeping-python-code-clean-with-pre-commit-hooks-black-flake8-and-isort-cac8b01e0ea1?source=rss-c1e03e5dbcd0------2</link>
            <guid isPermaLink="false">https://medium.com/p/cac8b01e0ea1</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[codeformatter]]></category>
            <category><![CDATA[code-quality]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Rohit Gupta]]></dc:creator>
            <pubDate>Wed, 20 Nov 2019 05:20:08 GMT</pubDate>
            <atom:updated>2024-10-08T12:30:55.080Z</atom:updated>
            <content:encoded><![CDATA[<h4>Automate code formatting tasks with the pre-commit framework</h4><figure><img alt="Python code snippet." src="https://cdn-images-1.medium.com/max/1024/1*XXI-kg18liPn4XcfZmoqQQ.jpeg" /><figcaption>Python code snippet photo by <a href="https://unsplash.com/@cdr6934">Chris Ried</a> on <a href="https://unsplash.com/">Unsplash</a></figcaption></figure><p>At a fast-paced startup, where many commits are pushed frequently across various projects and multiple merge requests are created daily, reviewing them and maintaining code quality standards like code compliance with PEP8 all at the same time is a huge challenge.</p><p>Making peeps correct their code format or telling them to make changes to follow the pep8 standard is irritating for both.</p><p>Sometimes comments on merge requests may sound very nitpicky, like “<em>can you please put two blank lines between two function definition?</em>”, “<em>can you please remove extra spaces?</em>”, “<em>can you please fix imports in place on top?</em>”.</p><p>We can delegate this task to tools for maintaining code formatting and styling. So, instead of humans correcting the linting mistakes, we let the tool report devs for their errors. And the “tool” here is the <strong><em>pre-commit hooks</em></strong><em>.</em> Also, it let us <a href="https://dzone.com/articles/fail-fast-principle-in-software-development"><em>fail fast</em></a> in the software development cycle.</p><h3><strong>Workflow with pre-commit hooks</strong></h3><p>When I commit staged Python files, before committing pre-commit hooks are executed - <strong>isort</strong> sorts imports then <strong>black</strong> formats the code and at last <strong>flake8</strong> checks code compliance with PEP8. If every check passes, the commit is made else, code is automatically formatted and sent back for review. I then just review the changes made (and perform any other changes if required) and commit again.<br>So, less time is spent on code formatting and more on code logic &amp; implementation.</p><p>In this blog post, I’ll discuss how I set up the pre-commit hooks’ pipeline using the <a href="https://github.com/pre-commit/pre-commit">pre-commit framework</a>.</p><p>First I’ll describe in brief the tool/utility used in the pipeline:</p><ul><li><strong>isort</strong> — sorts all your imports!</li><li><strong>seed-isort-config</strong> — populates the known_third_party of isort setting</li><li><strong>black</strong> — The Uncompromising Code Formatter</li><li><strong>flake8</strong> — a wrapper around PyFlakes, pycodestyle and Ned Batchelder’s McCabe script</li></ul><p>When all hooks combined in the pipeline the workflow look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*zEyQac8rhvayY-2p5DeUHg.png" /><figcaption>pre-commit hooks pipeline for checking python files</figcaption></figure><p>First, we’ll set up the pre-commit framework then add isort, black, and flake8 in the pipeline.</p><blockquote>Note: All dot or config files mentioned below should be placed in the root directory of the project.</blockquote><h4><strong>The pre-commit framework</strong></h4><p>Recently, I came to know about the pre-commit framework for managing &amp; maintaining multi-language pre-commit git hooks. This framework itself is written in python and comes along with some pre-commit <a href="https://pre-commit.com/hooks.html">hooks</a> out of the box. It is configured with a YAML file.</p><p>Perform the following steps to install it:</p><ul><li>Install pre-commit pip install pre-commit .</li><li>Add pre-commit to requirements.txt or Pipfile.</li><li>Create .pre-commit-config.yaml with hooks needed in the pipeline.</li><li>At last, execute pre-commit install this will install git hooks in .git/ directory of the project.</li></ul><p>In .pre-commit-config.yaml, we define the source (repo) from where the hooks will be downloaded, some high-level options and hooks from each source. Below is a sample .pre-commit-config.yaml file that I used in one of the projects.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b77fc65a775824c32025390a95da1faa/href">https://medium.com/media/b77fc65a775824c32025390a95da1faa/href</a></iframe><p>Now, we’ll discuss all hooks added in the pipeline one-by-one with its config.</p><h4>isort: sorts imports</h4><p>This sorts all the imports in a python file alphabetically and automatically separated into sections. Manually keeping imports sorted alphabetically is tedious when you have so many imports, like in views of Django projects one may have multiple import statements for internal or external packages.</p><p>Along with isort we used <strong><em>seed-isort-config</em></strong> hook which statically populates the known_third_part parameter for the isort configuration setting, which otherwise we’ll manually need to populate. Automate everything!<br>Here’s a sample .isort.cfg file for configuring isort that I used:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/49bfcd10c94ae529857e1eb0b0fcb1a2/href">https://medium.com/media/49bfcd10c94ae529857e1eb0b0fcb1a2/href</a></iframe><h4>Black: the code formatter</h4><p><em>Black</em> is an uncompromising Python code formatter. I’ve been using it for a long time even without pre-commit hooks, it’s super nice!</p><blockquote><a href="https://github.com/django/deps/blob/master/accepted/0008-black.rst">DEP 0008</a> (‘Formatting Code with Black’) was accepted by the Django board. Which proposes to enforce code formatting with <a href="https://github.com/psf/black">Black</a> in Django.</blockquote><p>With <em>Black,</em> we get code formatted with PEP 8 compliance, plus some other style choices that the Black team sees as helpful for making maintainable code. Some notable style choices by black are:</p><ul><li>Unlike in PEP8, characters per line is 88, not 79.</li><li>Use of double-quotes than single-quotes in strings.</li><li>If there are many function arguments, each argument will be <a href="https://github.com/psf/black#how-black-wraps-lines">wrapped per line</a>.</li></ul><p>One can always override the default styling choices, Black uses pyproject.toml as a configuration file, which is <a href="https://www.python.org/dev/peps/pep-0518/">PEP 518</a> standard.</p><p>Here’s my pyproject.toml file for configuring black:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d92e19d832ee5510afafab9f1e6886b3/href">https://medium.com/media/d92e19d832ee5510afafab9f1e6886b3/href</a></iframe><p>Black formats only python files, for other languages you can give a try to <a href="https://github.com/prettier/prettier">prettier</a> used by <a href="https://github.com/prettier/prettier/network/dependents?package_id=UGFja2FnZS00OTAwMTEyNTI%3D">over million</a> projects on GitHub itself.</p><h4>flake8: code style checker</h4><p><a href="https://github.com/PyCQA/flake8">flake8</a> is a wrapper around <a href="http://www.blog.pythonlibrary.org/2012/06/13/pyflakes-the-passive-checker-of-python-programs/">PyFlakes</a>, <a href="https://pypi.org/project/pycodestyle/">pycodestyle</a> and Ned Batchelder’s <a href="https://pypi.org/project/mccabe/">McCabe script</a> for checking cyclomatic complexity. For black to work along with flake8 we need to keep some configs in sync, like max-line-length and also need to mention some error &amp; warning codes to ignore in the configuration file (.flake8). The error/warning may be from <a href="http://flake8.pycqa.org/en/latest/user/error-codes.html">PyFlake error codes</a> or <a href="https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes">pycodestyle error codes</a> list.<br>I used the following .flake8 configuration:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/03c7070ee99494e1c49d258648cd9ba3/href">https://medium.com/media/03c7070ee99494e1c49d258648cd9ba3/href</a></iframe><p>When added all the above config we good to go! Also, when added these configs to an existing project you may want to format code base for the start, so for that, you just need to run pre-commit run --all-files. ✌️</p><h3>Conclusion</h3><p>In this story, I discussed how we can automate the workflow of formatting wrongly formatted python code by creating pre-commit hooks pipeline with various tools/utilities. Though here I was specific with python language, you can use the same steps for <a href="https://pre-commit.com/#supported-languages">other languages</a> by using appropriate linting utility hook for that language. Setting up pre-commit is fairly easy for the team when all configurations are there in the project, they just need to run pre-commit install! Also, it’s better to have these checks also in CI (Continuous Integration) pipeline, because one can always skip these pre-commit checks by passing the flag --no-verify while committing.</p><h3>Resources</h3><ul><li><a href="https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks">https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks</a></li><li><a href="https://githooks.com/">https://githooks.com</a></li><li><a href="https://medium.com/python-pandemonium/what-is-flake8-and-why-we-should-use-it-b89bd78073f2">https://medium.com/python-pandemonium/what-is-flake8-and-why-we-should-use-it-b89bd78073f2</a></li><li><a href="https://www.mattlayman.com/blog/2018/python-code-black/">https://www.mattlayman.com/blog/2018/python-code-black/</a></li></ul><blockquote><em>If you liked this story, click the👏 below so that more people will see it here on Medium.</em></blockquote><blockquote>Stay in touch,<br><a href="http://x.com/_guptarohit">x.com/_guptarohit</a><br><a href="https://www.linkedin.com/in/rohitgupta111/">linkedin.com/in/rohitgupta111</a><br><a href="https://blog.rohitgupta.xyz/">blog.rohitgupta.xyz</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cac8b01e0ea1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/staqu-dev-logs/keeping-python-code-clean-with-pre-commit-hooks-black-flake8-and-isort-cac8b01e0ea1">Keeping python code clean with pre-commit hooks: black, flake8 and isort</a> was originally published in <a href="https://medium.com/staqu-dev-logs">Staqu Dev Logs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Optimizations: Tuning Nginx for better RPS of an HTTP API]]></title>
            <link>https://medium.com/staqu-dev-logs/optimizations-tuning-nginx-for-better-rps-of-an-http-api-de2a0919744a?source=rss-c1e03e5dbcd0------2</link>
            <guid isPermaLink="false">https://medium.com/p/de2a0919744a</guid>
            <category><![CDATA[benchmark]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[flask]]></category>
            <category><![CDATA[optimization]]></category>
            <category><![CDATA[nginx]]></category>
            <dc:creator><![CDATA[Rohit Gupta]]></dc:creator>
            <pubDate>Wed, 31 Jul 2019 12:38:31 GMT</pubDate>
            <atom:updated>2024-10-08T12:29:56.777Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*uv_sf68597xphmFkMz5yug.png" /><figcaption>Nginx Logo</figcaption></figure><p>For a startup, before scaling infrastructure either horizontally or vertically we need to make sure that current resources are being used properly, and there is no bottleneck in performance due to the application configuration. The primary aim of the engineering team is to ensure that minimal resources are used in the day to day running of any system designed and deployed.</p><p>We had faced a similar issue where our deployed system was being used to serve over a million users on a daily basis with spurts of users coming in a sporadic manner. This meant that only deploying multiple servers or scaling them wouldn’t be an optimal solution.</p><p>This blog post is about tuning Nginx to improve performance <em>i.e.</em> to increase RPS (requests/sec) of an HTTP API. Here, I have tried to talk about the optimizations that we made to the deployed system so that it can handle tens of thousands of requests per second without having to incur a huge cost overhead.</p><h4><strong>Scenario</strong>: We needed to run an HTTP API (written in Python using flask) proxy passed with Nginx, and high throughput was needed. Also, the content of API will change at the interval of one day.</h4><blockquote><strong>optimization</strong><br>/ɒptɪmʌɪˈzeɪʃ(ə)n/<br>:noun:<br>the action of making the best or most effective use of a situation or resource.</blockquote><p>We used the <a href="http://supervisord.org/">supervisor</a> to run <a href="https://www.fullstackpython.com/wsgi-servers.html">WSGI Server</a> with the following configurations:</p><ul><li><a href="https://gunicorn.org/">Gunicorn</a> with <a href="https://github.com/mopemope/meinheld">Meinheld</a> workers</li><li>Number of Workers: CPU Count * 2 + 1</li><li>Bind to Unix socket instead of IP, it’s slightly <a href="https://blog.myhro.info/2017/01/benchmarking-ip-and-unix-domain-sockets-for-real">faster</a>.</li></ul><p>So finally, the supervisor command looked something like this:</p><pre>gunicorn api:app --workers=5 --worker-class=meinheld.gmeinheld.MeinheldWorker --bind=unix:api.sock</pre><p>We tried optimizing Nginx config(s) and tested what worked best for us.</p><p>And, to benchmark the API we used <a href="https://github.com/wg/wrk"><strong>wrk</strong></a> with the following command:</p><pre>wrk -t20 -c200 -d20s http://api.endpoint/resource</pre><h4>Default configuration</h4><p>First, we load tested the API without any changes and got the following stats:</p><pre>Running 20s test @ http://api.endpoint/resource<br>  20 threads and 200 connections<br>  Thread Stats   Avg      Stdev     Max   +/- Stdev<br>    Latency   192.48ms  274.78ms   1.97s    87.18%<br>    Req/Sec    85.57     29.20   202.00     72.83%<br>  33329 requests in 20.03s, 29.59MB read<br>  Socket errors: connect 0, read 0, write 0, timeout 85<br>Requests/sec:   1663.71<br>Transfer/sec:      1.48MB</pre><h4>Default config update</h4><p>Let’s update default config of Nginx i.e. nginx.conf at /etc/nginx/nginx.conf</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4ebeb21beb075e721a63ad4b639f0a05/href">https://medium.com/media/4ebeb21beb075e721a63ad4b639f0a05/href</a></iframe><p>After the changes in the Nginx configuration(s), we should run the config test</p><pre>sudo nginx -t</pre><p>If the test is successful we are good to restart Nginx, to see the changes</p><pre>sudo service nginx restart</pre><p>With this much of configuration, we load tested the API and got the following result:</p><pre>Running 20s test @ http://api.endpoint/resource<br>  20 threads and 200 connections<br>  Thread Stats   Avg      Stdev     Max   +/- Stdev<br>    Latency   145.80ms  237.97ms   1.95s    89.51%<br>    Req/Sec   107.99     41.34   202.00     66.09%<br>  42898 requests in 20.03s, 39.03MB read<br>  Socket errors: connect 0, read 0, write 0, timeout 46<br>  Non-2xx or 3xx responses: 2<br>Requests/sec:   2141.48<br>Transfer/sec:      1.95MB</pre><p>These configurations reduced timeouts and increased RPS (requests per second) but not much.</p><h4>Adding Nginx cache</h4><p>Since, in our case, the content of the endpoint will be refreshed at the interval of one day, this looks good situation to cache the API response.</p><p>But, with caching comes its invalidation… one of the <a href="https://martinfowler.com/bliki/TwoHardThings.html">two</a> hard things.</p><blockquote>There are only two hard things in Computer Science: cache invalidation and naming things.</blockquote><blockquote>— Phil Karlton</blockquote><p>We opt the minimal solution of purging the cache directory with a cronjob, after content updated in the downstream system.</p><p>So further all the heavy lifting will be done by the Nginx, so now we gotta make sure Nginx is supercharged…</p><p>To add caching in Nginx we would need to add few directives in our Nginx app’s configuration file.<br>Before that we need to create a directory to store the cache data:</p><pre>sudo mkdir -p /data/nginx/cache</pre><p>Changes in Nginx app’s configuration:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/af0e0f29fa0667f6c0ab21829b406426/href">https://medium.com/media/af0e0f29fa0667f6c0ab21829b406426/href</a></iframe><p>With this change in configuration, we load tested the API and got the following result:</p><pre>Running 20s test @ http://api.endpoint/resource<br>  20 threads and 200 connections<br>  Thread Stats   Avg      Stdev     Max   +/- Stdev<br>    Latency     6.88ms    5.44ms  88.91ms   81.36%<br>    Req/Sec     1.59k   500.04     2.95k    62.50%<br>  634405 requests in 20.06s, 589.86MB read<br>Requests/sec:  31624.93<br>Transfer/sec:     29.40MB</pre><p>So we got nearly about <strong>19x</strong> performance boost by adding caching.</p><h4>Nginx cache in RAM</h4><p>Let’s go one step further, currently, our cache data is being stored on the disk what if we store that data in the RAM, in our case response data is limited and doesn’t have large response size.</p><p>So first, we need to create a directory where ram cache will be mounted.</p><pre>sudo mkdir -p /data/nginx/ramcache</pre><p>To mount the created directory in RAM with <a href="https://wiki.archlinux.org/index.php/Tmpfs">tmpfs</a> use following command:</p><pre>sudo mount -t tmpfs -o size=256M tmpfs /data/nginx/ramcache</pre><p>This mounts /data/nginx/ramcache in RAM allocating 256mb.</p><p>If you feel you want to unmount, simply:</p><pre>sudo umount /data/nginx/ramcache</pre><p>And to re-create cache directory into RAM automatically after the reboot, we need to update the/etc/fstab. Add the following line into it:</p><pre>tmpfs /data/nginx/ramcache tmpfs defaults,size=256M 0 0</pre><p><em>Note</em>: we also need to update the value of proxy_cache_path with the ramcache directory (/data/nginx/ramcache).<br>After updating the configuration, we load tested the API again and got the following result:</p><pre>Running 20s test @ http://api.endpoint/resource<br>  20 threads and 200 connections<br>  Thread Stats   Avg      Stdev     Max   +/- Stdev<br>    Latency     5.57ms    5.69ms 277.76ms   92.94%<br>    Req/Sec     1.98k   403.94     4.55k    71.77%<br>  789306 requests in 20.04s, 733.89MB read<br>Requests/sec:  39387.13<br>Transfer/sec:     36.62MB</pre><p>Storing cache in ram gave significant improvement almost <strong>23x</strong>.</p><h4>Buffered access logging</h4><p>We store the access log of proxy passed application, we can store the log first in the buffer and write to the disk only:</p><ul><li>if the next logline does not fit into the buffer</li><li>if the buffered data is older than specified by the flush parameter</li></ul><p>This will reduce the frequent writes happening with every request. To do this we simply need to add buffer and flush parameters with the appropriate value in access_log directive:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/464c3ab7b6f87792947be39be0795a37/href">https://medium.com/media/464c3ab7b6f87792947be39be0795a37/href</a></iframe><p>So as per the above config, initially access logs will be written to the buffer and will be written to the disk only when the buffer size reaches 256 KB or the buffered data become older than 10 seconds.<br><em>Note</em>: Here <em>combined</em> is the <a href="http://nginx.org/en/docs/http/ngx_http_log_module.html#log_format"><em>log_format</em></a> name.</p><p>After performing load testing again, we got the following result:</p><pre>Running 20s test @ http://api.endpoint/resource<br>  20 threads and 200 connections<br>  Thread Stats   Avg      Stdev     Max   +/- Stdev<br>    Latency     4.21ms    3.19ms  84.83ms   83.84%<br>    Req/Sec     2.53k   379.87     6.02k    77.05%<br>  1009771 requests in 20.03s, 849.31MB read<br>Requests/sec:  50413.44<br>Transfer/sec:     42.40MB</pre><p>This has significantly increased the RPS about <strong>30x</strong> from the initial stage.</p><h3>Conclusion</h3><p>In this blog post, we discussed the process of optimizing Nginx config(s) to improve RPS. The RPS (requests/second) was increased from 1663 to ~50413 (<strong>~ 30x increase</strong>) and this provided us high throughput.<br>Tuning default settings can improve the performance of a system, we’ll end this post with a quote;</p><blockquote>Make It Work. Make It Right. Make It Fast.<br>― <strong>Kent Beck</strong></blockquote><h3>Resources</h3><ul><li><a href="https://docs.nginx.com/nginx/admin-guide/">https://docs.nginx.com/nginx/admin-guide/</a></li><li><a href="https://www.nginx.com/blog/tuning-nginx/">https://www.nginx.com/blog/tuning-nginx/</a></li><li><a href="https://github.com/wg/wrk/wiki/installing-wrk-on-linux">https://github.com/wg/wrk/wiki/installing-wrk-on-linux</a></li><li><a href="https://kb.virtubox.net/knowledgebase/improve-nginx-cache-performance-with-tmpfs/">https://kb.virtubox.net/knowledgebase/improve-nginx-cache-performance-with-tmpfs/</a></li></ul><blockquote>If you liked this story, click the👏 below so that more people will see it here on Medium.</blockquote><blockquote>Stay in touch,<br><a href="http://x.com/_guptarohit">x.com/_guptarohit</a><br><a href="https://www.linkedin.com/in/rohitgupta111/">linkedin.com/in/rohitgupta111<br></a><a href="https://blog.rohitgupta.xyz/">blog.rohitgupta.xyz</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=de2a0919744a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/staqu-dev-logs/optimizations-tuning-nginx-for-better-rps-of-an-http-api-de2a0919744a">Optimizations: Tuning Nginx for better RPS of an HTTP API</a> was originally published in <a href="https://medium.com/staqu-dev-logs">Staqu Dev Logs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>