Ask
129

cron ping every 4 minutes to stay warm, or just run a container for 1,400 req/day Cold Start

Small B2B tool, 1,400 requests a day, extremely bursty - almost all of it between 09:00 and 11:00 on weekdays and then nothing. Cold start is about 1.4s and customers notice it, because the person who opens the app at 08:55 is always the same person and she has told me twice.

Current plan is a scheduled job hitting a /health endpoint every 4 minutes during business hours. It feels like a hack. The alternative is a small always-on container for about $7/month.

Is the ping approach ever the right answer or is it just deferred embarrassment?

9 answers Share
Report

Answering anonymously — a moderator will review it first.

  • @two_vcpu_club · 3w ago

    Check whether your platform has a minimum instances setting before building anything. It is the supported version of what you are trying to fake, it keeps N instances alive rather than one, and it is usually priced as "you are paying for an always-on instance" - which is the same money as the container with none of the migration. If it exists, use it. If it does not, take the container.

    88
    Share
    Reply

    Answering anonymously — a moderator will review it first.

    Report
  • @adjunct_ora · 3w ago · 3 replies

    The ping keeps one instance warm. Your traffic is bursty, so at 09:02 when eleven people arrive at once the platform spins up ten more instances and ten of those requests eat the full 1.4s anyway. You will have paid for 4,000 extra invocations a month to fix the experience of exactly one user, which admittedly is the one who complains.

    For 1,400 requests a day the container is the honest answer. It is $7, there is no cold start to reason about, and you can stop thinking about this permanently. Warming tricks earn their keep when traffic is high enough that a warm pool actually absorbs the burst, and yours is not.

    114
    Share
    Reply

    Answering anonymously — a moderator will review it first.

    Report
    • @adjunct_ora · 3w ago

      It is the most common misreading of warming, and it is understandable because it does fix the demo you run yourself at 08:55. One request from you finds the warm instance; eleven simultaneous requests do not.

      55
      Share
      Reply

      Answering anonymously — a moderator will review it first.

      Report
    • @cast_iron_carl · 2w ago

      The point about the 09:02 burst is the one that lands. I was picturing one warm instance serving the morning and that is not how any of this works.

      43
      Share
      Reply

      Answering anonymously — a moderator will review it first.

      Report
  • @listening_lane · 3w ago

    If you do go with the ping, make the health endpoint touch the same things a real request touches - the database connection especially. A /health that returns {ok:true} without opening a connection keeps the runtime warm and leaves the 400ms of connection setup on the first real request, which is most of what she is feeling.

    44
    Share
    Reply

    Answering anonymously — a moderator will review it first.

    Report
  • @flashcard_fen · 3w ago · 2 replies

    Third option nobody mentions: make the cold start not matter for the person at 08:55. If the first thing she loads is a dashboard, prerender the shell and stream the data in, so the 1.4s happens behind a page that is already on screen instead of in front of a white one. We took a 1.6s cold start from "customers complain" to "nobody has mentioned it in a year" without making it any faster.

    61
    Share
    Reply

    Answering anonymously — a moderator will review it first.

    Report
    • @cast_iron_carl · 3w ago

      This is probably the right answer for the app regardless of what I do about hosting. She is not timing anything, she is looking at a white page and deciding it is broken.

      30
      Share
      Reply

      Answering anonymously — a moderator will review it first.

      Report
  • @printbed_gremlin · 3w ago

    Been running the ping approach for two years on a similar profile and it has been fine. One scheduled job, three lines, never thought about it again. I would not build it today over a $7 container, but "deferred embarrassment" is a bit strong for something that has quietly worked for 24 months.

    33
    Share
    Reply

    Answering anonymously — a moderator will review it first.

    Report
  • @pivot_pilot · 3w ago

    The real finding here is that you have one user with a stopwatch and she is worth more than any monitoring you could buy.

    21
    Share
    Reply

    Answering anonymously — a moderator will review it first.

    Report