Customer Problem

The client was facing frequent downtime and heavy resource usages on his website hosted in Amazon AWS instance. So he needs to ensure High Availability ( HA ) for his website. The client’s requirement was to setup a loadbalancer to ensure high avaliablity and also he needed caching for faster content delivery. The application uses websockets, so it must work via LB ( HTTPS).

Xieles Solution

We proposed AWS autoscaling with the image of the master server to ensure HA.

AWS autoscaling provides HA for your application and it monitors the performance of the resources. It will adjust the resource capacity based on the requests and usage. It is very easy to setup AWS application scaling with multiple resources, but implementing websokets with LB is tricky. Web Sockets provide a persistent connection between a client and server that both parties can use to start sending data at any time.

The Challenge

In the application load balancing, we need to use WebSockets XSS

  • AWS ELB doesn’t support WebSockets on HTTP/HTTPS (Layer 7).
  • Switching ELB protocols to TCP/SSL does the trick, but we do not receive X-Forwarded-For header from ELB anymore.

This can be done by enabling proxy protocol on the LB, so it starts using proxy_protocol. We could do only from AWS CLI. In order to do this, the web server must be Nginx. Proxy protocol adds an additional header to requests to pass server client’s IP which can be used if there is a load balancer between your server and clients.

In our case, the server is configured with Apache web server. So we can’t use proxy_protocol anymore. On Apache, it could be fixed by creating an additional target group with websocket port and enabling stickiness. Then increase the connetion timout of the application. Here we have 3 WebSockets. So we have created 3 Listeners for LB and passed the request to corresponding Target groups (websockets). From that websockets target, it goes to the target instances.

Customer Benefits: The main benefit is assured HA for his website. AWS autoscaling will adjust the resource capacity, so it is cost effective. We need to pay only for what we use. By the help of Elastic Cache, the contents will be served faster as it will load from Cache cluster. So less resource usage. This architecture will be able to handle to up to 50 K requests and this was confirmed after serveral benchmarking tests.

Technical Details

  • The main server is configured with Apache + PHP 5.6 and Amazon S3 is used for backup.
  • RDS Postgresql is used for database.
  • Elastic Cache Cluster with Memcached Engine is used for caching.
  • To Ensure HA AWS autoscaling with desired capacity 2 and maximum instance 10.

Project Duration

The total time duration of this project was around 6 hours. It is possible to deployment within 2 to 3 hours, but we need to do some benchmarks to ensure HA for the application. So we used Apache Jmeter and also Apache benchmark to test Autoscaling to ensure High Availability.

Xieles Support can help you with the AWS autoscaling to ensure High Availability for your website. Get a quote from us if you need any assistance.

STILL SPENDING TIME ON SUPPORT?

Outsource your helpdesk support to save time and money. We have technicians available for little over 5 USD per hour in order to assist your customers with their technical questions. Grow your business and concentrate more on your SALES!

Xieles Support is a provider of reliable and affordable internet services, consisting of Outsourced 24×7 Technical Support, Remote Server Administration, Server Security, Linux Server Management, Windows Server Management and Helpdesk Management to Web Hosting companies, Data centers and ISPs around the world. We are experts in Linux and Windows Server Administration, Advanced Server Security, Server Security Hardening. Our primary focus is on absolute client satisfaction through sustainable pricing, proactively managed services, investment in hosting infrastructure and renowned customer support.