DEV Community

Cover image for Best practices for moving off shared hosting as your traffic grows
binadit
binadit

Posted on • Originally published at binadit.com

Best practices for moving off shared hosting as your traffic grows

Shared hosting will silently throttle you before it ever throws an error

Here's the thing about shared hosting: it doesn't fail loudly. It caps your CPU time, memory, and process count, then quietly throttles you until checkout starts timing out during your biggest sales day. If you're running a SaaS app, a WooCommerce store, or a content platform and traffic is climbing, this is the point where "it's a bit slow" turns into a support ticket queue.

You don't need to migrate this afternoon. You need to know which signals to watch and which fixes to make in what order. Here's the practical version.

Watch the ceilings, not just the uptime dashboard

Uptime monitoring won't catch this. PHP-FPM pool exhaustion, memory_limit hits, and process count creeping toward the cap will, weeks before anything actually breaks. Instrument these first.

Pull the database out early

On shared hosting your DB fights your web processes for the same disk I/O and RAM. Moving it to its own instance, even a small one, kills a huge chunk of your unpredictable latency.

# Example: dedicated managed PostgreSQL connection
DB_HOST=db-primary.internal
DB_PORT=5432
DB_POOL_MAX=25
DB_POOL_MIN=5
Enter fullscreen mode Exit fullscreen mode

Add a connection pooler before you're forced to

max_connections limits under load produce failures that look like app bugs but are actually infra bugs. PgBouncer or ProxySQL absorbs the spikes without a full database upgrade.

Cache reads before you touch anything else

Redis or Memcached in front of your DB is the highest-leverage, lowest-cost move on this list. It can push back a database tier upgrade by months.

Cache-Control: no-cache
X-Cache-Backend: redis
redis-cli config set maxmemory-policy allkeys-lru
Enter fullscreen mode Exit fullscreen mode

Profile before you resize

The default reaction to slowness is "buy a bigger plan." Usually the real cause is an unindexed query, an unbounded cron job, or a slow third-party API call on the request path. Fix that first, or you're just paying to hide the problem.

Get background jobs off the request path

Cron and queue workers sharing a process pool with web traffic means a traffic spike starves your jobs, or your jobs starve your traffic. Give workers their own resource allocation.

Migrate like it's production, because it is

Run parallel environments, sync data, and cut over in a defined window. Don't treat this as a one-shot swap, even on your first migration.

Match infra to your actual traffic shape

Predictable daily load and occasional campaign spikes need different answers. Autoscaling, load balancers, and fixed HA clusters solve different problems; picking wrong means overpaying or getting caught flat-footed.

Offload static assets to a CDN

Don't just move your monolith to a bigger box. Split static/media delivery to a CDN and let app servers handle dynamic requests only. This alone typically cuts origin load 40-60%.

Set SLOs before you migrate, not after

Decide what uptime, latency, and error rate actually matter to your business. That gives you a target architecture instead of an endless upgrade treadmill.

Load test with concurrency, not page speed tools

Shared hosting doesn't break on a single-user speed test, it breaks when 200 people hit checkout at once.

k6 run --vus 200 --duration 60s checkout_test.js
Enter fullscreen mode Exit fullscreen mode

Size for 12 months out, not today

Model expected traffic, data growth, and peak events now. Migrating twice is more expensive than sizing correctly once.

A rollout order that actually works

  • Weeks 1-2: instrument CPU, memory, connections, slow queries
  • Weeks 3-4: add caching, split the database (low risk, reversible)
  • Weeks 5-8: design target architecture, get SLOs signed off
  • Weeks 9-12+: execute migration in parallel, defined cutover, rollback plan ready

Assign one engineer as migration owner. Diffuse ownership is how these projects stall, everyone assumes someone else is watching the graphs.

Bottom line

This isn't one big decision, it's a sequence of small, testable changes. Start with monitoring and caching, fix the cheap wins, then plan the architectural move once you actually know your bottleneck.

Full details in the original writeup: Best practices for moving off shared hosting as your traffic grows

Originally published on binadit.com

Top comments (0)