Knowledge

Nowadays hundreds of thousands of webshops are hosted by today’s biggest cloud service provider, the Amazon Web Services. Numerous arguments can be listed to point out the advantages of cloud services compared to physical servers or smaller hosting providers, of which the most important ones are flexibility, scalability and the hourly usage-based pricing.

These three factors give us the opportunity to find a webshop hosting solution that fits our clients’ needs the best, be it a starting, low-cost, single-server solution, or a multi-server, automatically up- and downscaling, multi-region application. The limit of stability and redundancy is the sky. I will present 5 examples below demonstrating different hosting solutions, starting from the cheapest, single-server solutions.

SINGLE SERVER SOLUTION

The most cost effective solution is of course running all services on a single server:

  • web server
  • php server
  • database server
  • mail server
  • redis (optional)
  • varnish (optional)
  • rabbitmq (optional)
  • elasticsearch (optional)

The only separated service is a CDN (Content Delivery Network), which facilitates the quicker serving of static content. We recommend this solution mainly for developing purposes as it does not provide redundancy.

SINGLE SERVER WITH DEDICATED DATABASE SERVER

We can provide a little bit more security and stability to our webshop if we store the database (which is a non-ephemeral storage) separately from the system. Thus, we can store our data more securely and we can start to think about load balancing.

The database server is marked as RDS.

The following services can run on the server marked as C5:

  • web server
  • php server
  • mail server
  • redis (optional)
  • varnish (optional)
  • rabbitmq (optional)
  • elasticsearch (optional)

SINGLE SERVER SOLUTION WITH SEPARATED SERVICES

In this structure, almost all services are running on separate servers or dedicated AWS services. The most important advantage of this structure is load distribution. In case one of the services slows down, with a bit of luck, it will not break the complete webshop.

In this case, only the following services run on the C5 instance:

  • web server
  • php server
  • varnish (optional)

Thus, as it is displayed, the remaining services are handled by dedicated instances or AWS services.

MULTI SERVER APPLICATION WITH SEPARATED SERVICES

On the illustration below we can see the schematic figure of an application that raises the previous logic (complete separation) to the next level. In this structure a service is not run only by one instance, but we have more resources available, moreover, in different Availability Zones, that is in separate datacenters. Its obvious advantage is that a service downtime does not results in webshop downtime, as all services are redundant, so there is a secondary resource that serves it. Furthermore, its advantage is that it can scale automatically, so if the load of the webservers increase, it is able to provide sufficient resources with new web servers in order to provide an unimpeded service. Its disadvantage is that the costs multiply.

MULTI SERVER APPLICATION WITH SEPARATED SERVICES AND DEDICATED VARNISH INSTANCES

This structure is a further development of the previous scheme, where even the Varnishes receive dedicated servers, further increasing redundancy and scalability. Such an infrastructure (with code of proper quality) can serve hundreds of thousands of products and thousands of concurrent users.

CONCLUSION

At ITG, we recommend a unique solution tailored to each client’s ecommerce requirements, the examples above intend to represent the available options. Futhermore, in this article we have not touched the widespreadly used container based technologies, whose logical foundation is well visible from the figures above (separating services into microservices). The use of containers further simplifies the scaling of services. We will discuss this topic, as well as the container based deployment in my next post.