Skip to main content

Basic Concepts

Introduction of software application named Mini Mall

Mini Mall is a simple solution for local merchants to manage there inventory online, accept online payments and generate invoice for there customers.

using this data mini mall helps merchant in book keeping, sales insights and notify about old stock to clear.

Initial Setup

so initially we started with simple setup which consists of :

  • Virtual Machine / Server: A server is nothing but a computer machine designed for compute, store, and manage data, devices, and systems over a network.
  • Backend: consists of API to register merchant, manage inventory, create bill, get sales insights and many more.
  • Frontend: this piece mainly consists of static files such as HTML, CSS, JS to serve User Interface.
  • Database: database consist of data to store merchant data, inventory data, bills data and sales transactions data.
  • Web-server: software component that delivers static data like images, files, and text in response to client requests we are using Nginx here.
Loading...

So far every thing is good, let's understand the situation

  • when user opens the web application using public_ip: 170.187.254.215 then NGINX as web server will serve the static files.

  • we also have mobile applications for merchant which will notify the merchants about store such as payment status etc.

  • for mobile applications we are offering Rest API's with which data is rendered on mobile-app. Sample API request

    curl -X GET 170.187.254.215:5000/api/inventory

Concept: Reverse Proxy

so after adding reverse proxy layer our backend is now behind the proxy server in this way we have make sure that all the traffic will went through the proxy layer and will provide some benefits as follows:

  1. Url Routing : so now we don't have to mention the port in the url instead we will just add the prefix /api which in turn tell reverse proxy to hit the backend internally.
  2. Rate Limiting: just by adding simple configuration we can mention the threshold to limit the request to the server.
  3. Caching: reverse proxy provides the caching mechanism and we can apply this just using some configuration including proxy_path: where to store,key_zone: tells about storage,cache_key: how to create cache key etc.for more info read here.
  4. Load Balancing: so in future we can add multiple replicas so one replica runs at 4000, second runs at 5000 etc.so by mentioning the list of ports reverse proxy can balance the load between different replicas.
Loading...

So far every thing is good, let's understand the situation

  • we hit the endpoint 170.187.254.215 for static content and to hit the backend API's we use enpoint: 170.187.254.215/api

Concept: DNS(Domain Name System)

At this step we have purchased the domain and in Domain management dashboard we will add a record to map our public IP with domain name.

Record TypeNameValueTTL (Time-to-Live)
Aminimall.com170.187.254.2153600
  1. Record Type: A (Address record), which maps domain names to IPv4 addresses.
  2. Name: The domain name is "minimall.com."
  3. Value: The associated IP address is 170.187.254.215.
  4. TTL (Time-to-Live): The information can be cached by DNS resolvers for up to 3600 seconds (1 hour) before needing to refresh.

Some Popular record types:

  1. A (Address): Maps a domain name to an IPv4 address.
  2. AAAA (IPv6 Address): Maps a domain name to an IPv6 address.
  3. CNAME (Canonical Name): Alias of one domain to another (used for subdomains).
Loading...

So far every thing is good, let's understand the situation

  • so now we have nice domain and our sales team, onboarded some merchants and some of the merchants are actively managing there inventory and created some bills.

  • now there is some users who is using our application.

Concept: Logging and Monitoring

At this step we need a system setup which will record:

  1. Logs: Produced by application. Types of Logs based on Level: info, debug, error,warning etc.
  2. Metrics: Mainly tells about performance of Application,Virtual Machine and Database.main performace indicators are: CPU,Memory Utilization, Latency and Network metrics.

Next thing we need a dashboard which mainly pull the record of logs and metrics from a datasource/database so that team can able to visualize and take actions.

Hence we can use Grafana or Kibana as our dashboarding tool.here we are using Grafana.

Loading...

So far every thing is good, let's understand the situation

  • so now we have a nice dashboard where we can see metrics such as CPU usage, RAM usage, Disk space etc.

  • we can also see the logs from dashboard which can helps us to see the Error rates,Application health,Application behaviour etc.