Skip to main content
GullySystem
A practical guide

Application slow only at peak hours: what that pattern points to

Ganesh HSStrategy and Technology, GullySystem
Practical advice · 4 min read

In this guide 6 sections
The short answer

Slowness that appears only when everyone is logged in usually comes from contention, not weak hardware. Common causes are lock waits, an exhausted connection pool, a scheduled job at midday or one heavy customer. Each leaves different evidence, so measure before buying a bigger server.

Why the pattern matters more than the speed

A system that is quick in the morning has no basic fault, because its code and query plans are acceptable at low load. Something shared runs out when more people arrive. Your task is to find what.

That shared thing might be database connections, row locks, memory, a disk queue or a single worker. Find which limit is hit first.

Write down when the slowness starts and stops, to the minute, for a full week of working days. A start at exactly noon points to a scheduled task. A gradual slide through the morning points to a pool, a cache or memory.

Lock waits: users queuing behind one write

When one transaction holds a lock on a row, every other user who needs that row must wait. A long invoice posting, or a stock update inside a transaction that was left open, can freeze a screen for every cashier at the counter.

In PostgreSQL, query pg_stat_activity and look for sessions waiting on a Lock event. In MySQL, read the InnoDB status. Note which table keeps showing up.

The usual cure is a shorter transaction. Do the slow work, such as a PDF or an email, after the commit.

  • Sessions waiting on a lock while CPU stays low
  • One table named again and again in the waits
  • Transactions left open for many seconds
  • A user who holds a screen open mid-edit

An exhausted connection pool looks like a hang

Applications borrow database connections from a small pool. If the pool holds twenty and twenty requests are slow, the twenty-first waits for a free connection. The page seems dead while the server shows little load.

Check the pool metrics: connections in use, requests waiting, time spent waiting. If waiting climbs while the database itself sits idle, the pool is your bottleneck.

Raising the pool size can backfire. The database then fights over its own memory. Ask first why connections are held so long, because a leak, where code never hands a connection back after an error, is a common cause.

A shared job at noon, or one heavy tenant

Read the scheduler. A report email, a sync with the accounts package or a backup that starts at twelve will compete with the lunchtime rush for the same database. Moving it to two in the morning costs nothing.

In a multi-tenant product, one large customer can slow everyone else, usually through a report or an import that scans a huge table. Group the slow query log by tenant id. If one account fills most of the lines, you have your culprit.

A rate limit, a separate queue for that tenant, or its own database may fix it. All three cost less than doubling the whole fleet.

  • Cron entries and queue schedules near the slow hour
  • Backups, exports and imports running on the live database
  • Slow queries grouped by tenant or branch
  • Reports opened by many users at once

Measure first, then change one thing

Set up basic monitoring before touching the system. You need response time per page, pool use, lock waits, CPU and memory, drawn on one shared timeline with the busy hour marked. Cause and effect then line up.

Change one thing at a time. Watch the next peak. Three changes at once teach you nothing about which worked.

Consider a bigger server only when the evidence points at raw CPU or memory. By then you can say how much bigger it must be, and why.

Peak hour diagnosis log

Log sheet, one page long, with a row for each slow episode. Columns: date, start and end time, pages affected, pool use, longest lock wait, jobs running, heaviest tenant, suspected cause, the one change made and what the next peak showed.

Open a blank worksheet to print

Questions owners ask

Does slow only at peak mean we need more servers?

Not necessarily. More servers help only when CPU or memory is the limit. If the cause is a lock or a small pool, extra machines simply wait in the same queue.

What tools do I need to see lock waits?

Your database already holds them. PostgreSQL has pg_stat_activity and MySQL has performance_schema. A dashboard tool such as Grafana can draw them over time.

Can I find the problem without a load test?

Often, yes. Logs and metrics from a real busy day show the cause. A load test helps once you have a fix and want proof that it holds.

Browse all guidesBack to top ↑
Next step

Have a specific situation to work through?

This article covers the general case. Tell us what you’re actually dealing with and we’ll respond directly.

Share Your Requirements