Handling very high-traffic websites

We can do a lot of things to make your website ideally ready to handle very high traffics. Hopefully, there is not a single solution but a combination of several options. Though a lot of options are possible, you need to be able to pickup the best one that works for your case.

  • Reduce overall HTTP Requests.
  • Merge, Minify: CSS, Javascripts and Images properly.
  • JIT: CSS at Top, JS at Bottom.
  • No CSS Expressions.
  • Use less data types to render.
  • Forced reusing cached assets.
  • Optimize / Tune-up database connection, query time and performance.
  • Cache database results, reports.
  • Optimize PHP Scripts.
  • Serve less images.
  • Serve compressed Output.
  • Replace faster web server software.
  • Replace faster PHP Version.
  • Use cached data, APC, Memcached, Redis – Opcodes, Opcache.
  • If possible, make the contents static.
  • Use proxy layer to speedup caching.
  • Enqueue tasks like emails.
  • Use frontend side queries, eg. Reactive Searches.
  • Use CDN and Parallel Serving.
  • Use micro-service and ajax based architecture.
  • Add server infrastructures, Network Adapter, Bandwidth, better CPU, better RAM, SSD Hard Disk.
  • Upgrade your hosting plans.
  • Load balance with multiple hosting stations.
  • Use Master/Slave database replication.
  • Design with less file read/writes on Server Side (Disk I/O).
  • Disable unused extensions.
  • Disable non-required software running in background.
  • Lock software update services on server.
  • Read Logs, Find Faults, Find Bottlenecks.
  • Distract the users for a while, so others can enter in.
  • Disable environment checks on production.
  • Balance worker connections.
  • Use APIs and hide core applications.
  • Use JSON data formats.
  • Virtually serve no HTML’ed output. Let the browser process something.
  • Upgrade scripts to use later releases, eg. MySQLi, PDO etc.
  • Hyper-Threading on non-multi-socket servers.
  • Limit the free contents, Prefer registered users.
  • Design without database level sorting requirements.
  • Duplicate the server nodes and contents.
  • Trade off HTTP vs HTTPS.
  • DNS Uptimes SLA.
  • Failover plans.

Also, know everything about your server environment and be prepared to apply any fixes required, as soon as possible. And, benchmark and know your limits too.