DEV Community

Alfadil mustafa
Alfadil mustafa

Posted on • Edited on

How to approach your application infrastructure

Here are some of my thoughts about DESIGN APP'S INFRASTRUCTURE.

MAINLY YOU NEED TO HAVE A PERSPECTIVE, In other words you must know the application you are about to work with. what is it's nature? how it handles the data? does it needs to scale? and so on... .
Setting a perspective will guide you and ease your decision making process.

Some principles for you to follow

  1. The application should be able to start and stop without any corruption on the data.
  2. You should be able to tell that the app is working or not.
  3. You should be able to replicate the app environment.
  4. Re-configuring the application should not lead to re-writing it.
  5. The data should always be external to all the components using it.
  6. Try to reach the ephemeral host concept. meaning that any host should be expendable.

Here are some questions you need to answer

1. How you will handle data? (filesystem, cache and database)

The filesystem

And when I say the filesystem I means all the files that the application uses directly from the host, Using those files in business applications usually leads to data lost or complicate the process of scaling or shuting a server down so I would recommend using network filesystem like (nfs) or storage as a service solutions like S3 or solutions from others vendors.

Cache

Any data you keep for a temporary period of time usually to speed up the transactions or to host some sessions data.
And like the filesystem and for the same reasons it should be external to the servers hosts using solutions like redis and memcached.

Database

What type of database you will need (SQL, NoSQL) will you host it or use a managed service. As a rule of thumb If you don't have sensitive data just use a managed database you will have less headache.

2. How you will scale each component?

Is your environment scalable?
One might get asked this question by that management or an audit but how to answer it?
let's ask another question what does you need to scale and when?
Is it your backend or the database or the whole solution?
there are two ways to decide:

based on resource utilization

Like CPU and RAM or generally hardware resources.

based on custom (metric)

Any custom business event metric like specific pattern of requests that alarm of a huge load requests or an event external to the application.

3. How you handle failure? (in all levels infra - database - data - app)

Here you need to know how to handle disaster and have a clair disaster recovery plan (DR) for all levels of your infrastructure.

4. How you deal with application starting up and shuting down ?

For the app to make sure of the consistency of the data it needs to properly handle the shutting down to release all the connections and streams.

Top comments (0)