
A bigger hosting plan is the most expensive way to fix a slow app that was never slow because of hosting.
When a JavaScript web app starts to drag, most owners reach for more RAM, more CPU cores, or a move from shared hosting to a VPS. Sometimes that works. Just as often, the bill goes up and the app stays slow, because the real bottleneck is in the code.
The good news is that hosting problems and code problems leave different clues. With a few free tools and about an hour of testing, you can tell which one you have before you spend money on the wrong fix.
Start With Time to First Byte
Time to First Byte (TTFB) is how long a browser waits between asking for a page and getting the first piece of the answer back. Google’s web.dev guidance on TTFB treats 0.8 seconds or less as a good score for most sites.
TTFB is useful because it sits right on the line between your host and your code. A slow network, a busy server, or a far-away data center all push it up. So does an app that runs five database lookups before it sends anything.
To split the two, run this simple comparison:
- Request a static file from your server, such as robots.txt or a small image. A static file is one the server sends as-is, without running any of your app’s code.
- Request a dynamic page or API route that your app builds on the fly.
- Compare the TTFB of each from two or three test locations. WebPageTest, a free testing tool, lets you pick the city the test runs from.
If the static file is also slow, the delay happens before your code ever runs. That points at the host, the network, or distance. If the static file is fast but the dynamic route is slow, your app is doing slow work before it responds.
[Image suggestion: a simple flowchart. “Is the static file slow?” Yes → check your host. No → check your code.]
Alt text: Flowchart showing how to use a static file test to decide whether a slow JavaScript app has a hosting problem or a code problem
Signs the Problem Is Your Host
Some slowdowns really are the server’s fault. These are the most common patterns:
- Static files are slow too. If a plain text file takes over a second to arrive, no amount of code tuning will help.
- Speed changes by time of day. On shared hosting, other sites on the same machine compete for CPU and disk. If your app is fine at 3 a.m. and sluggish at 2 p.m., these “noisy neighbors” are a likely cause.
- High steal time on a VPS. Run the top command and look at the st value. Steal time is processing power your virtual server wanted but the physical machine gave to someone else. If it stays above a few percent, the host has packed too many customers onto that machine.
- Your app keeps restarting. PM2 is a popular tool that keeps Node.js apps running. If its logs show frequent restarts, the app may be hitting the memory limit on your plan.
- Users are far from the server. A server in Virginia serving visitors in Sydney adds a few hundred milliseconds to every request. A content delivery network (CDN) stores copies of your files closer to users and fixes this faster than any code change.
- Cold starts on serverless. Serverless platforms like AWS Lambda shut down your code when nobody is using it. The first visitor after a quiet stretch waits while it boots back up, which can add a second or more. Paid “always warm” settings or a scheduled ping every few minutes reduce this.
If two or more of these match what you see, an upgrade or a move to a better-located host is likely money well spent.
Signs the Problem Is Your Code
Node.js, the most common way to run JavaScript on a server, handles your code on a single main thread. Think of it as one checkout lane that moves very fast. It works well for lots of small requests, but one slow customer holds up everyone behind them.
These are the code problems that show up most often:
- A blocked event loop. The event loop is that single checkout lane. Some commands, like fs.readFileSync or bcrypt.hashSync, make it stop and wait until they finish. The Node.js team explains this in its guide, Don’t Block the Event Loop. The clue is that the whole app freezes while one heavy request runs.
- Too many database trips. Developers call this the “N+1 problem.” A page that loads 50 orders and then looks up each order’s customer one at a time makes 51 trips to the database instead of 2. It feels fine with test data and falls over with real data.
- Missing indexes. An index works like the index at the back of a book, so the database can jump straight to the right rows. Without one, a lookup that is quick on 1,000 rows crawls on 1,000,000.
- No caching. If every visitor triggers the same expensive lookup, saving the result for even a minute can cut response times sharply. Redis is a common tool for this.
- Heavy front-end files. Sometimes the server is fast and the browser is the slow part. Importing a whole code library to use two of its functions can push your JavaScript files past a megabyte. Free tools like webpack-bundle-analyzer show exactly what is taking up space.
One detail catches many teams off guard. A single Node.js process only uses one CPU core, so moving from a 2-core server to an 8-core server does nothing on its own. The app has to run in PM2’s cluster mode or a similar setup to use the extra cores.
A One-Hour Test to Tell Them Apart
If the signs above don’t give a clear answer, a short round of testing usually will:
- Load test two routes. A load test sends many fake visitors at once. Use a free tool like k6 or autocannon on a static route and a dynamic route. If only the dynamic route falls apart, look at the code.
- Watch the server while you test. Keep top or htop open. All cores busy and memory near the limit point to a capacity problem. One core at 100% while the rest sit idle points to a blocked event loop.
- Profile the app. Profiling records where your code spends its time. Start Node with the –inspect flag and record a profile in Chrome DevTools, or use the free tool Clinic.js.
- Check the database. Turn on the slow query log in MySQL or the pg_stat_statements extension in PostgreSQL. Both list the queries that take the longest.
- Run Lighthouse on mobile settings. Lighthouse is Google’s free page audit tool, built into Chrome. If the server responds quickly but Lighthouse scores are poor, the work to do is in the front end.
Write down the numbers before you change anything. That baseline is the only way to prove a fix worked.
[Image suggestion: a two-column table. Left column “Points to your host”: slow static files, high steal time, slow at peak hours, far-away users. Right column “Points to your code”: one core maxed, slow only on dynamic routes, slow database queries, large JavaScript files.]
Alt text: Comparison table of warning signs that point to a hosting problem versus a code problem in a JavaScript web app
When More Hosting Is the Right Fix
An upgrade makes sense when your tests show real capacity limits. That means steady traffic growth, all CPU cores busy in cluster mode, or users spread across regions your current server can’t reach quickly.
At that point, match the plan to the problem:
- VPS or dedicated server if you need full control over Node versions and server settings. HostAdvice’s guide on how to host a Node.js server walks through the setup.
- Platform as a Service (PaaS) if you’d rather not manage the server yourself and can accept less control.
- CDN or edge hosting for images, scripts, and pages that look the same for every visitor.
Before you buy, confirm the plan lets you run more than one Node process. A bigger server that only runs one process repeats the single-core trap.
When the Fix Is in the Code
If your tests point to a blocked event loop, too many database trips, or oversized files, the fix is a code change. More RAM won’t unblock a checkout lane, and a faster disk won’t turn 51 database trips into 2.
This is where many small businesses get stuck. The app may have been built by an agency that has moved on, or by a founder who no longer has time to maintain it. Someone has to read the profiling results, find the slow function, and fix it without breaking anything else.
For teams without that skill in-house, finding JavaScript developers who have run Node.js apps in production, and not only built website features, is often the fastest path to a real fix. Debugging a server under heavy traffic is a different skill from building buttons and forms.
A few interview questions help separate the two:
- How would you find out whether the event loop is blocked?
- Tell me about a memory leak you tracked down. What tool did you use?
- How would you fix a page that makes one database query per row?
Candidates who answer with specific tools and steps have likely done this work before.
Fix the Right Problem First
A slow JavaScript app is rarely a mystery once you measure it. Compare a static file against a dynamic route, watch the CPU while you load test, and profile before you change anything.
If the host is the bottleneck, upgrade with a clear reason. If the code is the bottleneck, put the budget into fixing it. Either way, you stop paying for fixes that don’t move the numbers.
