You can spot this pattern without a profiler. The site responds. One process grows through the day. The server kills it. Someone restarts it. The site settles down, then the climb starts again. The first suggestion is usually simple: add memory or rewrite the service that happened to be running. Both cost money before anyone has named the action that keeps the memory.

I see this next to slow queries all the time, but they are not the same problem. A query can be slow and still release memory when it finishes. A process can be fast and still keep a little more after every job until the machine runs out. Buying memory makes sense when the process returns to its normal size and the remaining size is real work. It is only a delay when the site currently survives because people restart it.

1. Write down the shape before you touch the box

Three facts often get merged into one sentence: “we need more RAM.” Split them apart. Write the process name. Write whether a restart is what brought the site back. Write how long the quiet period lasted. A process that grows for an hour and then gets killed is not the same incident as one large request that ends and disappears. A restart that helps until lunch points to a climb. A restart that changes nothing points somewhere else.

Write the process name, not “the server.” A PHP request usually ends and gives memory back, so this symptom often lives in what stays up: a queue worker, a Node process, a scheduler, anything long-running that the team started and stopped thinking about. If you do not know which process the killer is hitting, you are about to buy memory for the whole machine because one process behaves badly.

Watch this on a copy. On the live site you learn the size only when the process is already dead, and you learn it in front of customers. A copy with realistic data volume is enough. An empty database hides both a heavy read and a leak because there is nothing substantial to hold. If production is the only running environment, say that clearly and take a restore before you test. Testing is not the same thing as buying hardware.

2. Repeat one action and watch the size come back

Pick one action. Use one page a person opens, or one job the worker runs. Note the process size before the action. Run it. Note the peak. Then wait until the process is idle and note the size again. Repeat that twenty times. You are looking for a step pattern, not a chart that looks dramatic in a meeting.

If the size rises during the action and drops back after the action ends, the action is heavy. It held a large set and then released it. That can still break a request, but it is not a leak. The fix is to stop holding the whole set at once: narrower reads, streaming, limits. More memory only lets a larger set succeed once while the same shape stays in place.

If the size steps up and stays up after the work is finished, something still holds it. Twenty repeats make the staircase obvious. Common causes are simple: a cache that only grows, a list that keeps appending, a client opened per job and never closed, a buffer or log data kept on a long-lived object. The restart “fixes” this because it throws away the staircase. The next repeat starts building it again.

You do not need a week of dashboards to see this. You need a baseline, a peak, and an after number for one repeated action. If the size drifts with no link to that action, you picked the wrong action or the wrong process. That is still useful. Rename the note. Do not turn weak evidence into a hardware recommendation.

3. Where the climb usually sits

A normal PHP request is a poor place to look for an overnight leak because the request ends and the memory usually goes with it. Check the processes that outlive a request before you spend a day profiling one controller. Queue workers and Node processes are the usual suspects. Teams also add them when they try to make a slow click feel faster, which is why a memory climb often appears next to a performance fix.

A request can still be the heavy action. The classic case is a loop that pulls rows into the process, one query at a time or one huge list, and keeps them until the response is built. That shows up in time as well as memory. Read it first as a query problem. How to group the slow log, and why a loop of statements is easy to undercount, is in reading the slow log before you split the service. Do not rename that work as a memory purchase. If the size drops back after the response, you do not have a leak. You have a read that holds too much, and the next tool is the log.

If the size does not drop back, stay with the long-running process. A worker that stores a result “for next time” in a map with no limit can look healthy at request twenty and dead at request twenty thousand. A Node process that keeps a buffer, a socket, or a growing array across jobs does the same. The boundary for when work should leave the request, and when a retry must not repeat a side effect, is a separate decision covered in when a Node process belongs beside Laravel. A queue does not solve a map that never forgets. It only gives that map a process to live in.

4. What more memory does not buy

It does not name the action. It only moves the kill later. On a quiet product that can look like a cure for weeks, until the staircase reaches the new ceiling. On a busier product it can look like a cure until tomorrow afternoon. In both cases you changed the clock, not the step.

It does not justify a service rewrite either. The staircase is often a small retention inside a process you intended to keep: the cache, the client opened per job and never closed, the array that keeps growing for a report nobody reads. A new service that copies those objects copies the same staircase. Split the service when the deployment boundary is the real reason. Do not split it just because a process died and the unit file name looked awkward in the incident report.

It also does not replace a proper copy. Adding memory on the live machine and then guessing while customers wait is how the next kill happens during the guess. Take the restore. Repeat the action. Write the three numbers. Then decide whether the remaining size, after the process has released what it can, is actually too large for the machine. That remaining size is the only honest argument for a larger box.

5. An order you can repeat the next time a restart "fixes" it

Name the process the killer is hitting. Confirm that a restart is what recovered the site, and write how long the quiet lasted. Restore a copy with real rows. Pick one action. Record size before, peak, and after, twenty times. If the size falls back, treat it as a heavy read and move to the queries. If it steps up and stays there, find the object that outlives the action: the cache with no limit, the client opened per job, the array that only grows. Fix that. Measure the same twenty runs again. Only then talk about machine size.

Keep the note next to the incident in words an on-call person can follow at night. “Restart it” turns this into a ritual. The three numbers turn it into a change. If the action is a page a person waits on, that page still needs its own timing work. Memory that comes back can still mean a slow response. Those are two lines in the same note, not one purchase.

When to ask for a second look

You can name the process and run the twenty repeats without outside help. Ask for a second look when the size stays up and you still cannot see what holds it, when the climb sits in a worker you are afraid to restart because it also sends mail or charges cards, or when production is the only environment and the copy does not exist yet.

That is the work I take on: find out whether the process gives memory back on the system you already run, and change the retention before anyone resizes the machine. Services cover that kind of production performance work. Selected work keeps each result next to the operation that produced it, instead of turning one incident into a story about the whole platform. Memory that climbs until the machine runs out of it needs performance and scalability: the process that holds it, the retention that keeps it, and the reason to resize only after that. If you want the second look, write to me. Send the process name, the action you repeated, and whether the size came back down. The keys to the system stay with you.