1. Hosting Decision

Status

Status: Decided

Outcome: AWS in combination with local execution with Gin

Background

Heroku is currently used as the hosting solution. In Heroku, an instance of an application is called a dyno. For the current hosting, the Eco Plan with 1000 dyno hours was chosen for 5 dollars per month, billing is done by the second. These hours can be distributed over any number of dyno instances. If an instance is not active for 30 minutes in the Eco Plan, the instance is put into sleep mode. Billing is paused. If a request is made, it takes about 30 seconds for the instance to be restarted.

For data storage, Heroku uses one mini PostgreSQL database each for the testing and production environment. These cost 5 dollars a month each and are limited to 10,000 lines and 20 simultaneous connections.

In total, Heroku currently costs 15 dollars per month. Due to a discount from the Github Students Developer Pack, the current discount is 13 dollars per month. The discount is valid for 12 months and runs for another 7 months as of April 2023.

This hosting solution was chosen based on a previous decision. This decision was made when a free version of Heroku still existed. However, this was abolished at the end of 2022.

It is expected that the app will initially be used about 12 times a year with 20-50 participants each time. Later, it is expected that the app will be used every two days in productive operation.

Decision

A more powerful and reliable platform is needed to run the KatApp productively. For this reason, a decision is to be made as to which type of cloud hosting and which provider should be used for the further development and deployment of KatApp.

Decision criteria

  1. Availability: During a disaster, the availability of the KatApp is essential. If the frontend, backend or database is not available, the KatApp cannot be used.

  2. Scalability: During a disaster, the frontend, backend and database can be accessed by more than 100 helpers at the same time. At the same time the app may not be accessed for several days. From these points, seamless scaling of the backend and database is necessary for performance and cost reasons.

  3. Costs: The costs for the operation and maintenance of the platform should be kept as low as possible for economic reasons.

  4. Portability: Currently it is still unclear how the hosting will look like in case of a disaster without an internet connection. For this reason, the frontend, backend and database must also be able to run on a local server. In addition, the hosting should not be provider-bound.

5 Security and data protection: Since medical data is involved, the data and the server should be protected as best as possible.

6 Special features: Under this point, special features of the platform are highlighted.

Solutions

Basically, there are 6 different types of cloud models. The different models are shown in the following graphic:

Cloud Models Cloud Models

On-Premises describes a cloud model in which the computing resources are provided by the company itself.

IaaS stands for Infrastructure as a Service and describes a cloud service where the computing resources are provided by a cloud service provider.

CaaS stands for Container as a Service and describes a cloud service in which container technologies such as Docker are used to provide applications in the cloud.

PaaS stands for Platform as a Service and describes a cloud service in which all necessary resources for the development and provision of applications are offered.

FaaS stands for Function as a Service and describes a cloud service based on the execution of small individual isolated functions.

SaaS stands for Software as a Service and describes a cloud service where the software applications are provided by the provider. Since we develop the application ourselves, this cloud service is obsolete.

Further information is listed under this link

Evaluation

On-Premises

  1. Availability:

    • Advantages:
      • /
    • Disadvantages
      • Multiple servers at different locations necessary for high availability
      • internet connection must be redundant -> one internet provider may fail
  2. Scalability:

    • Advantages:
      • /
    • Disadvantages:
      • limited scaling until maximum number of available servers is reached
      • backend has to be adapted to allow scaling, due to the use of websockets the application is currently not completely stateless
      • high effort for scaling of databases
  3. Costs:

    • Advantages:
      • once the servers are purchased, costs are only for power, internet and maintenance
    • Disadvantages:
      • high costs for the acquisition of the servers
      • high costs for maintenance (replacement of defective hardware)
      • high costs for redundant internet lines
      • high costs during idle time
    • Expected costs:
      • Initial: 3000 Euro for 3 servers
      • Monthly: Internet: 2 x fiber 150 Euro, electricity costs: 170 Euro (3 servers with 200 Watt and 40 ct/kwh)
  4. Portability:

    • Advantages:
      • Data and application can be moved to other providers and local server without problems
    • Disadvantages:
      • /
  5. Security and privacy:

    • Advantages:
      • no other persons and organizations have access to the data
    • Disadvantages:
      • high effort to ensure the security of the server (hardening, applying updates, backup, etc.)
  6. special features:

    • Advantages:
      • /
    • Disadvantages:
      • /

IaaS

Examples: AWS EC2, Ionos Server

  1. Availability:

    • Advantages:
      • Mostly redundant internet lines through cloud providers
      • Selection of servers from different locations
    • Disadvantages:
      • /
  2. Scalability:

    • Advantages:
      • On-demand possible, no unused servers due to shutting down servers.
    • Disadvantages:
      • backend has to be adapted to allow scaling, due to the use of websockets the application is currently not completely stateless
      • high effort for initial setup
      • slow scaling due to boot of servers
      • high effort for scaling of databases
  3. Costs:

    • Advantages:
      • Costs only for runtime of active servers
    • Disadvantages:
      • even if the app is not used, there are costs for running servers, at least one server must always be running Expected costs:
      • Initial: -
      • Monthly: 3 x AWS EC2 a1.xlarge, 4 CPU - 8GB Ram - 10 Gbit = 225 Euro
  4. Portability:

    • Advantages:
      • Data and application can be moved to other providers and local server without any issues
    • Disadvantages:
      • /
  5. Security and privacy:

    • Advantages:
      • /
    • Disadvantages:
      • High effort to ensure the security of the server (hardening, applying updates, etc.)
      • Cloud providers may have access to the data
  6. Special features:

    • Advantages:
      • /
    • Disadvantages:
      • /

CaaS

  1. Availability:

    • Advantages:
      • High availability due to automatic management of infrastructure by cloud providers.
    • Disadvantages:
      • Backend must be adapted to enable scaling, due to the use of websockets the application is currently not completely stateless
      • high effort for scaling of databases
  2. Scalability:

    • Advantages:
      • flexible and fast scalable due to containers
    • Disadvantages:
      • Backend must be adapted to allow scaling, due to the use of websockets the application is currently not completely stateless
  3. Cost:

    • Advantages:
      • /
    • Disadvantages:
      • If the app is not in use, one container must be running
    • Expected costs:
      • Initial: -
      • Monthly: 3 x AWS Fargate 1 vCPU - 2 GB RAM = 120 Euro
  4. Portability:

    • Advantages:
      • Data and application can be moved to other providers and local server without any issues
    • Disadvantages:
      • /
  5. Security and privacy:

    • Advantages:
      • /
    • Disadvantages:
      • Cloud providers may have access to the data
  6. Special features:

    • Advantages:
      • /
    • Disadvantages:
      • /

PaaS

Examples: Heroku

  1. Availability:

    • Advantages:
      • High availability due to automatic management of infrastructure by cloud providers.
    • Disadvantages:
      • /
  2. Scalability:

    • Advantages:
      • Flexible and quickly scalable
    • Disadvantages:
      • Backend needs to be adapted to allow scaling, due to the use of websockets the application is currently not completely stateless
  3. Cost:

    • Advantages:
      • /
    • Disadvantages:
      • An instance of the application must always be running, even when the app is not in use
    • Expected costs:
      • Initial: -
      • Monthly: Production: 1 x Performance M Dyno + PostgreSQL Premium 0 (downtime 15 min per month, default 1 hour), Testing: Eco Dyno and Mini PostgreSQL = $510
  4. Portability:

    • Advantages:
      • Data and application can be moved to other providers and local server without any problems
    • Disadvantages:
      • /
  5. Security and privacy:

    • Advantages:
      • /
    • Disadvantages:
      • Cloud providers may have access to the data
  6. Special features:

    • Advantages:
      • /
    • Disadvantages:
      • Heroku does not offer persistent storage (necessary for image upload, AWS S3 or other necessary).
      • Heroku does not offer services like mail server (registration).

FaaS

Examples: AWS Lambda, Google Cloud Functions, Azure Functions.

FaaS Example FaaS Example

  1. Availability:

    • Advantages:
      • High availability due to automatic management of infrastructure by cloud providers.
    • Disadvantages:
      • /
  2. Scalability:

    • Advantages:
      • Best scaling due to stateless functions that can be executed simultaneously
      • low waiting time during scaling (less than 1 second until another function is started)
    • Disadvantages:
      • Backend must be adapted to enable scaling, due to the use of websockets the application is currently not completely stateless
      • Architecture of the backend needs to be adapted as the current backend needs to be split into functions.
  3. Costs:

    • Advantages:
      • Costs are only incurred when the app is actually used -> Costs only for number and duration of requests.
    • Disadvantages:
      • Expensive with continuous load, which is not to be expected with the app.
    • Expected costs:
      • Initial: -
      • Monthly: 1 x AWS Lambda 1000000 requests per month (100 ms, 128 MB Ram) -> 0,42 Euro + API Gateway circa 2,60 Euro, Ondemand DynamoDB with 2GB and 100000 Read and Write per month 3,74 Euro, 5 GB S3 Storage for hosting with 100000 requests and 1 TB Traffic 0,97 Euro -> 7,73 Euro
  4. Portability:

    • Advantages:
      • /
    • Disadvantages:
      • Each provider uses its own SDK for FaaS. For this reason, adjustments in the code are necessary when moving to another provider.
      • Local start is mostly possible with the development SDKs (exception for example Websockets at AWS) -> Abstraction layer in the code necessary to enable an easy switch and local start.
  5. Security and privacy:

    • Advantages:
      • since functions only run for a short time in isolated areas, the attack surface for third parties is very small
    • Disadvantages:
      • Cloud providers may have access to the data
  6. Special features:

    • Advantages:
      • Large cloud providers such as AWS offer other services such as email, S3, etc.
      • AWS offers a Free Tier at Lambda with 1 million requests and 3.2 million seconds of compute per month permanently free, this requires the AWS API Gateway that offers 1 million requests per month 12 months free.
    • Disadvantages:
      • After an unspecified time (1 - 30 minutes), the functions switch to sleep mode. If they are called again, a so-called cold start takes place, during which the functions are instantiated. This cold start lasts 0.5 seconds to 1.5 seconds. (can be avoided with “Provisioned Concurrency” -> an instance runs permanently).