How to Organize 24/7 Server Availability and Prevent It From Going Down

Server downtime is such a bitter pill that may seriously impair your business.

The fact is that no one is immune to the server downtime issues. They may occur of different reasons and at a different time.

However, forewarned is forearmed.

You can always foresee and quickly avoid server downtime without significant damage to your business.

In this article, you will learn how to organize management on your website to prevent server crashing and troubleshoot server down issues.

How to track your website’s performance data and observe problems in your server’s behavior

Use tools for server monitoring

Server monitoring is a process of scanning your servers on a regular basis. It quickly determines any small issues before they become a threat to your 24/7 website availability. Here are some of the most popular tools that do their job best.

Papertrail

Papertrail

Papertrail offers a set of tools for managing logs from apps, cloud services, and servers.

Here is how it works

  • Papertrail gathers all app logs and text log files in one place

  • You can search all the aggregated logs in real time

  • Get alerted when any trends occur

  • Get analytics on log velocity and troubleshoot spikes

At Apiko we use Papertrail to track any server errors that occur during the day and quickly tackle them.

papertrail-monitoring

Click here to see the image full-size

Sentry

Sentry

Sentry is an error tracking software that reproduces errors on both client and server side. Sentry includes breadcrumbs for logging messages, network requests, and database queries. We use Sentry on our projects to track everything that may lead to errors and quickly find the root reason for crashes. Here are other useful features of Sentry:

  • Bug’s history of events and actions where you can reproduce errors

  • See what has contributed to the errors

  • Track problems by release version

  • Assign new issues to your team

  • Get alerts when bugs occur

Logentries

logentries

Logentries is a log management and analysis software for instant log identification and analytics.

It gives you an opportunity to

  • Search your log events in real time

  • Identify key trends and view them in graph form

  • Get real-time reporting and notifications with automated anomaly detection

  • Сombine server metrics (CPU, memory, network, disk), system and application data to track information about system performance

Techniques to use to prevent server downtime

Let's review some of the general tips that will help to sustain 24/7 server availability.

Сhoose a reliable hosting provider that allows balancing the load between the servers

To prevent your website from going down and manage high-load activity, use the tools that share the workload among different servers. It will help you to prevent your app from being overloaded by requests.

At Apiko, we use AWS Elastic Beanstalk that allows to automatically distribute the load between the servers (instances), as well as add/remove new instances depending on the backend load.

To set this up, we indicate the load (in percents) and the number of instances that should be added under this load.

In case the server is down, it will automatically restart. Here is how the server instances and their data look like:

amazon-beanstalk-instances

Click here to see the image full size

elastic-beanstalk-monitoring

Click here to see the image full-size

Now let’s review the alternatives to Elastic Beanstalk

digital-ocean

Digital ocean is a cloud computing platform of virtual servers. It arms developers with an integrated toolset for monitoring server metrics, receiving alerts about thresholds, and tracking summary analytics. Other goodies include tracking CPU/disk usage, a percentage of physical RAM, and bandwidth usage.

Digital Ocean load balancer

Digital Ocean load balancers distribute your app’s traffic across the entire infrastructure and improve web and server availability

  • Each load balancer is backed by two instances for high availability

  • Your incoming traffic is distributed across resources

  • Load balancers automatically renew SSL certificates and support HTTP/2

Protect your database

The larger your application becomes, the more data it operates. To adapt your database to processing more workload, take the following measures:

  • Scale the database (horizontal and vertical scaling)

There are two types of database scaling: horizontal and vertical.

Vertical scaling means adding more virtual or physical resources to your existing server (such as more storage, memory or CPU).

Horizontal scaling, in turn, means adding more instances to the server when your app processes more data. Simply speaking, you add more servers that usually have less RAM and processors (e.g. are cheaper and smaller). Consequently, this type of scaling requires fewer costs.

To better understand the difference, take a look at this picture

horizontal-vertical-database-scale

  • Database backup

Database backup is required for protecting and restoring your data in case of its loss or damage. Always make regular backups of your database and test that backups weekly.

Conclusion

Don’t neglect these tips if you want your website to be available 24/7. It’s much easier to take measures that will prevent your server from crashing than deal with the consequences.