logo

Meta Description:

Discover how Strinosoft optimized AWS Elastic Beanstalk with Apache, Tomcat, Load Balancer tuning, and Auto-Healing setup — ensuring zero-downtime for production web applications.


Introduction

Managing high-traffic production environments on AWS Elastic Beanstalk can be challenging — especially when HTTPS, Load Balancers, and web servers like Apache and Tomcat are involved.

At Strinosoft, we recently faced an environment degradation issue where instances under heavy load would crash or slow down, causing Elastic Beanstalk to move from OK to Degraded to Severe health.
Manual reboot was the only quick fix — until we built a permanent, automated recovery solution.

In this blog, we share how we solved the problem, improved resilience, and helped the application auto-heal without downtime — a guide that can save your production system too.


The Problem

We observed the following symptoms in our AWS Elastic Beanstalk environment:

  • Apache Tomcat servers became unresponsive during traffic spikes.

  • Elastic Load Balancer (ELB) marked instances as unhealthy very quickly.

  • Environment health transitioned from OK ➔ Degraded ➔ Severe and did not auto-recover.

  • Manual reboot of the EC2 instance was required to bring the site back online.

  • Apache logs showed SSL session cache warnings and broken pipe errors.

Interestingly, environments without Load Balancers or HTTPS auto-recovered, while Load Balancer + HTTPS enabled environments got stuck until human intervention.


Root Causes We Identified

 

Cause Details
Missing SSL Session Cache Causing SSL handshake CPU overhead
Heavy HTTPS POST Requests Increasing thread usage and server memory pressure
Apache Restart Behavior apachectl restart killing active sessions abruptly
Strict Load Balancer Health Checks Immediate marking of instances as "unhealthy"
No Auto-Healing Configuration No instance replacement when failure persisted

How We Fixed It — The Strinosoft Approach


1. Optimized Apache for HTTPS Traffic

We tuned Apache’s configuration by:

  • Enabling SSLSessionCache to reduce CPU load:

    
     

    apache

    CopyEdit

    SSLSessionCache shmcb:/run/httpd/sslcache(512000) SSLSessionCacheTimeout 300

  • Adjusting KeepAlive settings:

    
     

    apache

    CopyEdit

    KeepAlive On MaxKeepAliveRequests 200 KeepAliveTimeout 5

  • Setting higher worker thread limits to manage more connections gracefully.


2. Improved Tomcat Connector Settings

We modified Tomcat’s server.xml:


 

xml

CopyEdit

<Connector port="8080" protocol="HTTP/1.1" maxThreads="500" minSpareThreads="100" maxConnections="10000" enableLookups="false" connectionTimeout="20000" URIEncoding="UTF-8" />

This allowed Tomcat to process many concurrent HTTPS requests without bottlenecks.


3. Changed Apache Restart Behavior

Instead of hard restarts (apachectl restart), we implemented graceful restarts:


 

bash

CopyEdit

sudo apachectl graceful

This preserved existing connections and kept Load Balancer health checks green even during deployments.


4. Enabled Elastic Beanstalk Auto-Healing

We configured Elastic Beanstalk to:

  • Enable "Replace Unhealthy Instances" in Capacity settings.

  • Set Health Check Grace Period to 300 seconds.

  • Fine-tuned Load Balancer Health Check settings:

    • Interval: 10 seconds

    • Timeout: 5 seconds

    • Healthy threshold: 3

    • Unhealthy threshold: 5

Now, if an instance stays unhealthy for 5 minutes, Elastic Beanstalk automatically terminates and replaces it with a fresh healthy instance.


5. Adjusted Load Balancer Health Check Targets

We pointed health checks to a lightweight endpoint (like / or /health) to avoid loading full web pages during health probes.


The Result ????

After applying these fixes:

  • Environment uptime improved dramatically.

  • Instance replacements are automatic — no human intervention required.

  • No more SSL errors or session cache warnings.

  • Apache and Tomcat handle thousands of concurrent users smoothly.

  • Load Balancer health checks now allow graceful recovery after restarts.

Business Impact:
➔ Higher application availability
➔ Better end-user experience
➔ Reduced manual monitoring overhead
➔ Confidence in scaling traffic without fear of downtime


Key Takeaways for Cloud Architects

✅ Always tune Apache and Tomcat settings for high traffic and HTTPS overhead.

✅ Prefer graceful restarts instead of hard restarts in production.

✅ Enable Auto-Healing for Elastic Beanstalk environments to automatically recover from bad deployments or crashes.

✅ Fine-tune Load Balancer health checks so that servers are not marked unhealthy too aggressively.

✅ SSL optimization is critical — session caching saves significant CPU.


Conclusion

High-availability on AWS is not automatic — it needs deliberate optimization, especially when handling secure, high-traffic applications.

At Strinosoft, we specialize in AWS Cloud Optimization, Elastic Beanstalk Scaling, and Zero Downtime Deployments for growing businesses.

If you’re facing similar scaling or reliability challenges,
???? Contact the Strinosoft Cloud Experts
Let’s build cloud infrastructure that heals itself and scales with your vision!

 

Tags:
Elastic Beanstalk Optimization, AWS Auto-Healing, Apache Tomcat Tuning, Load Balancer Health Checks, SSL Optimization, HTTPS Scaling, Cloud Infrastructure Best Practices, AWS Cloud Consulting, Strinosoft Cloud Solutions