BlogsShopifyWebserver Connection Handling and Request Dropping

Webserver Connection Handling and Request Dropping

Webserver Connection Handling and Request Dropping

2
posts
2013–2025

This feature thread tracks the development and enhancement of webserver connection handling and request dropping mechanisms to improve application resilience under high load. Initial efforts focused on addressing the problem of web applications rendering requests for disconnected clients, particularly during traffic surges like flash sales. This post details a patch for the Unicorn webserver that checks client connection status before application rendering, effectively dropping requests from dis. This post details the creation of a gamified treadmill experience that rewards runners with in-store credit, integrated with a custom POS UI extension for seamless redemption. The system involves hardware (manual treadmill, sensors, receipt printer, displays, server) and software components (Python script for FTMS data, Remix app for game logic and state management, POS UI extension for discount application). Key technical challenges included real-time pace detection, normalization of irregular sensor data, and secure discount redemption via a custom POS extension.

2025

Run for your money: Engineering a treadmill that prints store credit (2025) - Shopify

11/25/2025

This post details the engineering effort behind a gamified treadmill experience that rewards runners with in-store credit, integrated with a custom POS UI extension. It covers the hardware setup (manual treadmill, Runn sensor, TrueForm Trainer, POS hardware, receipt printer, displays, server), software architecture (Python script for FTMS data, Remix app for game logic and state management, POS UI extension for discount application), and the logic for translating runner pace into earned credit. It also describes the state machine for game control and the process of printing receipts with scannable barcodes for discount redemption. The POS UI extension handles fetching user data, adding customers to the cart, and applying discounts.

2013

What Does Your Webserver Do When a User Hits Refresh? - Shopify

3/19/2013

This post introduces a patch for the Unicorn webserver that adds a `check_client_connection` option. This feature allows Unicorn to test the client connection by attempting to write a small amount of data (an 'H' character) to the socket before invoking the application. If the write fails, indicating a disconnected client, the request is dropped, saving application server resources. This directly addresses the issue of wasted rendering time for clients that have already disconnected, particularly during high-traffic events like flash sales, and helps mitigate the occurrence of HTTP 499 responses logged by Nginx.