HubSpot Engineering

Latest posts

Writing lately

Application Warmup URLs

A split log among burning wood, with the words “to warm up”.

The HubSpot Dev Team is constantly coming up with really small, but really helpful patterns for building web applications. One of the most flexible and powerful items has been the application warmup URL.

The story of the warmup URL goes back a few years to when we were starting to build out a deploy system for our code. We decided to run most applications on two or more identical EC2 instances and put a load balancer in front of them. It was easy to take a server off the load balancer and deploy new code. But when you shifted traffic back to that server, the first request was slow. Because the applications get requests at all times of day the first request was often a customer and the slowness was a bad user experience.

We investigated the slow requests and found that the intial lag was from the database connection pool setup. Once the connections were made and the pool set up, subsequent requests were performant. No amount of lazy-loading or multi-threading would be able to shorten this necessary step.

We quickly came up with the idea of a warmup URL with an action to execute a database query. The warmup URL is called from the deploy script, and the response is checked for a "success string". The success string tells us that the connection pool and query have completed and that the server is ready to start handling real requests. During a deploy we only return traffic to the server after the warmup URL is successful. If we get an error response, or no response, we stop the deploy and alert the developer.

Additionally, the warmup URLs have been useful for external monitoring. Once the app is up and running there is almost no overhead in hitting the warmup URL. Pointing Nagios or Pingdom at it allows us to have a constant health check on the application.

Do you have any simple or quick patterns that make your web applications awesome?

Newsletter

For Agents

View Markdown

Share

More posts

Aviator: HubSpot's Agent Harness

Aviator is the Java agent harness behind Breeze Assistant and agents across HubSpot. It runs the agent loop, works with any model, scales to thousands of tools, and gives agents skills and a sandboxed computer.

It's Never a Hardware Bug, Until It Is.

Most software developers have heard the maxim, “it’s never a compiler bug,” and its companion, “it’s never a hardware bug.” But if you investigate enough bugs, you’ll eventually find an exception to this rule, and that’s what we found recently at HubSpot.

Unlocking Deep Research for 250,000+ Businesses: How HubSpot Used MCP to Engineer the First Third-Party CRM Connector for ChatGPT

Discover how HubSpot built a remote MCP server to integrate ChatGPT, enhancing AI capabilities without local setup complexities.